Skip to content

feat(product_catalog): add block storage properties to admin and public api #1056

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 @@ -12,6 +12,7 @@
from .types import PublicCatalogProductPropertiesHardwareRAM
from .types import PublicCatalogProductPropertiesHardwareStorage
from .types import PublicCatalogProductPropertiesAppleSilicon
from .types import PublicCatalogProductPropertiesBlockStorage
from .types import PublicCatalogProductPropertiesDedibox
from .types import PublicCatalogProductPropertiesElasticMetal
from .types import PublicCatalogProductPropertiesHardware
Expand Down Expand Up @@ -39,6 +40,7 @@
"PublicCatalogProductPropertiesHardwareRAM",
"PublicCatalogProductPropertiesHardwareStorage",
"PublicCatalogProductPropertiesAppleSilicon",
"PublicCatalogProductPropertiesBlockStorage",
"PublicCatalogProductPropertiesDedibox",
"PublicCatalogProductPropertiesElasticMetal",
"PublicCatalogProductPropertiesHardware",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
PublicCatalogProductPropertiesHardwareRAM,
PublicCatalogProductPropertiesHardwareStorage,
PublicCatalogProductPropertiesAppleSilicon,
PublicCatalogProductPropertiesBlockStorage,
PublicCatalogProductPropertiesDedibox,
PublicCatalogProductPropertiesElasticMetal,
PublicCatalogProductPropertiesHardware,
Expand Down Expand Up @@ -242,6 +243,27 @@ def unmarshal_PublicCatalogProductPropertiesAppleSilicon(
return PublicCatalogProductPropertiesAppleSilicon(**args)


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

args: Dict[str, Any] = {}

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

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

return PublicCatalogProductPropertiesBlockStorage(**args)


def unmarshal_PublicCatalogProductPropertiesDedibox(
data: Any,
) -> PublicCatalogProductPropertiesDedibox:
Expand Down Expand Up @@ -465,6 +487,14 @@ def unmarshal_PublicCatalogProductProperties(
else:
args["instance"] = None

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

return PublicCatalogProductProperties(**args)


Expand Down
15 changes: 15 additions & 0 deletions scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,19 @@ class PublicCatalogProductPropertiesAppleSilicon:
"""


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

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


@dataclass
class PublicCatalogProductPropertiesDedibox:
range: str
Expand Down Expand Up @@ -330,6 +343,8 @@ class PublicCatalogProductProperties:

instance: Optional[PublicCatalogProductPropertiesInstance]

block_storage: Optional[PublicCatalogProductPropertiesBlockStorage]


@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 @@ -12,6 +12,7 @@
from .types import PublicCatalogProductPropertiesHardwareRAM
from .types import PublicCatalogProductPropertiesHardwareStorage
from .types import PublicCatalogProductPropertiesAppleSilicon
from .types import PublicCatalogProductPropertiesBlockStorage
from .types import PublicCatalogProductPropertiesDedibox
from .types import PublicCatalogProductPropertiesElasticMetal
from .types import PublicCatalogProductPropertiesHardware
Expand Down Expand Up @@ -39,6 +40,7 @@
"PublicCatalogProductPropertiesHardwareRAM",
"PublicCatalogProductPropertiesHardwareStorage",
"PublicCatalogProductPropertiesAppleSilicon",
"PublicCatalogProductPropertiesBlockStorage",
"PublicCatalogProductPropertiesDedibox",
"PublicCatalogProductPropertiesElasticMetal",
"PublicCatalogProductPropertiesHardware",
Expand Down
30 changes: 30 additions & 0 deletions scaleway/scaleway/product_catalog/v2alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
PublicCatalogProductPropertiesHardwareRAM,
PublicCatalogProductPropertiesHardwareStorage,
PublicCatalogProductPropertiesAppleSilicon,
PublicCatalogProductPropertiesBlockStorage,
PublicCatalogProductPropertiesDedibox,
PublicCatalogProductPropertiesElasticMetal,
PublicCatalogProductPropertiesHardware,
Expand Down Expand Up @@ -242,6 +243,27 @@ def unmarshal_PublicCatalogProductPropertiesAppleSilicon(
return PublicCatalogProductPropertiesAppleSilicon(**args)


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

args: Dict[str, Any] = {}

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

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

return PublicCatalogProductPropertiesBlockStorage(**args)


def unmarshal_PublicCatalogProductPropertiesDedibox(
data: Any,
) -> PublicCatalogProductPropertiesDedibox:
Expand Down Expand Up @@ -465,6 +487,14 @@ def unmarshal_PublicCatalogProductProperties(
else:
args["instance"] = None

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

return PublicCatalogProductProperties(**args)


Expand Down
15 changes: 15 additions & 0 deletions scaleway/scaleway/product_catalog/v2alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,19 @@ class PublicCatalogProductPropertiesAppleSilicon:
"""


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

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


@dataclass
class PublicCatalogProductPropertiesDedibox:
range: str
Expand Down Expand Up @@ -330,6 +343,8 @@ class PublicCatalogProductProperties:

instance: Optional[PublicCatalogProductPropertiesInstance]

block_storage: Optional[PublicCatalogProductPropertiesBlockStorage]


@dataclass
class PublicCatalogProductUnitOfMeasure:
Expand Down
Loading