Skip to content

feat(product_catalog): object storage to estimation api #1168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .types import PublicCatalogProductPropertiesElasticMetal
from .types import PublicCatalogProductPropertiesHardware
from .types import PublicCatalogProductPropertiesInstance
from .types import PublicCatalogProductPropertiesObjectStorage
from .types import PublicCatalogProductEnvironmentalImpactEstimation
from .types import PublicCatalogProductLocality
from .types import PublicCatalogProductPrice
Expand Down Expand Up @@ -45,6 +46,7 @@
"PublicCatalogProductPropertiesElasticMetal",
"PublicCatalogProductPropertiesHardware",
"PublicCatalogProductPropertiesInstance",
"PublicCatalogProductPropertiesObjectStorage",
"PublicCatalogProductEnvironmentalImpactEstimation",
"PublicCatalogProductLocality",
"PublicCatalogProductPrice",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
PublicCatalogProductPropertiesElasticMetal,
PublicCatalogProductPropertiesHardware,
PublicCatalogProductPropertiesInstance,
PublicCatalogProductPropertiesObjectStorage,
PublicCatalogProductEnvironmentalImpactEstimation,
PublicCatalogProductLocality,
PublicCatalogProductPrice,
Expand Down Expand Up @@ -256,10 +257,14 @@ def unmarshal_PublicCatalogProductPropertiesBlockStorage(
field = data.get("min_volume_size", None)
if field is not None:
args["min_volume_size"] = field
else:
args["min_volume_size"] = None

field = data.get("max_volume_size", None)
if field is not None:
args["max_volume_size"] = field
else:
args["max_volume_size"] = None

return PublicCatalogProductPropertiesBlockStorage(**args)

Expand Down Expand Up @@ -366,6 +371,19 @@ def unmarshal_PublicCatalogProductPropertiesInstance(
return PublicCatalogProductPropertiesInstance(**args)


def unmarshal_PublicCatalogProductPropertiesObjectStorage(
data: Any,
) -> PublicCatalogProductPropertiesObjectStorage:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'PublicCatalogProductPropertiesObjectStorage' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

return PublicCatalogProductPropertiesObjectStorage(**args)


def unmarshal_PublicCatalogProductEnvironmentalImpactEstimation(
data: Any,
) -> PublicCatalogProductEnvironmentalImpactEstimation:
Expand Down Expand Up @@ -495,6 +513,14 @@ def unmarshal_PublicCatalogProductProperties(
else:
args["block_storage"] = None

field = data.get("object_storage", None)
if field is not None:
args["object_storage"] = unmarshal_PublicCatalogProductPropertiesObjectStorage(
field
)
else:
args["object_storage"] = None

return PublicCatalogProductProperties(**args)


Expand Down
16 changes: 12 additions & 4 deletions scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe
ELASTIC_METAL = "elastic_metal"
DEDIBOX = "dedibox"
BLOCK_STORAGE = "block_storage"
OBJECT_STORAGE = "object_storage"

def __str__(self) -> str:
return str(self.value)
Expand Down Expand Up @@ -230,14 +231,14 @@ class PublicCatalogProductPropertiesAppleSilicon:

@dataclass
class PublicCatalogProductPropertiesBlockStorage:
min_volume_size: int
min_volume_size: Optional[int]
"""
The minimum size of storage volume for this product in bytes.
The minimum size of storage volume for this product in bytes. Deprecated.
"""

max_volume_size: int
max_volume_size: Optional[int]
"""
The maximum size of storage volume for this product in bytes.
The maximum size of storage volume for this product in bytes. Deprecated.
"""


Expand Down Expand Up @@ -303,6 +304,11 @@ class PublicCatalogProductPropertiesInstance:
"""


@dataclass
class PublicCatalogProductPropertiesObjectStorage:
pass


@dataclass
class PublicCatalogProductEnvironmentalImpactEstimation:
kg_co2_equivalent: Optional[float]
Expand Down Expand Up @@ -346,6 +352,8 @@ class PublicCatalogProductProperties:

block_storage: Optional[PublicCatalogProductPropertiesBlockStorage]

object_storage: Optional[PublicCatalogProductPropertiesObjectStorage]


@dataclass
class PublicCatalogProductUnitOfMeasure:
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/product_catalog/v2alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .types import PublicCatalogProductPropertiesElasticMetal
from .types import PublicCatalogProductPropertiesHardware
from .types import PublicCatalogProductPropertiesInstance
from .types import PublicCatalogProductPropertiesObjectStorage
from .types import PublicCatalogProductEnvironmentalImpactEstimation
from .types import PublicCatalogProductLocality
from .types import PublicCatalogProductPrice
Expand Down Expand Up @@ -45,6 +46,7 @@
"PublicCatalogProductPropertiesElasticMetal",
"PublicCatalogProductPropertiesHardware",
"PublicCatalogProductPropertiesInstance",
"PublicCatalogProductPropertiesObjectStorage",
"PublicCatalogProductEnvironmentalImpactEstimation",
"PublicCatalogProductLocality",
"PublicCatalogProductPrice",
Expand Down
26 changes: 26 additions & 0 deletions scaleway/scaleway/product_catalog/v2alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
PublicCatalogProductPropertiesElasticMetal,
PublicCatalogProductPropertiesHardware,
PublicCatalogProductPropertiesInstance,
PublicCatalogProductPropertiesObjectStorage,
PublicCatalogProductEnvironmentalImpactEstimation,
PublicCatalogProductLocality,
PublicCatalogProductPrice,
Expand Down Expand Up @@ -256,10 +257,14 @@ def unmarshal_PublicCatalogProductPropertiesBlockStorage(
field = data.get("min_volume_size", None)
if field is not None:
args["min_volume_size"] = field
else:
args["min_volume_size"] = None

field = data.get("max_volume_size", None)
if field is not None:
args["max_volume_size"] = field
else:
args["max_volume_size"] = None

return PublicCatalogProductPropertiesBlockStorage(**args)

Expand Down Expand Up @@ -366,6 +371,19 @@ def unmarshal_PublicCatalogProductPropertiesInstance(
return PublicCatalogProductPropertiesInstance(**args)


def unmarshal_PublicCatalogProductPropertiesObjectStorage(
data: Any,
) -> PublicCatalogProductPropertiesObjectStorage:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'PublicCatalogProductPropertiesObjectStorage' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

return PublicCatalogProductPropertiesObjectStorage(**args)


def unmarshal_PublicCatalogProductEnvironmentalImpactEstimation(
data: Any,
) -> PublicCatalogProductEnvironmentalImpactEstimation:
Expand Down Expand Up @@ -495,6 +513,14 @@ def unmarshal_PublicCatalogProductProperties(
else:
args["block_storage"] = None

field = data.get("object_storage", None)
if field is not None:
args["object_storage"] = unmarshal_PublicCatalogProductPropertiesObjectStorage(
field
)
else:
args["object_storage"] = None

return PublicCatalogProductProperties(**args)


Expand Down
16 changes: 12 additions & 4 deletions scaleway/scaleway/product_catalog/v2alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe
ELASTIC_METAL = "elastic_metal"
DEDIBOX = "dedibox"
BLOCK_STORAGE = "block_storage"
OBJECT_STORAGE = "object_storage"

def __str__(self) -> str:
return str(self.value)
Expand Down Expand Up @@ -230,14 +231,14 @@ class PublicCatalogProductPropertiesAppleSilicon:

@dataclass
class PublicCatalogProductPropertiesBlockStorage:
min_volume_size: int
min_volume_size: Optional[int]
"""
The minimum size of storage volume for this product in bytes.
The minimum size of storage volume for this product in bytes. Deprecated.
"""

max_volume_size: int
max_volume_size: Optional[int]
"""
The maximum size of storage volume for this product in bytes.
The maximum size of storage volume for this product in bytes. Deprecated.
"""


Expand Down Expand Up @@ -303,6 +304,11 @@ class PublicCatalogProductPropertiesInstance:
"""


@dataclass
class PublicCatalogProductPropertiesObjectStorage:
pass


@dataclass
class PublicCatalogProductEnvironmentalImpactEstimation:
kg_co2_equivalent: Optional[float]
Expand Down Expand Up @@ -346,6 +352,8 @@ class PublicCatalogProductProperties:

block_storage: Optional[PublicCatalogProductPropertiesBlockStorage]

object_storage: Optional[PublicCatalogProductPropertiesObjectStorage]


@dataclass
class PublicCatalogProductUnitOfMeasure:
Expand Down
Loading