From 68d32c9aff06aeff9b04c8cfff89459e35cd6369 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Mon, 14 Apr 2025 14:44:48 +0000 Subject: [PATCH] feat: update generated APIs --- .../product_catalog/__init__.py | 2 + .../product_catalog/v2alpha1/__init__.py | 51 ++ .../product_catalog/v2alpha1/api.py | 80 +++ .../product_catalog/v2alpha1/marshalling.py | 570 ++++++++++++++++++ .../product_catalog/v2alpha1/types.py | 396 ++++++++++++ scaleway/scaleway/product_catalog/__init__.py | 2 + .../product_catalog/v2alpha1/__init__.py | 51 ++ .../scaleway/product_catalog/v2alpha1/api.py | 80 +++ .../product_catalog/v2alpha1/marshalling.py | 570 ++++++++++++++++++ .../product_catalog/v2alpha1/types.py | 396 ++++++++++++ 10 files changed, 2198 insertions(+) create mode 100644 scaleway-async/scaleway_async/product_catalog/__init__.py create mode 100644 scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py create mode 100644 scaleway-async/scaleway_async/product_catalog/v2alpha1/api.py create mode 100644 scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py create mode 100644 scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py create mode 100644 scaleway/scaleway/product_catalog/__init__.py create mode 100644 scaleway/scaleway/product_catalog/v2alpha1/__init__.py create mode 100644 scaleway/scaleway/product_catalog/v2alpha1/api.py create mode 100644 scaleway/scaleway/product_catalog/v2alpha1/marshalling.py create mode 100644 scaleway/scaleway/product_catalog/v2alpha1/types.py diff --git a/scaleway-async/scaleway_async/product_catalog/__init__.py b/scaleway-async/scaleway_async/product_catalog/__init__.py new file mode 100644 index 000000000..8b74a5ed7 --- /dev/null +++ b/scaleway-async/scaleway_async/product_catalog/__init__.py @@ -0,0 +1,2 @@ +# This file was automatically generated. DO NOT EDIT. +# If you have any remark or suggestion do not hesitate to open an issue. diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py new file mode 100644 index 000000000..18dd002b9 --- /dev/null +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py @@ -0,0 +1,51 @@ +# This file was automatically generated. DO NOT EDIT. +# If you have any remark or suggestion do not hesitate to open an issue. +from .types import PublicCatalogProductPriceUnitOfMeasureCountableUnit +from .types import PublicCatalogProductPropertiesHardwareCPUArch +from .types import PublicCatalogProductPropertiesHardwareCPUPhysical +from .types import PublicCatalogProductPropertiesHardwareCPUVirtual +from .types import PublicCatalogProductPropertiesHardwareCPU +from .types import PublicCatalogProductPropertiesHardwareGPU +from .types import PublicCatalogProductPropertiesHardwareNetwork +from .types import PublicCatalogProductPropertiesHardwareRAM +from .types import PublicCatalogProductPropertiesHardwareStorage +from .types import PublicCatalogProductPriceUnitOfMeasure +from .types import PublicCatalogProductPropertiesAppleSilicon +from .types import PublicCatalogProductPropertiesDedibox +from .types import PublicCatalogProductPropertiesElasticMetal +from .types import PublicCatalogProductPropertiesHardware +from .types import PublicCatalogProductPropertiesInstance +from .types import PublicCatalogProductEnvironmentalImpact +from .types import PublicCatalogProductLocality +from .types import PublicCatalogProductPrice +from .types import PublicCatalogProductProperties +from .types import PublicCatalogProduct +from .types import ListPublicCatalogProductsResponse +from .types import PublicCatalogApiListPublicCatalogProductsRequest +from .api import ProductCatalogV2Alpha1PublicCatalogAPI + +__all__ = [ + "PublicCatalogProductPriceUnitOfMeasureCountableUnit", + "PublicCatalogProductPropertiesHardwareCPUArch", + "PublicCatalogProductPropertiesHardwareCPUPhysical", + "PublicCatalogProductPropertiesHardwareCPUVirtual", + "PublicCatalogProductPropertiesHardwareCPU", + "PublicCatalogProductPropertiesHardwareGPU", + "PublicCatalogProductPropertiesHardwareNetwork", + "PublicCatalogProductPropertiesHardwareRAM", + "PublicCatalogProductPropertiesHardwareStorage", + "PublicCatalogProductPriceUnitOfMeasure", + "PublicCatalogProductPropertiesAppleSilicon", + "PublicCatalogProductPropertiesDedibox", + "PublicCatalogProductPropertiesElasticMetal", + "PublicCatalogProductPropertiesHardware", + "PublicCatalogProductPropertiesInstance", + "PublicCatalogProductEnvironmentalImpact", + "PublicCatalogProductLocality", + "PublicCatalogProductPrice", + "PublicCatalogProductProperties", + "PublicCatalogProduct", + "ListPublicCatalogProductsResponse", + "PublicCatalogApiListPublicCatalogProductsRequest", + "ProductCatalogV2Alpha1PublicCatalogAPI", +] diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/api.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/api.py new file mode 100644 index 000000000..64c2db73b --- /dev/null +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/api.py @@ -0,0 +1,80 @@ +# This file was automatically generated. DO NOT EDIT. +# If you have any remark or suggestion do not hesitate to open an issue. + +from typing import List, Optional + +from scaleway_core.api import API +from scaleway_core.utils import ( + fetch_all_pages_async, +) +from .types import ( + ListPublicCatalogProductsResponse, + PublicCatalogProduct, +) +from .marshalling import ( + unmarshal_ListPublicCatalogProductsResponse, +) + + +class ProductCatalogV2Alpha1PublicCatalogAPI(API): + """ """ + + async def list_public_catalog_products( + self, + *, + page: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ListPublicCatalogProductsResponse: + """ + List all available products. + List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request. + :param page: Number of the page. Value must be greater or equal to 1. + :param page_size: The number of products per page. Value must be greater or equal to 1. + :return: :class:`ListPublicCatalogProductsResponse ` + + Usage: + :: + + result = await api.list_public_catalog_products() + """ + + res = self._request( + "GET", + "/product-catalog/v2alpha1/public-catalog/products", + params={ + "page": page, + "page_size": page_size or self.client.default_page_size, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListPublicCatalogProductsResponse(res.json()) + + async def list_public_catalog_products_all( + self, + *, + page: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PublicCatalogProduct]: + """ + List all available products. + List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request. + :param page: Number of the page. Value must be greater or equal to 1. + :param page_size: The number of products per page. Value must be greater or equal to 1. + :return: :class:`List[PublicCatalogProduct] ` + + Usage: + :: + + result = await api.list_public_catalog_products_all() + """ + + return await fetch_all_pages_async( + type=ListPublicCatalogProductsResponse, + key="products", + fetcher=self.list_public_catalog_products, + args={ + "page": page, + "page_size": page_size, + }, + ) diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py new file mode 100644 index 000000000..b9d7e24cf --- /dev/null +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py @@ -0,0 +1,570 @@ +# This file was automatically generated. DO NOT EDIT. +# If you have any remark or suggestion do not hesitate to open an issue. + +from typing import Any, Dict + +from scaleway_core.bridge import ( + unmarshal_Money, +) +from .types import ( + PublicCatalogProductPropertiesHardwareCPUPhysical, + PublicCatalogProductPropertiesHardwareCPUVirtual, + PublicCatalogProductPropertiesHardwareCPU, + PublicCatalogProductPropertiesHardwareGPU, + PublicCatalogProductPropertiesHardwareNetwork, + PublicCatalogProductPropertiesHardwareRAM, + PublicCatalogProductPropertiesHardwareStorage, + PublicCatalogProductPriceUnitOfMeasure, + PublicCatalogProductPropertiesAppleSilicon, + PublicCatalogProductPropertiesDedibox, + PublicCatalogProductPropertiesElasticMetal, + PublicCatalogProductPropertiesHardware, + PublicCatalogProductPropertiesInstance, + PublicCatalogProductEnvironmentalImpact, + PublicCatalogProductLocality, + PublicCatalogProductPrice, + PublicCatalogProductProperties, + PublicCatalogProduct, + ListPublicCatalogProductsResponse, +) + + +def unmarshal_PublicCatalogProductPropertiesHardwareCPUPhysical( + data: Any, +) -> PublicCatalogProductPropertiesHardwareCPUPhysical: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareCPUPhysical' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("sockets", None) + if field is not None: + args["sockets"] = field + + field = data.get("cores_per_socket", None) + if field is not None: + args["cores_per_socket"] = field + + field = data.get("threads_per_core", None) + if field is not None: + args["threads_per_core"] = field + + field = data.get("frequency", None) + if field is not None: + args["frequency"] = field + + field = data.get("benchmark", None) + if field is not None: + args["benchmark"] = field + + return PublicCatalogProductPropertiesHardwareCPUPhysical(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareCPUVirtual( + data: Any, +) -> PublicCatalogProductPropertiesHardwareCPUVirtual: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareCPUVirtual' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("count", None) + if field is not None: + args["count"] = field + + return PublicCatalogProductPropertiesHardwareCPUVirtual(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareCPU( + data: Any, +) -> PublicCatalogProductPropertiesHardwareCPU: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareCPU' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("arch", None) + if field is not None: + args["arch"] = field + + field = data.get("type", None) + if field is not None: + args["type_"] = field + + field = data.get("threads", None) + if field is not None: + args["threads"] = field + + field = data.get("virtual", None) + if field is not None: + args["virtual"] = unmarshal_PublicCatalogProductPropertiesHardwareCPUVirtual( + field + ) + else: + args["virtual"] = None + + field = data.get("physical", None) + if field is not None: + args["physical"] = unmarshal_PublicCatalogProductPropertiesHardwareCPUPhysical( + field + ) + else: + args["physical"] = None + + return PublicCatalogProductPropertiesHardwareCPU(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareGPU( + data: Any, +) -> PublicCatalogProductPropertiesHardwareGPU: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareGPU' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("count", None) + if field is not None: + args["count"] = field + + field = data.get("type", None) + if field is not None: + args["type_"] = field + + return PublicCatalogProductPropertiesHardwareGPU(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareNetwork( + data: Any, +) -> PublicCatalogProductPropertiesHardwareNetwork: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareNetwork' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("internal_bandwidth", None) + if field is not None: + args["internal_bandwidth"] = field + + field = data.get("public_bandwidth", None) + if field is not None: + args["public_bandwidth"] = field + + field = data.get("max_public_bandwidth", None) + if field is not None: + args["max_public_bandwidth"] = field + + return PublicCatalogProductPropertiesHardwareNetwork(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareRAM( + data: Any, +) -> PublicCatalogProductPropertiesHardwareRAM: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareRAM' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("size", None) + if field is not None: + args["size"] = field + + field = data.get("type", None) + if field is not None: + args["type_"] = field + + return PublicCatalogProductPropertiesHardwareRAM(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareStorage( + data: Any, +) -> PublicCatalogProductPropertiesHardwareStorage: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareStorage' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("total", None) + if field is not None: + args["total"] = field + + return PublicCatalogProductPropertiesHardwareStorage(**args) + + +def unmarshal_PublicCatalogProductPriceUnitOfMeasure( + data: Any, +) -> PublicCatalogProductPriceUnitOfMeasure: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPriceUnitOfMeasure' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("unit", None) + if field is not None: + args["unit"] = field + + field = data.get("size", None) + if field is not None: + args["size"] = field + + return PublicCatalogProductPriceUnitOfMeasure(**args) + + +def unmarshal_PublicCatalogProductPropertiesAppleSilicon( + data: Any, +) -> PublicCatalogProductPropertiesAppleSilicon: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesAppleSilicon' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("range", None) + if field is not None: + args["range"] = field + + return PublicCatalogProductPropertiesAppleSilicon(**args) + + +def unmarshal_PublicCatalogProductPropertiesDedibox( + data: Any, +) -> PublicCatalogProductPropertiesDedibox: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesDedibox' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("range", None) + if field is not None: + args["range"] = field + + return PublicCatalogProductPropertiesDedibox(**args) + + +def unmarshal_PublicCatalogProductPropertiesElasticMetal( + data: Any, +) -> PublicCatalogProductPropertiesElasticMetal: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesElasticMetal' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("range", None) + if field is not None: + args["range"] = field + + return PublicCatalogProductPropertiesElasticMetal(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardware( + data: Any, +) -> PublicCatalogProductPropertiesHardware: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardware' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("cpu", None) + if field is not None: + args["cpu"] = unmarshal_PublicCatalogProductPropertiesHardwareCPU(field) + else: + args["cpu"] = None + + field = data.get("ram", None) + if field is not None: + args["ram"] = unmarshal_PublicCatalogProductPropertiesHardwareRAM(field) + else: + args["ram"] = None + + field = data.get("storage", None) + if field is not None: + args["storage"] = unmarshal_PublicCatalogProductPropertiesHardwareStorage(field) + else: + args["storage"] = None + + field = data.get("network", None) + if field is not None: + args["network"] = unmarshal_PublicCatalogProductPropertiesHardwareNetwork(field) + else: + args["network"] = None + + field = data.get("gpu", None) + if field is not None: + args["gpu"] = unmarshal_PublicCatalogProductPropertiesHardwareGPU(field) + else: + args["gpu"] = None + + return PublicCatalogProductPropertiesHardware(**args) + + +def unmarshal_PublicCatalogProductPropertiesInstance( + data: Any, +) -> PublicCatalogProductPropertiesInstance: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesInstance' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("range", None) + if field is not None: + args["range"] = field + + return PublicCatalogProductPropertiesInstance(**args) + + +def unmarshal_PublicCatalogProductEnvironmentalImpact( + data: Any, +) -> PublicCatalogProductEnvironmentalImpact: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductEnvironmentalImpact' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("kg_co2_equivalent", None) + if field is not None: + args["kg_co2_equivalent"] = field + else: + args["kg_co2_equivalent"] = None + + field = data.get("m3_water_usage", None) + if field is not None: + args["m3_water_usage"] = field + else: + args["m3_water_usage"] = None + + return PublicCatalogProductEnvironmentalImpact(**args) + + +def unmarshal_PublicCatalogProductLocality(data: Any) -> PublicCatalogProductLocality: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductLocality' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("global", None) + if field is not None: + args["global_"] = field + else: + args["global_"] = None + + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + + field = data.get("zone", None) + if field is not None: + args["zone"] = field + else: + args["zone"] = None + + field = data.get("datacenter", None) + if field is not None: + args["datacenter"] = field + else: + args["datacenter"] = None + + return PublicCatalogProductLocality(**args) + + +def unmarshal_PublicCatalogProductPrice(data: Any) -> PublicCatalogProductPrice: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPrice' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("retail_price", None) + if field is not None: + args["retail_price"] = unmarshal_Money(field) + else: + args["retail_price"] = None + + field = data.get("unit_of_measure", None) + if field is not None: + args["unit_of_measure"] = unmarshal_PublicCatalogProductPriceUnitOfMeasure( + field + ) + else: + args["unit_of_measure"] = None + + return PublicCatalogProductPrice(**args) + + +def unmarshal_PublicCatalogProductProperties( + data: Any, +) -> PublicCatalogProductProperties: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductProperties' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("hardware", None) + if field is not None: + args["hardware"] = unmarshal_PublicCatalogProductPropertiesHardware(field) + else: + args["hardware"] = None + + field = data.get("dedibox", None) + if field is not None: + args["dedibox"] = unmarshal_PublicCatalogProductPropertiesDedibox(field) + else: + args["dedibox"] = None + + field = data.get("elastic_metal", None) + if field is not None: + args["elastic_metal"] = unmarshal_PublicCatalogProductPropertiesElasticMetal( + field + ) + else: + args["elastic_metal"] = None + + field = data.get("apple_silicon", None) + if field is not None: + args["apple_silicon"] = unmarshal_PublicCatalogProductPropertiesAppleSilicon( + field + ) + else: + args["apple_silicon"] = None + + field = data.get("instance", None) + if field is not None: + args["instance"] = unmarshal_PublicCatalogProductPropertiesInstance(field) + else: + args["instance"] = None + + return PublicCatalogProductProperties(**args) + + +def unmarshal_PublicCatalogProduct(data: Any) -> PublicCatalogProduct: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProduct' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("sku", None) + if field is not None: + args["sku"] = field + + field = data.get("service_category", None) + if field is not None: + args["service_category"] = field + + field = data.get("product", None) + if field is not None: + args["product"] = field + + field = data.get("variant", None) + if field is not None: + args["variant"] = field + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("locality", None) + if field is not None: + args["locality"] = unmarshal_PublicCatalogProductLocality(field) + else: + args["locality"] = None + + field = data.get("price", None) + if field is not None: + args["price"] = unmarshal_PublicCatalogProductPrice(field) + else: + args["price"] = None + + field = data.get("properties", None) + if field is not None: + args["properties"] = unmarshal_PublicCatalogProductProperties(field) + else: + args["properties"] = None + + field = data.get("environmental_impact", None) + if field is not None: + args["environmental_impact"] = ( + unmarshal_PublicCatalogProductEnvironmentalImpact(field) + ) + else: + args["environmental_impact"] = None + + return PublicCatalogProduct(**args) + + +def unmarshal_ListPublicCatalogProductsResponse( + data: Any, +) -> ListPublicCatalogProductsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListPublicCatalogProductsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("products", None) + if field is not None: + args["products"] = ( + [unmarshal_PublicCatalogProduct(v) for v in field] + if field is not None + else None + ) + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + + return ListPublicCatalogProductsResponse(**args) diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py new file mode 100644 index 000000000..02c1bef47 --- /dev/null +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py @@ -0,0 +1,396 @@ +# This file was automatically generated. DO NOT EDIT. +# If you have any remark or suggestion do not hesitate to open an issue. +from __future__ import annotations + +from dataclasses import dataclass +from enum import Enum +from typing import List, Optional + +from scaleway_core.bridge import ( + Money, + Region as ScwRegion, + Zone as ScwZone, +) +from scaleway_core.utils import ( + StrEnumMeta, +) + + +class PublicCatalogProductPriceUnitOfMeasureCountableUnit( + str, Enum, metaclass=StrEnumMeta +): + UNKNOWN_COUNTABLE_UNIT = "unknown_countable_unit" + CHUNK = "chunk" + CORE = "core" + CURRENCY = "currency" + DEVICE = "device" + DOMAIN = "domain" + EMAIL = "email" + GB_S = "gb_s" + GIGABYTE = "gigabyte" + HOUR = "hour" + IOPS_GIGABYTE = "iops_gigabyte" + IP = "ip" + MONTH = "month" + NODE = "node" + PLAN = "plan" + QUERY = "query" + REQUEST = "request" + SESSION = "session" + VCPU_S = "vcpu_s" + VERSION = "version" + YEAR = "year" + KEY = "key" + TOKEN = "token" + MINUTE = "minute" + SETUP = "setup" + DAY = "day" + + def __str__(self) -> str: + return str(self.value) + + +class PublicCatalogProductPropertiesHardwareCPUArch(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_ARCH = "unknown_arch" + X64 = "x64" + ARM64 = "arm64" + RISCV = "riscv" + APPLE_SILICON = "apple_silicon" + + def __str__(self) -> str: + return str(self.value) + + +@dataclass +class PublicCatalogProductPropertiesHardwareCPUPhysical: + sockets: int + """ + The number of sockets of the CPU. + """ + + cores_per_socket: int + """ + The number of cores per socket. + """ + + threads_per_core: int + """ + The number of threads per core. + """ + + frequency: int + """ + The frequency of the CPU in Hertz. + """ + + benchmark: int + """ + The benchmark score of the CPU. + """ + + +@dataclass +class PublicCatalogProductPropertiesHardwareCPUVirtual: + count: int + """ + The number of vCPUs. + """ + + +@dataclass +class PublicCatalogProductPropertiesHardwareCPU: + description: str + """ + A human readable description of the CPU. + """ + + arch: PublicCatalogProductPropertiesHardwareCPUArch + """ + The architecture of the CPU. + """ + + type_: str + """ + The type of the CPU. + """ + + threads: int + """ + The total number of threads. + """ + + virtual: Optional[PublicCatalogProductPropertiesHardwareCPUVirtual] + + physical: Optional[PublicCatalogProductPropertiesHardwareCPUPhysical] + + +@dataclass +class PublicCatalogProductPropertiesHardwareGPU: + description: str + """ + A human-readable description of the GPU. + """ + + count: int + """ + The number of GPUs. + """ + + type_: str + """ + The type of the GPU. + """ + + +@dataclass +class PublicCatalogProductPropertiesHardwareNetwork: + description: str + """ + A human-readable description of the network. + """ + + internal_bandwidth: int + """ + The internal bandwidth in bits per second. + """ + + public_bandwidth: int + """ + The default public bandwidth in bits per second. + """ + + max_public_bandwidth: int + """ + The maximum public bandwidth in bits per second (may require subscription to options). + """ + + +@dataclass +class PublicCatalogProductPropertiesHardwareRAM: + description: str + """ + A human-readable description of the RAM. + """ + + size: int + """ + The size of the RAM in bytes. + """ + + type_: str + """ + The type of the RAM. + """ + + +@dataclass +class PublicCatalogProductPropertiesHardwareStorage: + description: str + """ + A human-readable description of the storage. + """ + + total: int + """ + The total size of the storage in bytes. + """ + + +@dataclass +class PublicCatalogProductPriceUnitOfMeasure: + unit: PublicCatalogProductPriceUnitOfMeasureCountableUnit + """ + The unit of measure. + """ + + size: int + """ + The size of the unit. + """ + + +@dataclass +class PublicCatalogProductPropertiesAppleSilicon: + range: str + """ + The range of the Apple Silicon server. + """ + + +@dataclass +class PublicCatalogProductPropertiesDedibox: + range: str + """ + The range of the Dedibox server. + """ + + +@dataclass +class PublicCatalogProductPropertiesElasticMetal: + range: str + """ + The range of the Elastic Metal server. + """ + + +@dataclass +class PublicCatalogProductPropertiesHardware: + cpu: Optional[PublicCatalogProductPropertiesHardwareCPU] + """ + The CPU hardware properties. + """ + + ram: Optional[PublicCatalogProductPropertiesHardwareRAM] + """ + The RAM hardware properties. + """ + + storage: Optional[PublicCatalogProductPropertiesHardwareStorage] + """ + The storage hardware properties. + """ + + network: Optional[PublicCatalogProductPropertiesHardwareNetwork] + """ + The network hardware properties. + """ + + gpu: Optional[PublicCatalogProductPropertiesHardwareGPU] + """ + The GPU hardware properties. + """ + + +@dataclass +class PublicCatalogProductPropertiesInstance: + range: str + """ + The range of the Instance server. + """ + + +@dataclass +class PublicCatalogProductEnvironmentalImpact: + kg_co2_equivalent: Optional[float] + """ + Kilograms of CO2 that would need to be released to produce the equivalent warming impact. + """ + + m3_water_usage: Optional[float] + """ + Cubic meters of water used. + """ + + +@dataclass +class PublicCatalogProductLocality: + global_: Optional[bool] + + region: Optional[ScwRegion] + + zone: Optional[ScwZone] + + datacenter: Optional[str] + + +@dataclass +class PublicCatalogProductPrice: + retail_price: Optional[Money] + """ + The retail price of the product. + """ + + unit_of_measure: Optional[PublicCatalogProductPriceUnitOfMeasure] + """ + The unit of measure of the price. + """ + + +@dataclass +class PublicCatalogProductProperties: + hardware: Optional[PublicCatalogProductPropertiesHardware] + """ + The hardware properties of the product (if supported). + """ + + dedibox: Optional[PublicCatalogProductPropertiesDedibox] + + elastic_metal: Optional[PublicCatalogProductPropertiesElasticMetal] + + apple_silicon: Optional[PublicCatalogProductPropertiesAppleSilicon] + + instance: Optional[PublicCatalogProductPropertiesInstance] + + +@dataclass +class PublicCatalogProduct: + sku: str + """ + The unique identifier of the product. + """ + + service_category: str + """ + The category of the product. + """ + + product: str + """ + The product name. + """ + + variant: str + """ + The product variant. + """ + + description: str + """ + The product description. + """ + + locality: Optional[PublicCatalogProductLocality] + """ + The locality of the product. + """ + + price: Optional[PublicCatalogProductPrice] + """ + The price of the product. + """ + + properties: Optional[PublicCatalogProductProperties] + """ + The properties of the product. + """ + + environmental_impact: Optional[PublicCatalogProductEnvironmentalImpact] + """ + The environmental impact of the product. + """ + + +@dataclass +class ListPublicCatalogProductsResponse: + products: List[PublicCatalogProduct] + """ + The list of products. + """ + + total_count: int + """ + The total number of products in the catalog. + """ + + +@dataclass +class PublicCatalogApiListPublicCatalogProductsRequest: + page: Optional[int] + """ + Number of the page. Value must be greater or equal to 1. + """ + + page_size: Optional[int] + """ + The number of products per page. Value must be greater or equal to 1. + """ diff --git a/scaleway/scaleway/product_catalog/__init__.py b/scaleway/scaleway/product_catalog/__init__.py new file mode 100644 index 000000000..8b74a5ed7 --- /dev/null +++ b/scaleway/scaleway/product_catalog/__init__.py @@ -0,0 +1,2 @@ +# This file was automatically generated. DO NOT EDIT. +# If you have any remark or suggestion do not hesitate to open an issue. diff --git a/scaleway/scaleway/product_catalog/v2alpha1/__init__.py b/scaleway/scaleway/product_catalog/v2alpha1/__init__.py new file mode 100644 index 000000000..18dd002b9 --- /dev/null +++ b/scaleway/scaleway/product_catalog/v2alpha1/__init__.py @@ -0,0 +1,51 @@ +# This file was automatically generated. DO NOT EDIT. +# If you have any remark or suggestion do not hesitate to open an issue. +from .types import PublicCatalogProductPriceUnitOfMeasureCountableUnit +from .types import PublicCatalogProductPropertiesHardwareCPUArch +from .types import PublicCatalogProductPropertiesHardwareCPUPhysical +from .types import PublicCatalogProductPropertiesHardwareCPUVirtual +from .types import PublicCatalogProductPropertiesHardwareCPU +from .types import PublicCatalogProductPropertiesHardwareGPU +from .types import PublicCatalogProductPropertiesHardwareNetwork +from .types import PublicCatalogProductPropertiesHardwareRAM +from .types import PublicCatalogProductPropertiesHardwareStorage +from .types import PublicCatalogProductPriceUnitOfMeasure +from .types import PublicCatalogProductPropertiesAppleSilicon +from .types import PublicCatalogProductPropertiesDedibox +from .types import PublicCatalogProductPropertiesElasticMetal +from .types import PublicCatalogProductPropertiesHardware +from .types import PublicCatalogProductPropertiesInstance +from .types import PublicCatalogProductEnvironmentalImpact +from .types import PublicCatalogProductLocality +from .types import PublicCatalogProductPrice +from .types import PublicCatalogProductProperties +from .types import PublicCatalogProduct +from .types import ListPublicCatalogProductsResponse +from .types import PublicCatalogApiListPublicCatalogProductsRequest +from .api import ProductCatalogV2Alpha1PublicCatalogAPI + +__all__ = [ + "PublicCatalogProductPriceUnitOfMeasureCountableUnit", + "PublicCatalogProductPropertiesHardwareCPUArch", + "PublicCatalogProductPropertiesHardwareCPUPhysical", + "PublicCatalogProductPropertiesHardwareCPUVirtual", + "PublicCatalogProductPropertiesHardwareCPU", + "PublicCatalogProductPropertiesHardwareGPU", + "PublicCatalogProductPropertiesHardwareNetwork", + "PublicCatalogProductPropertiesHardwareRAM", + "PublicCatalogProductPropertiesHardwareStorage", + "PublicCatalogProductPriceUnitOfMeasure", + "PublicCatalogProductPropertiesAppleSilicon", + "PublicCatalogProductPropertiesDedibox", + "PublicCatalogProductPropertiesElasticMetal", + "PublicCatalogProductPropertiesHardware", + "PublicCatalogProductPropertiesInstance", + "PublicCatalogProductEnvironmentalImpact", + "PublicCatalogProductLocality", + "PublicCatalogProductPrice", + "PublicCatalogProductProperties", + "PublicCatalogProduct", + "ListPublicCatalogProductsResponse", + "PublicCatalogApiListPublicCatalogProductsRequest", + "ProductCatalogV2Alpha1PublicCatalogAPI", +] diff --git a/scaleway/scaleway/product_catalog/v2alpha1/api.py b/scaleway/scaleway/product_catalog/v2alpha1/api.py new file mode 100644 index 000000000..7d029767d --- /dev/null +++ b/scaleway/scaleway/product_catalog/v2alpha1/api.py @@ -0,0 +1,80 @@ +# This file was automatically generated. DO NOT EDIT. +# If you have any remark or suggestion do not hesitate to open an issue. + +from typing import List, Optional + +from scaleway_core.api import API +from scaleway_core.utils import ( + fetch_all_pages, +) +from .types import ( + ListPublicCatalogProductsResponse, + PublicCatalogProduct, +) +from .marshalling import ( + unmarshal_ListPublicCatalogProductsResponse, +) + + +class ProductCatalogV2Alpha1PublicCatalogAPI(API): + """ """ + + def list_public_catalog_products( + self, + *, + page: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ListPublicCatalogProductsResponse: + """ + List all available products. + List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request. + :param page: Number of the page. Value must be greater or equal to 1. + :param page_size: The number of products per page. Value must be greater or equal to 1. + :return: :class:`ListPublicCatalogProductsResponse ` + + Usage: + :: + + result = api.list_public_catalog_products() + """ + + res = self._request( + "GET", + "/product-catalog/v2alpha1/public-catalog/products", + params={ + "page": page, + "page_size": page_size or self.client.default_page_size, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListPublicCatalogProductsResponse(res.json()) + + def list_public_catalog_products_all( + self, + *, + page: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PublicCatalogProduct]: + """ + List all available products. + List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request. + :param page: Number of the page. Value must be greater or equal to 1. + :param page_size: The number of products per page. Value must be greater or equal to 1. + :return: :class:`List[PublicCatalogProduct] ` + + Usage: + :: + + result = api.list_public_catalog_products_all() + """ + + return fetch_all_pages( + type=ListPublicCatalogProductsResponse, + key="products", + fetcher=self.list_public_catalog_products, + args={ + "page": page, + "page_size": page_size, + }, + ) diff --git a/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py b/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py new file mode 100644 index 000000000..b9d7e24cf --- /dev/null +++ b/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py @@ -0,0 +1,570 @@ +# This file was automatically generated. DO NOT EDIT. +# If you have any remark or suggestion do not hesitate to open an issue. + +from typing import Any, Dict + +from scaleway_core.bridge import ( + unmarshal_Money, +) +from .types import ( + PublicCatalogProductPropertiesHardwareCPUPhysical, + PublicCatalogProductPropertiesHardwareCPUVirtual, + PublicCatalogProductPropertiesHardwareCPU, + PublicCatalogProductPropertiesHardwareGPU, + PublicCatalogProductPropertiesHardwareNetwork, + PublicCatalogProductPropertiesHardwareRAM, + PublicCatalogProductPropertiesHardwareStorage, + PublicCatalogProductPriceUnitOfMeasure, + PublicCatalogProductPropertiesAppleSilicon, + PublicCatalogProductPropertiesDedibox, + PublicCatalogProductPropertiesElasticMetal, + PublicCatalogProductPropertiesHardware, + PublicCatalogProductPropertiesInstance, + PublicCatalogProductEnvironmentalImpact, + PublicCatalogProductLocality, + PublicCatalogProductPrice, + PublicCatalogProductProperties, + PublicCatalogProduct, + ListPublicCatalogProductsResponse, +) + + +def unmarshal_PublicCatalogProductPropertiesHardwareCPUPhysical( + data: Any, +) -> PublicCatalogProductPropertiesHardwareCPUPhysical: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareCPUPhysical' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("sockets", None) + if field is not None: + args["sockets"] = field + + field = data.get("cores_per_socket", None) + if field is not None: + args["cores_per_socket"] = field + + field = data.get("threads_per_core", None) + if field is not None: + args["threads_per_core"] = field + + field = data.get("frequency", None) + if field is not None: + args["frequency"] = field + + field = data.get("benchmark", None) + if field is not None: + args["benchmark"] = field + + return PublicCatalogProductPropertiesHardwareCPUPhysical(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareCPUVirtual( + data: Any, +) -> PublicCatalogProductPropertiesHardwareCPUVirtual: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareCPUVirtual' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("count", None) + if field is not None: + args["count"] = field + + return PublicCatalogProductPropertiesHardwareCPUVirtual(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareCPU( + data: Any, +) -> PublicCatalogProductPropertiesHardwareCPU: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareCPU' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("arch", None) + if field is not None: + args["arch"] = field + + field = data.get("type", None) + if field is not None: + args["type_"] = field + + field = data.get("threads", None) + if field is not None: + args["threads"] = field + + field = data.get("virtual", None) + if field is not None: + args["virtual"] = unmarshal_PublicCatalogProductPropertiesHardwareCPUVirtual( + field + ) + else: + args["virtual"] = None + + field = data.get("physical", None) + if field is not None: + args["physical"] = unmarshal_PublicCatalogProductPropertiesHardwareCPUPhysical( + field + ) + else: + args["physical"] = None + + return PublicCatalogProductPropertiesHardwareCPU(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareGPU( + data: Any, +) -> PublicCatalogProductPropertiesHardwareGPU: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareGPU' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("count", None) + if field is not None: + args["count"] = field + + field = data.get("type", None) + if field is not None: + args["type_"] = field + + return PublicCatalogProductPropertiesHardwareGPU(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareNetwork( + data: Any, +) -> PublicCatalogProductPropertiesHardwareNetwork: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareNetwork' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("internal_bandwidth", None) + if field is not None: + args["internal_bandwidth"] = field + + field = data.get("public_bandwidth", None) + if field is not None: + args["public_bandwidth"] = field + + field = data.get("max_public_bandwidth", None) + if field is not None: + args["max_public_bandwidth"] = field + + return PublicCatalogProductPropertiesHardwareNetwork(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareRAM( + data: Any, +) -> PublicCatalogProductPropertiesHardwareRAM: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareRAM' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("size", None) + if field is not None: + args["size"] = field + + field = data.get("type", None) + if field is not None: + args["type_"] = field + + return PublicCatalogProductPropertiesHardwareRAM(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardwareStorage( + data: Any, +) -> PublicCatalogProductPropertiesHardwareStorage: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardwareStorage' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("total", None) + if field is not None: + args["total"] = field + + return PublicCatalogProductPropertiesHardwareStorage(**args) + + +def unmarshal_PublicCatalogProductPriceUnitOfMeasure( + data: Any, +) -> PublicCatalogProductPriceUnitOfMeasure: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPriceUnitOfMeasure' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("unit", None) + if field is not None: + args["unit"] = field + + field = data.get("size", None) + if field is not None: + args["size"] = field + + return PublicCatalogProductPriceUnitOfMeasure(**args) + + +def unmarshal_PublicCatalogProductPropertiesAppleSilicon( + data: Any, +) -> PublicCatalogProductPropertiesAppleSilicon: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesAppleSilicon' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("range", None) + if field is not None: + args["range"] = field + + return PublicCatalogProductPropertiesAppleSilicon(**args) + + +def unmarshal_PublicCatalogProductPropertiesDedibox( + data: Any, +) -> PublicCatalogProductPropertiesDedibox: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesDedibox' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("range", None) + if field is not None: + args["range"] = field + + return PublicCatalogProductPropertiesDedibox(**args) + + +def unmarshal_PublicCatalogProductPropertiesElasticMetal( + data: Any, +) -> PublicCatalogProductPropertiesElasticMetal: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesElasticMetal' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("range", None) + if field is not None: + args["range"] = field + + return PublicCatalogProductPropertiesElasticMetal(**args) + + +def unmarshal_PublicCatalogProductPropertiesHardware( + data: Any, +) -> PublicCatalogProductPropertiesHardware: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesHardware' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("cpu", None) + if field is not None: + args["cpu"] = unmarshal_PublicCatalogProductPropertiesHardwareCPU(field) + else: + args["cpu"] = None + + field = data.get("ram", None) + if field is not None: + args["ram"] = unmarshal_PublicCatalogProductPropertiesHardwareRAM(field) + else: + args["ram"] = None + + field = data.get("storage", None) + if field is not None: + args["storage"] = unmarshal_PublicCatalogProductPropertiesHardwareStorage(field) + else: + args["storage"] = None + + field = data.get("network", None) + if field is not None: + args["network"] = unmarshal_PublicCatalogProductPropertiesHardwareNetwork(field) + else: + args["network"] = None + + field = data.get("gpu", None) + if field is not None: + args["gpu"] = unmarshal_PublicCatalogProductPropertiesHardwareGPU(field) + else: + args["gpu"] = None + + return PublicCatalogProductPropertiesHardware(**args) + + +def unmarshal_PublicCatalogProductPropertiesInstance( + data: Any, +) -> PublicCatalogProductPropertiesInstance: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesInstance' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("range", None) + if field is not None: + args["range"] = field + + return PublicCatalogProductPropertiesInstance(**args) + + +def unmarshal_PublicCatalogProductEnvironmentalImpact( + data: Any, +) -> PublicCatalogProductEnvironmentalImpact: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductEnvironmentalImpact' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("kg_co2_equivalent", None) + if field is not None: + args["kg_co2_equivalent"] = field + else: + args["kg_co2_equivalent"] = None + + field = data.get("m3_water_usage", None) + if field is not None: + args["m3_water_usage"] = field + else: + args["m3_water_usage"] = None + + return PublicCatalogProductEnvironmentalImpact(**args) + + +def unmarshal_PublicCatalogProductLocality(data: Any) -> PublicCatalogProductLocality: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductLocality' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("global", None) + if field is not None: + args["global_"] = field + else: + args["global_"] = None + + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + + field = data.get("zone", None) + if field is not None: + args["zone"] = field + else: + args["zone"] = None + + field = data.get("datacenter", None) + if field is not None: + args["datacenter"] = field + else: + args["datacenter"] = None + + return PublicCatalogProductLocality(**args) + + +def unmarshal_PublicCatalogProductPrice(data: Any) -> PublicCatalogProductPrice: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPrice' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("retail_price", None) + if field is not None: + args["retail_price"] = unmarshal_Money(field) + else: + args["retail_price"] = None + + field = data.get("unit_of_measure", None) + if field is not None: + args["unit_of_measure"] = unmarshal_PublicCatalogProductPriceUnitOfMeasure( + field + ) + else: + args["unit_of_measure"] = None + + return PublicCatalogProductPrice(**args) + + +def unmarshal_PublicCatalogProductProperties( + data: Any, +) -> PublicCatalogProductProperties: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductProperties' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("hardware", None) + if field is not None: + args["hardware"] = unmarshal_PublicCatalogProductPropertiesHardware(field) + else: + args["hardware"] = None + + field = data.get("dedibox", None) + if field is not None: + args["dedibox"] = unmarshal_PublicCatalogProductPropertiesDedibox(field) + else: + args["dedibox"] = None + + field = data.get("elastic_metal", None) + if field is not None: + args["elastic_metal"] = unmarshal_PublicCatalogProductPropertiesElasticMetal( + field + ) + else: + args["elastic_metal"] = None + + field = data.get("apple_silicon", None) + if field is not None: + args["apple_silicon"] = unmarshal_PublicCatalogProductPropertiesAppleSilicon( + field + ) + else: + args["apple_silicon"] = None + + field = data.get("instance", None) + if field is not None: + args["instance"] = unmarshal_PublicCatalogProductPropertiesInstance(field) + else: + args["instance"] = None + + return PublicCatalogProductProperties(**args) + + +def unmarshal_PublicCatalogProduct(data: Any) -> PublicCatalogProduct: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProduct' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("sku", None) + if field is not None: + args["sku"] = field + + field = data.get("service_category", None) + if field is not None: + args["service_category"] = field + + field = data.get("product", None) + if field is not None: + args["product"] = field + + field = data.get("variant", None) + if field is not None: + args["variant"] = field + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("locality", None) + if field is not None: + args["locality"] = unmarshal_PublicCatalogProductLocality(field) + else: + args["locality"] = None + + field = data.get("price", None) + if field is not None: + args["price"] = unmarshal_PublicCatalogProductPrice(field) + else: + args["price"] = None + + field = data.get("properties", None) + if field is not None: + args["properties"] = unmarshal_PublicCatalogProductProperties(field) + else: + args["properties"] = None + + field = data.get("environmental_impact", None) + if field is not None: + args["environmental_impact"] = ( + unmarshal_PublicCatalogProductEnvironmentalImpact(field) + ) + else: + args["environmental_impact"] = None + + return PublicCatalogProduct(**args) + + +def unmarshal_ListPublicCatalogProductsResponse( + data: Any, +) -> ListPublicCatalogProductsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListPublicCatalogProductsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("products", None) + if field is not None: + args["products"] = ( + [unmarshal_PublicCatalogProduct(v) for v in field] + if field is not None + else None + ) + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + + return ListPublicCatalogProductsResponse(**args) diff --git a/scaleway/scaleway/product_catalog/v2alpha1/types.py b/scaleway/scaleway/product_catalog/v2alpha1/types.py new file mode 100644 index 000000000..02c1bef47 --- /dev/null +++ b/scaleway/scaleway/product_catalog/v2alpha1/types.py @@ -0,0 +1,396 @@ +# This file was automatically generated. DO NOT EDIT. +# If you have any remark or suggestion do not hesitate to open an issue. +from __future__ import annotations + +from dataclasses import dataclass +from enum import Enum +from typing import List, Optional + +from scaleway_core.bridge import ( + Money, + Region as ScwRegion, + Zone as ScwZone, +) +from scaleway_core.utils import ( + StrEnumMeta, +) + + +class PublicCatalogProductPriceUnitOfMeasureCountableUnit( + str, Enum, metaclass=StrEnumMeta +): + UNKNOWN_COUNTABLE_UNIT = "unknown_countable_unit" + CHUNK = "chunk" + CORE = "core" + CURRENCY = "currency" + DEVICE = "device" + DOMAIN = "domain" + EMAIL = "email" + GB_S = "gb_s" + GIGABYTE = "gigabyte" + HOUR = "hour" + IOPS_GIGABYTE = "iops_gigabyte" + IP = "ip" + MONTH = "month" + NODE = "node" + PLAN = "plan" + QUERY = "query" + REQUEST = "request" + SESSION = "session" + VCPU_S = "vcpu_s" + VERSION = "version" + YEAR = "year" + KEY = "key" + TOKEN = "token" + MINUTE = "minute" + SETUP = "setup" + DAY = "day" + + def __str__(self) -> str: + return str(self.value) + + +class PublicCatalogProductPropertiesHardwareCPUArch(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_ARCH = "unknown_arch" + X64 = "x64" + ARM64 = "arm64" + RISCV = "riscv" + APPLE_SILICON = "apple_silicon" + + def __str__(self) -> str: + return str(self.value) + + +@dataclass +class PublicCatalogProductPropertiesHardwareCPUPhysical: + sockets: int + """ + The number of sockets of the CPU. + """ + + cores_per_socket: int + """ + The number of cores per socket. + """ + + threads_per_core: int + """ + The number of threads per core. + """ + + frequency: int + """ + The frequency of the CPU in Hertz. + """ + + benchmark: int + """ + The benchmark score of the CPU. + """ + + +@dataclass +class PublicCatalogProductPropertiesHardwareCPUVirtual: + count: int + """ + The number of vCPUs. + """ + + +@dataclass +class PublicCatalogProductPropertiesHardwareCPU: + description: str + """ + A human readable description of the CPU. + """ + + arch: PublicCatalogProductPropertiesHardwareCPUArch + """ + The architecture of the CPU. + """ + + type_: str + """ + The type of the CPU. + """ + + threads: int + """ + The total number of threads. + """ + + virtual: Optional[PublicCatalogProductPropertiesHardwareCPUVirtual] + + physical: Optional[PublicCatalogProductPropertiesHardwareCPUPhysical] + + +@dataclass +class PublicCatalogProductPropertiesHardwareGPU: + description: str + """ + A human-readable description of the GPU. + """ + + count: int + """ + The number of GPUs. + """ + + type_: str + """ + The type of the GPU. + """ + + +@dataclass +class PublicCatalogProductPropertiesHardwareNetwork: + description: str + """ + A human-readable description of the network. + """ + + internal_bandwidth: int + """ + The internal bandwidth in bits per second. + """ + + public_bandwidth: int + """ + The default public bandwidth in bits per second. + """ + + max_public_bandwidth: int + """ + The maximum public bandwidth in bits per second (may require subscription to options). + """ + + +@dataclass +class PublicCatalogProductPropertiesHardwareRAM: + description: str + """ + A human-readable description of the RAM. + """ + + size: int + """ + The size of the RAM in bytes. + """ + + type_: str + """ + The type of the RAM. + """ + + +@dataclass +class PublicCatalogProductPropertiesHardwareStorage: + description: str + """ + A human-readable description of the storage. + """ + + total: int + """ + The total size of the storage in bytes. + """ + + +@dataclass +class PublicCatalogProductPriceUnitOfMeasure: + unit: PublicCatalogProductPriceUnitOfMeasureCountableUnit + """ + The unit of measure. + """ + + size: int + """ + The size of the unit. + """ + + +@dataclass +class PublicCatalogProductPropertiesAppleSilicon: + range: str + """ + The range of the Apple Silicon server. + """ + + +@dataclass +class PublicCatalogProductPropertiesDedibox: + range: str + """ + The range of the Dedibox server. + """ + + +@dataclass +class PublicCatalogProductPropertiesElasticMetal: + range: str + """ + The range of the Elastic Metal server. + """ + + +@dataclass +class PublicCatalogProductPropertiesHardware: + cpu: Optional[PublicCatalogProductPropertiesHardwareCPU] + """ + The CPU hardware properties. + """ + + ram: Optional[PublicCatalogProductPropertiesHardwareRAM] + """ + The RAM hardware properties. + """ + + storage: Optional[PublicCatalogProductPropertiesHardwareStorage] + """ + The storage hardware properties. + """ + + network: Optional[PublicCatalogProductPropertiesHardwareNetwork] + """ + The network hardware properties. + """ + + gpu: Optional[PublicCatalogProductPropertiesHardwareGPU] + """ + The GPU hardware properties. + """ + + +@dataclass +class PublicCatalogProductPropertiesInstance: + range: str + """ + The range of the Instance server. + """ + + +@dataclass +class PublicCatalogProductEnvironmentalImpact: + kg_co2_equivalent: Optional[float] + """ + Kilograms of CO2 that would need to be released to produce the equivalent warming impact. + """ + + m3_water_usage: Optional[float] + """ + Cubic meters of water used. + """ + + +@dataclass +class PublicCatalogProductLocality: + global_: Optional[bool] + + region: Optional[ScwRegion] + + zone: Optional[ScwZone] + + datacenter: Optional[str] + + +@dataclass +class PublicCatalogProductPrice: + retail_price: Optional[Money] + """ + The retail price of the product. + """ + + unit_of_measure: Optional[PublicCatalogProductPriceUnitOfMeasure] + """ + The unit of measure of the price. + """ + + +@dataclass +class PublicCatalogProductProperties: + hardware: Optional[PublicCatalogProductPropertiesHardware] + """ + The hardware properties of the product (if supported). + """ + + dedibox: Optional[PublicCatalogProductPropertiesDedibox] + + elastic_metal: Optional[PublicCatalogProductPropertiesElasticMetal] + + apple_silicon: Optional[PublicCatalogProductPropertiesAppleSilicon] + + instance: Optional[PublicCatalogProductPropertiesInstance] + + +@dataclass +class PublicCatalogProduct: + sku: str + """ + The unique identifier of the product. + """ + + service_category: str + """ + The category of the product. + """ + + product: str + """ + The product name. + """ + + variant: str + """ + The product variant. + """ + + description: str + """ + The product description. + """ + + locality: Optional[PublicCatalogProductLocality] + """ + The locality of the product. + """ + + price: Optional[PublicCatalogProductPrice] + """ + The price of the product. + """ + + properties: Optional[PublicCatalogProductProperties] + """ + The properties of the product. + """ + + environmental_impact: Optional[PublicCatalogProductEnvironmentalImpact] + """ + The environmental impact of the product. + """ + + +@dataclass +class ListPublicCatalogProductsResponse: + products: List[PublicCatalogProduct] + """ + The list of products. + """ + + total_count: int + """ + The total number of products in the catalog. + """ + + +@dataclass +class PublicCatalogApiListPublicCatalogProductsRequest: + page: Optional[int] + """ + Number of the page. Value must be greater or equal to 1. + """ + + page_size: Optional[int] + """ + The number of products per page. Value must be greater or equal to 1. + """