Skip to content

Commit 7a940c2

Browse files
authored
feat(product_catalog): object storage to estimation api (#1168)
1 parent 78ff4d2 commit 7a940c2

File tree

6 files changed

+80
-8
lines changed

6 files changed

+80
-8
lines changed

scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from .types import PublicCatalogProductPropertiesElasticMetal
1818
from .types import PublicCatalogProductPropertiesHardware
1919
from .types import PublicCatalogProductPropertiesInstance
20+
from .types import PublicCatalogProductPropertiesObjectStorage
2021
from .types import PublicCatalogProductEnvironmentalImpactEstimation
2122
from .types import PublicCatalogProductLocality
2223
from .types import PublicCatalogProductPrice
@@ -45,6 +46,7 @@
4546
"PublicCatalogProductPropertiesElasticMetal",
4647
"PublicCatalogProductPropertiesHardware",
4748
"PublicCatalogProductPropertiesInstance",
49+
"PublicCatalogProductPropertiesObjectStorage",
4850
"PublicCatalogProductEnvironmentalImpactEstimation",
4951
"PublicCatalogProductLocality",
5052
"PublicCatalogProductPrice",

scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
PublicCatalogProductPropertiesElasticMetal,
2222
PublicCatalogProductPropertiesHardware,
2323
PublicCatalogProductPropertiesInstance,
24+
PublicCatalogProductPropertiesObjectStorage,
2425
PublicCatalogProductEnvironmentalImpactEstimation,
2526
PublicCatalogProductLocality,
2627
PublicCatalogProductPrice,
@@ -256,10 +257,14 @@ def unmarshal_PublicCatalogProductPropertiesBlockStorage(
256257
field = data.get("min_volume_size", None)
257258
if field is not None:
258259
args["min_volume_size"] = field
260+
else:
261+
args["min_volume_size"] = None
259262

260263
field = data.get("max_volume_size", None)
261264
if field is not None:
262265
args["max_volume_size"] = field
266+
else:
267+
args["max_volume_size"] = None
263268

264269
return PublicCatalogProductPropertiesBlockStorage(**args)
265270

@@ -366,6 +371,19 @@ def unmarshal_PublicCatalogProductPropertiesInstance(
366371
return PublicCatalogProductPropertiesInstance(**args)
367372

368373

374+
def unmarshal_PublicCatalogProductPropertiesObjectStorage(
375+
data: Any,
376+
) -> PublicCatalogProductPropertiesObjectStorage:
377+
if not isinstance(data, dict):
378+
raise TypeError(
379+
"Unmarshalling the type 'PublicCatalogProductPropertiesObjectStorage' failed as data isn't a dictionary."
380+
)
381+
382+
args: Dict[str, Any] = {}
383+
384+
return PublicCatalogProductPropertiesObjectStorage(**args)
385+
386+
369387
def unmarshal_PublicCatalogProductEnvironmentalImpactEstimation(
370388
data: Any,
371389
) -> PublicCatalogProductEnvironmentalImpactEstimation:
@@ -495,6 +513,14 @@ def unmarshal_PublicCatalogProductProperties(
495513
else:
496514
args["block_storage"] = None
497515

516+
field = data.get("object_storage", None)
517+
if field is not None:
518+
args["object_storage"] = unmarshal_PublicCatalogProductPropertiesObjectStorage(
519+
field
520+
)
521+
else:
522+
args["object_storage"] = None
523+
498524
return PublicCatalogProductProperties(**args)
499525

500526

scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe
2424
ELASTIC_METAL = "elastic_metal"
2525
DEDIBOX = "dedibox"
2626
BLOCK_STORAGE = "block_storage"
27+
OBJECT_STORAGE = "object_storage"
2728

2829
def __str__(self) -> str:
2930
return str(self.value)
@@ -230,14 +231,14 @@ class PublicCatalogProductPropertiesAppleSilicon:
230231

231232
@dataclass
232233
class PublicCatalogProductPropertiesBlockStorage:
233-
min_volume_size: int
234+
min_volume_size: Optional[int]
234235
"""
235-
The minimum size of storage volume for this product in bytes.
236+
The minimum size of storage volume for this product in bytes. Deprecated.
236237
"""
237238

238-
max_volume_size: int
239+
max_volume_size: Optional[int]
239240
"""
240-
The maximum size of storage volume for this product in bytes.
241+
The maximum size of storage volume for this product in bytes. Deprecated.
241242
"""
242243

243244

@@ -303,6 +304,11 @@ class PublicCatalogProductPropertiesInstance:
303304
"""
304305

305306

307+
@dataclass
308+
class PublicCatalogProductPropertiesObjectStorage:
309+
pass
310+
311+
306312
@dataclass
307313
class PublicCatalogProductEnvironmentalImpactEstimation:
308314
kg_co2_equivalent: Optional[float]
@@ -346,6 +352,8 @@ class PublicCatalogProductProperties:
346352

347353
block_storage: Optional[PublicCatalogProductPropertiesBlockStorage]
348354

355+
object_storage: Optional[PublicCatalogProductPropertiesObjectStorage]
356+
349357

350358
@dataclass
351359
class PublicCatalogProductUnitOfMeasure:

scaleway/scaleway/product_catalog/v2alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from .types import PublicCatalogProductPropertiesElasticMetal
1818
from .types import PublicCatalogProductPropertiesHardware
1919
from .types import PublicCatalogProductPropertiesInstance
20+
from .types import PublicCatalogProductPropertiesObjectStorage
2021
from .types import PublicCatalogProductEnvironmentalImpactEstimation
2122
from .types import PublicCatalogProductLocality
2223
from .types import PublicCatalogProductPrice
@@ -45,6 +46,7 @@
4546
"PublicCatalogProductPropertiesElasticMetal",
4647
"PublicCatalogProductPropertiesHardware",
4748
"PublicCatalogProductPropertiesInstance",
49+
"PublicCatalogProductPropertiesObjectStorage",
4850
"PublicCatalogProductEnvironmentalImpactEstimation",
4951
"PublicCatalogProductLocality",
5052
"PublicCatalogProductPrice",

scaleway/scaleway/product_catalog/v2alpha1/marshalling.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
PublicCatalogProductPropertiesElasticMetal,
2222
PublicCatalogProductPropertiesHardware,
2323
PublicCatalogProductPropertiesInstance,
24+
PublicCatalogProductPropertiesObjectStorage,
2425
PublicCatalogProductEnvironmentalImpactEstimation,
2526
PublicCatalogProductLocality,
2627
PublicCatalogProductPrice,
@@ -256,10 +257,14 @@ def unmarshal_PublicCatalogProductPropertiesBlockStorage(
256257
field = data.get("min_volume_size", None)
257258
if field is not None:
258259
args["min_volume_size"] = field
260+
else:
261+
args["min_volume_size"] = None
259262

260263
field = data.get("max_volume_size", None)
261264
if field is not None:
262265
args["max_volume_size"] = field
266+
else:
267+
args["max_volume_size"] = None
263268

264269
return PublicCatalogProductPropertiesBlockStorage(**args)
265270

@@ -366,6 +371,19 @@ def unmarshal_PublicCatalogProductPropertiesInstance(
366371
return PublicCatalogProductPropertiesInstance(**args)
367372

368373

374+
def unmarshal_PublicCatalogProductPropertiesObjectStorage(
375+
data: Any,
376+
) -> PublicCatalogProductPropertiesObjectStorage:
377+
if not isinstance(data, dict):
378+
raise TypeError(
379+
"Unmarshalling the type 'PublicCatalogProductPropertiesObjectStorage' failed as data isn't a dictionary."
380+
)
381+
382+
args: Dict[str, Any] = {}
383+
384+
return PublicCatalogProductPropertiesObjectStorage(**args)
385+
386+
369387
def unmarshal_PublicCatalogProductEnvironmentalImpactEstimation(
370388
data: Any,
371389
) -> PublicCatalogProductEnvironmentalImpactEstimation:
@@ -495,6 +513,14 @@ def unmarshal_PublicCatalogProductProperties(
495513
else:
496514
args["block_storage"] = None
497515

516+
field = data.get("object_storage", None)
517+
if field is not None:
518+
args["object_storage"] = unmarshal_PublicCatalogProductPropertiesObjectStorage(
519+
field
520+
)
521+
else:
522+
args["object_storage"] = None
523+
498524
return PublicCatalogProductProperties(**args)
499525

500526

scaleway/scaleway/product_catalog/v2alpha1/types.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe
2424
ELASTIC_METAL = "elastic_metal"
2525
DEDIBOX = "dedibox"
2626
BLOCK_STORAGE = "block_storage"
27+
OBJECT_STORAGE = "object_storage"
2728

2829
def __str__(self) -> str:
2930
return str(self.value)
@@ -230,14 +231,14 @@ class PublicCatalogProductPropertiesAppleSilicon:
230231

231232
@dataclass
232233
class PublicCatalogProductPropertiesBlockStorage:
233-
min_volume_size: int
234+
min_volume_size: Optional[int]
234235
"""
235-
The minimum size of storage volume for this product in bytes.
236+
The minimum size of storage volume for this product in bytes. Deprecated.
236237
"""
237238

238-
max_volume_size: int
239+
max_volume_size: Optional[int]
239240
"""
240-
The maximum size of storage volume for this product in bytes.
241+
The maximum size of storage volume for this product in bytes. Deprecated.
241242
"""
242243

243244

@@ -303,6 +304,11 @@ class PublicCatalogProductPropertiesInstance:
303304
"""
304305

305306

307+
@dataclass
308+
class PublicCatalogProductPropertiesObjectStorage:
309+
pass
310+
311+
306312
@dataclass
307313
class PublicCatalogProductEnvironmentalImpactEstimation:
308314
kg_co2_equivalent: Optional[float]
@@ -346,6 +352,8 @@ class PublicCatalogProductProperties:
346352

347353
block_storage: Optional[PublicCatalogProductPropertiesBlockStorage]
348354

355+
object_storage: Optional[PublicCatalogProductPropertiesObjectStorage]
356+
349357

350358
@dataclass
351359
class PublicCatalogProductUnitOfMeasure:

0 commit comments

Comments
 (0)