Skip to content

Commit c63793b

Browse files
feat(product_catalog): add new instance properties + status (#980)
Co-authored-by: Laure-di <62625835+Laure-di@users.noreply.github.com>
1 parent 80956fc commit c63793b

File tree

6 files changed

+112
-0
lines changed

6 files changed

+112
-0
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
@@ -1,6 +1,7 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import PublicCatalogProductPropertiesHardwareCPUArch
4+
from .types import PublicCatalogProductStatus
45
from .types import PublicCatalogProductUnitOfMeasureCountableUnit
56
from .types import PublicCatalogProductPropertiesHardwareCPUPhysical
67
from .types import PublicCatalogProductPropertiesHardwareCPUVirtual
@@ -26,6 +27,7 @@
2627

2728
__all__ = [
2829
"PublicCatalogProductPropertiesHardwareCPUArch",
30+
"PublicCatalogProductStatus",
2931
"PublicCatalogProductUnitOfMeasureCountableUnit",
3032
"PublicCatalogProductPropertiesHardwareCPUPhysical",
3133
"PublicCatalogProductPropertiesHardwareCPUVirtual",

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# If you have any remark or suggestion do not hesitate to open an issue.
33

44
from typing import Any, Dict
5+
from dateutil import parser
56

67
from scaleway_core.bridge import (
78
unmarshal_Money,
@@ -332,6 +333,14 @@ def unmarshal_PublicCatalogProductPropertiesInstance(
332333
if field is not None:
333334
args["range"] = field
334335

336+
field = data.get("offer_id", None)
337+
if field is not None:
338+
args["offer_id"] = field
339+
340+
field = data.get("recommended_replacement_offer_ids", None)
341+
if field is not None:
342+
args["recommended_replacement_offer_ids"] = field
343+
335344
return PublicCatalogProductPropertiesInstance(**args)
336345

337346

@@ -508,6 +517,10 @@ def unmarshal_PublicCatalogProduct(data: Any) -> PublicCatalogProduct:
508517
if field is not None:
509518
args["description"] = field
510519

520+
field = data.get("status", None)
521+
if field is not None:
522+
args["status"] = field
523+
511524
field = data.get("locality", None)
512525
if field is not None:
513526
args["locality"] = unmarshal_PublicCatalogProductLocality(field)
@@ -540,6 +553,14 @@ def unmarshal_PublicCatalogProduct(data: Any) -> PublicCatalogProduct:
540553
else:
541554
args["unit_of_measure"] = None
542555

556+
field = data.get("end_of_life_at", None)
557+
if field is not None:
558+
args["end_of_life_at"] = (
559+
parser.isoparse(field) if isinstance(field, str) else field
560+
)
561+
else:
562+
args["end_of_life_at"] = None
563+
543564
return PublicCatalogProduct(**args)
544565

545566

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from dataclasses import dataclass
6+
from datetime import datetime
67
from enum import Enum
78
from typing import List, Optional
89

@@ -27,6 +28,18 @@ def __str__(self) -> str:
2728
return str(self.value)
2829

2930

31+
class PublicCatalogProductStatus(str, Enum, metaclass=StrEnumMeta):
32+
UNKNOWN_STATUS = "unknown_status"
33+
PUBLIC_BETA = "public_beta"
34+
PREVIEW = "preview"
35+
GENERAL_AVAILABILITY = "general_availability"
36+
END_OF_DEPLOYMENT = "end_of_deployment"
37+
END_OF_SUPPORT = "end_of_support"
38+
39+
def __str__(self) -> str:
40+
return str(self.value)
41+
42+
3043
class PublicCatalogProductUnitOfMeasureCountableUnit(str, Enum, metaclass=StrEnumMeta):
3144
UNKNOWN_COUNTABLE_UNIT = "unknown_countable_unit"
3245
CHUNK = "chunk"
@@ -253,6 +266,16 @@ class PublicCatalogProductPropertiesInstance:
253266
The range of the Instance server.
254267
"""
255268

269+
offer_id: str
270+
"""
271+
The offer ID of the Instance server.
272+
"""
273+
274+
recommended_replacement_offer_ids: List[str]
275+
"""
276+
The recommended replacement offer IDs of the Instance server.
277+
"""
278+
256279

257280
@dataclass
258281
class PublicCatalogProductEnvironmentalImpactEstimation:
@@ -330,6 +353,11 @@ class PublicCatalogProduct:
330353
The product description.
331354
"""
332355

356+
status: PublicCatalogProductStatus
357+
"""
358+
The status of the product.
359+
"""
360+
333361
locality: Optional[PublicCatalogProductLocality]
334362
"""
335363
The locality of the product.
@@ -357,6 +385,11 @@ class PublicCatalogProduct:
357385
The unit of measure of the product.
358386
"""
359387

388+
end_of_life_at: Optional[datetime]
389+
"""
390+
The end of life date of the product.
391+
"""
392+
360393

361394
@dataclass
362395
class ListPublicCatalogProductsResponse:

scaleway/scaleway/product_catalog/v2alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import PublicCatalogProductPropertiesHardwareCPUArch
4+
from .types import PublicCatalogProductStatus
45
from .types import PublicCatalogProductUnitOfMeasureCountableUnit
56
from .types import PublicCatalogProductPropertiesHardwareCPUPhysical
67
from .types import PublicCatalogProductPropertiesHardwareCPUVirtual
@@ -26,6 +27,7 @@
2627

2728
__all__ = [
2829
"PublicCatalogProductPropertiesHardwareCPUArch",
30+
"PublicCatalogProductStatus",
2931
"PublicCatalogProductUnitOfMeasureCountableUnit",
3032
"PublicCatalogProductPropertiesHardwareCPUPhysical",
3133
"PublicCatalogProductPropertiesHardwareCPUVirtual",

scaleway/scaleway/product_catalog/v2alpha1/marshalling.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# If you have any remark or suggestion do not hesitate to open an issue.
33

44
from typing import Any, Dict
5+
from dateutil import parser
56

67
from scaleway_core.bridge import (
78
unmarshal_Money,
@@ -332,6 +333,14 @@ def unmarshal_PublicCatalogProductPropertiesInstance(
332333
if field is not None:
333334
args["range"] = field
334335

336+
field = data.get("offer_id", None)
337+
if field is not None:
338+
args["offer_id"] = field
339+
340+
field = data.get("recommended_replacement_offer_ids", None)
341+
if field is not None:
342+
args["recommended_replacement_offer_ids"] = field
343+
335344
return PublicCatalogProductPropertiesInstance(**args)
336345

337346

@@ -508,6 +517,10 @@ def unmarshal_PublicCatalogProduct(data: Any) -> PublicCatalogProduct:
508517
if field is not None:
509518
args["description"] = field
510519

520+
field = data.get("status", None)
521+
if field is not None:
522+
args["status"] = field
523+
511524
field = data.get("locality", None)
512525
if field is not None:
513526
args["locality"] = unmarshal_PublicCatalogProductLocality(field)
@@ -540,6 +553,14 @@ def unmarshal_PublicCatalogProduct(data: Any) -> PublicCatalogProduct:
540553
else:
541554
args["unit_of_measure"] = None
542555

556+
field = data.get("end_of_life_at", None)
557+
if field is not None:
558+
args["end_of_life_at"] = (
559+
parser.isoparse(field) if isinstance(field, str) else field
560+
)
561+
else:
562+
args["end_of_life_at"] = None
563+
543564
return PublicCatalogProduct(**args)
544565

545566

scaleway/scaleway/product_catalog/v2alpha1/types.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from dataclasses import dataclass
6+
from datetime import datetime
67
from enum import Enum
78
from typing import List, Optional
89

@@ -27,6 +28,18 @@ def __str__(self) -> str:
2728
return str(self.value)
2829

2930

31+
class PublicCatalogProductStatus(str, Enum, metaclass=StrEnumMeta):
32+
UNKNOWN_STATUS = "unknown_status"
33+
PUBLIC_BETA = "public_beta"
34+
PREVIEW = "preview"
35+
GENERAL_AVAILABILITY = "general_availability"
36+
END_OF_DEPLOYMENT = "end_of_deployment"
37+
END_OF_SUPPORT = "end_of_support"
38+
39+
def __str__(self) -> str:
40+
return str(self.value)
41+
42+
3043
class PublicCatalogProductUnitOfMeasureCountableUnit(str, Enum, metaclass=StrEnumMeta):
3144
UNKNOWN_COUNTABLE_UNIT = "unknown_countable_unit"
3245
CHUNK = "chunk"
@@ -253,6 +266,16 @@ class PublicCatalogProductPropertiesInstance:
253266
The range of the Instance server.
254267
"""
255268

269+
offer_id: str
270+
"""
271+
The offer ID of the Instance server.
272+
"""
273+
274+
recommended_replacement_offer_ids: List[str]
275+
"""
276+
The recommended replacement offer IDs of the Instance server.
277+
"""
278+
256279

257280
@dataclass
258281
class PublicCatalogProductEnvironmentalImpactEstimation:
@@ -330,6 +353,11 @@ class PublicCatalogProduct:
330353
The product description.
331354
"""
332355

356+
status: PublicCatalogProductStatus
357+
"""
358+
The status of the product.
359+
"""
360+
333361
locality: Optional[PublicCatalogProductLocality]
334362
"""
335363
The locality of the product.
@@ -357,6 +385,11 @@ class PublicCatalogProduct:
357385
The unit of measure of the product.
358386
"""
359387

388+
end_of_life_at: Optional[datetime]
389+
"""
390+
The end of life date of the product.
391+
"""
392+
360393

361394
@dataclass
362395
class ListPublicCatalogProductsResponse:

0 commit comments

Comments
 (0)