Skip to content

Commit 20e59fd

Browse files
feat(product_catalog): add Kubernetes products to public and admin catalog APIs (scaleway#1496)
Co-authored-by: esoulard <esoulard@scaleway.com>
1 parent 3fa9ab9 commit 20e59fd

File tree

6 files changed

+258
-0
lines changed

6 files changed

+258
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
from .types import PublicCatalogProductPropertiesHardwareNetwork
2020
from .types import PublicCatalogProductPropertiesHardwareRAM
2121
from .types import PublicCatalogProductPropertiesHardwareStorage
22+
from .types import PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType
23+
from .types import PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType
24+
from .types import PublicCatalogProductPropertiesKubernetesKosmosNodeType
2225
from .types import PublicCatalogProductPropertiesObjectStorageClassType
2326
from .types import PublicCatalogProductPropertiesObjectStorageInternetTrafficType
2427
from .types import PublicCatalogProductPropertiesObjectStorageRegionTrafficType
@@ -31,6 +34,7 @@
3134
from .types import PublicCatalogProductPropertiesHardware
3235
from .types import PublicCatalogProductPropertiesInstance
3336
from .types import PublicCatalogProductPropertiesKeyManager
37+
from .types import PublicCatalogProductPropertiesKubernetes
3438
from .types import PublicCatalogProductPropertiesLoadBalancer
3539
from .types import PublicCatalogProductPropertiesManagedInference
3640
from .types import PublicCatalogProductPropertiesManagedRedisDatabase
@@ -64,6 +68,9 @@
6468
"PublicCatalogProductPropertiesHardwareNetwork",
6569
"PublicCatalogProductPropertiesHardwareRAM",
6670
"PublicCatalogProductPropertiesHardwareStorage",
71+
"PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType",
72+
"PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType",
73+
"PublicCatalogProductPropertiesKubernetesKosmosNodeType",
6774
"PublicCatalogProductPropertiesObjectStorageClassType",
6875
"PublicCatalogProductPropertiesObjectStorageInternetTrafficType",
6976
"PublicCatalogProductPropertiesObjectStorageRegionTrafficType",
@@ -76,6 +83,7 @@
7683
"PublicCatalogProductPropertiesHardware",
7784
"PublicCatalogProductPropertiesInstance",
7885
"PublicCatalogProductPropertiesKeyManager",
86+
"PublicCatalogProductPropertiesKubernetes",
7987
"PublicCatalogProductPropertiesLoadBalancer",
8088
"PublicCatalogProductPropertiesManagedInference",
8189
"PublicCatalogProductPropertiesManagedRedisDatabase",

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

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
PublicCatalogProductPropertiesHardwareNetwork,
2222
PublicCatalogProductPropertiesHardwareRAM,
2323
PublicCatalogProductPropertiesHardwareStorage,
24+
PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType,
25+
PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType,
26+
PublicCatalogProductPropertiesKubernetesKosmosNodeType,
2427
PublicCatalogProductPropertiesObjectStorageClassType,
2528
PublicCatalogProductPropertiesObjectStorageInternetTrafficType,
2629
PublicCatalogProductPropertiesObjectStorageRegionTrafficType,
@@ -33,6 +36,7 @@
3336
PublicCatalogProductPropertiesHardware,
3437
PublicCatalogProductPropertiesInstance,
3538
PublicCatalogProductPropertiesKeyManager,
39+
PublicCatalogProductPropertiesKubernetes,
3640
PublicCatalogProductPropertiesLoadBalancer,
3741
PublicCatalogProductPropertiesManagedInference,
3842
PublicCatalogProductPropertiesManagedRedisDatabase,
@@ -287,6 +291,45 @@ def unmarshal_PublicCatalogProductPropertiesHardwareStorage(
287291
return PublicCatalogProductPropertiesHardwareStorage(**args)
288292

289293

294+
def unmarshal_PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType(
295+
data: Any,
296+
) -> PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType:
297+
if not isinstance(data, dict):
298+
raise TypeError(
299+
"Unmarshalling the type 'PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType' failed as data isn't a dictionary."
300+
)
301+
302+
args: dict[str, Any] = {}
303+
304+
return PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType(**args)
305+
306+
307+
def unmarshal_PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType(
308+
data: Any,
309+
) -> PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType:
310+
if not isinstance(data, dict):
311+
raise TypeError(
312+
"Unmarshalling the type 'PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType' failed as data isn't a dictionary."
313+
)
314+
315+
args: dict[str, Any] = {}
316+
317+
return PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType(**args)
318+
319+
320+
def unmarshal_PublicCatalogProductPropertiesKubernetesKosmosNodeType(
321+
data: Any,
322+
) -> PublicCatalogProductPropertiesKubernetesKosmosNodeType:
323+
if not isinstance(data, dict):
324+
raise TypeError(
325+
"Unmarshalling the type 'PublicCatalogProductPropertiesKubernetesKosmosNodeType' failed as data isn't a dictionary."
326+
)
327+
328+
args: dict[str, Any] = {}
329+
330+
return PublicCatalogProductPropertiesKubernetesKosmosNodeType(**args)
331+
332+
290333
def unmarshal_PublicCatalogProductPropertiesObjectStorageClassType(
291334
data: Any,
292335
) -> PublicCatalogProductPropertiesObjectStorageClassType:
@@ -587,6 +630,47 @@ def unmarshal_PublicCatalogProductPropertiesKeyManager(
587630
return PublicCatalogProductPropertiesKeyManager(**args)
588631

589632

633+
def unmarshal_PublicCatalogProductPropertiesKubernetes(
634+
data: Any,
635+
) -> PublicCatalogProductPropertiesKubernetes:
636+
if not isinstance(data, dict):
637+
raise TypeError(
638+
"Unmarshalling the type 'PublicCatalogProductPropertiesKubernetes' failed as data isn't a dictionary."
639+
)
640+
641+
args: dict[str, Any] = {}
642+
643+
field = data.get("kapsule_control_plane", None)
644+
if field is not None:
645+
args["kapsule_control_plane"] = (
646+
unmarshal_PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType(
647+
field
648+
)
649+
)
650+
else:
651+
args["kapsule_control_plane"] = None
652+
653+
field = data.get("kosmos_control_plane", None)
654+
if field is not None:
655+
args["kosmos_control_plane"] = (
656+
unmarshal_PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType(
657+
field
658+
)
659+
)
660+
else:
661+
args["kosmos_control_plane"] = None
662+
663+
field = data.get("kosmos_node", None)
664+
if field is not None:
665+
args["kosmos_node"] = (
666+
unmarshal_PublicCatalogProductPropertiesKubernetesKosmosNodeType(field)
667+
)
668+
else:
669+
args["kosmos_node"] = None
670+
671+
return PublicCatalogProductPropertiesKubernetes(**args)
672+
673+
590674
def unmarshal_PublicCatalogProductPropertiesLoadBalancer(
591675
data: Any,
592676
) -> PublicCatalogProductPropertiesLoadBalancer:
@@ -877,6 +961,12 @@ def unmarshal_PublicCatalogProductProperties(
877961
else:
878962
args["key_manager"] = None
879963

964+
field = data.get("kubernetes", None)
965+
if field is not None:
966+
args["kubernetes"] = unmarshal_PublicCatalogProductPropertiesKubernetes(field)
967+
else:
968+
args["kubernetes"] = None
969+
880970
return PublicCatalogProductProperties(**args)
881971

882972

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe
3131
SECRET_MANAGER = "secret_manager"
3232
KEY_MANAGER = "key_manager"
3333
MANAGED_REDIS_DATABASE = "managed_redis_database"
34+
KUBERNETES = "kubernetes"
3435

3536
def __str__(self) -> str:
3637
return str(self.value)
@@ -307,6 +308,21 @@ class PublicCatalogProductPropertiesHardwareStorage:
307308
"""
308309

309310

311+
@dataclass
312+
class PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType:
313+
pass
314+
315+
316+
@dataclass
317+
class PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType:
318+
pass
319+
320+
321+
@dataclass
322+
class PublicCatalogProductPropertiesKubernetesKosmosNodeType:
323+
pass
324+
325+
310326
@dataclass
311327
class PublicCatalogProductPropertiesObjectStorageClassType:
312328
storage_class: PublicCatalogProductPropertiesObjectStorageClassTypeStorageClass
@@ -451,6 +467,19 @@ class PublicCatalogProductPropertiesKeyManager:
451467
pass
452468

453469

470+
@dataclass
471+
class PublicCatalogProductPropertiesKubernetes:
472+
kapsule_control_plane: Optional[
473+
PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType
474+
] = None
475+
476+
kosmos_control_plane: Optional[
477+
PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType
478+
] = None
479+
480+
kosmos_node: Optional[PublicCatalogProductPropertiesKubernetesKosmosNodeType] = None
481+
482+
454483
@dataclass
455484
class PublicCatalogProductPropertiesLoadBalancer:
456485
pass
@@ -547,6 +576,8 @@ class PublicCatalogProductProperties:
547576

548577
key_manager: Optional[PublicCatalogProductPropertiesKeyManager] = None
549578

579+
kubernetes: Optional[PublicCatalogProductPropertiesKubernetes] = None
580+
550581

551582
@dataclass
552583
class PublicCatalogProductUnitOfMeasure:

scaleway/scaleway/product_catalog/v2alpha1/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
from .types import PublicCatalogProductPropertiesHardwareNetwork
2020
from .types import PublicCatalogProductPropertiesHardwareRAM
2121
from .types import PublicCatalogProductPropertiesHardwareStorage
22+
from .types import PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType
23+
from .types import PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType
24+
from .types import PublicCatalogProductPropertiesKubernetesKosmosNodeType
2225
from .types import PublicCatalogProductPropertiesObjectStorageClassType
2326
from .types import PublicCatalogProductPropertiesObjectStorageInternetTrafficType
2427
from .types import PublicCatalogProductPropertiesObjectStorageRegionTrafficType
@@ -31,6 +34,7 @@
3134
from .types import PublicCatalogProductPropertiesHardware
3235
from .types import PublicCatalogProductPropertiesInstance
3336
from .types import PublicCatalogProductPropertiesKeyManager
37+
from .types import PublicCatalogProductPropertiesKubernetes
3438
from .types import PublicCatalogProductPropertiesLoadBalancer
3539
from .types import PublicCatalogProductPropertiesManagedInference
3640
from .types import PublicCatalogProductPropertiesManagedRedisDatabase
@@ -64,6 +68,9 @@
6468
"PublicCatalogProductPropertiesHardwareNetwork",
6569
"PublicCatalogProductPropertiesHardwareRAM",
6670
"PublicCatalogProductPropertiesHardwareStorage",
71+
"PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType",
72+
"PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType",
73+
"PublicCatalogProductPropertiesKubernetesKosmosNodeType",
6774
"PublicCatalogProductPropertiesObjectStorageClassType",
6875
"PublicCatalogProductPropertiesObjectStorageInternetTrafficType",
6976
"PublicCatalogProductPropertiesObjectStorageRegionTrafficType",
@@ -76,6 +83,7 @@
7683
"PublicCatalogProductPropertiesHardware",
7784
"PublicCatalogProductPropertiesInstance",
7885
"PublicCatalogProductPropertiesKeyManager",
86+
"PublicCatalogProductPropertiesKubernetes",
7987
"PublicCatalogProductPropertiesLoadBalancer",
8088
"PublicCatalogProductPropertiesManagedInference",
8189
"PublicCatalogProductPropertiesManagedRedisDatabase",

scaleway/scaleway/product_catalog/v2alpha1/marshalling.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
PublicCatalogProductPropertiesHardwareNetwork,
2222
PublicCatalogProductPropertiesHardwareRAM,
2323
PublicCatalogProductPropertiesHardwareStorage,
24+
PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType,
25+
PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType,
26+
PublicCatalogProductPropertiesKubernetesKosmosNodeType,
2427
PublicCatalogProductPropertiesObjectStorageClassType,
2528
PublicCatalogProductPropertiesObjectStorageInternetTrafficType,
2629
PublicCatalogProductPropertiesObjectStorageRegionTrafficType,
@@ -33,6 +36,7 @@
3336
PublicCatalogProductPropertiesHardware,
3437
PublicCatalogProductPropertiesInstance,
3538
PublicCatalogProductPropertiesKeyManager,
39+
PublicCatalogProductPropertiesKubernetes,
3640
PublicCatalogProductPropertiesLoadBalancer,
3741
PublicCatalogProductPropertiesManagedInference,
3842
PublicCatalogProductPropertiesManagedRedisDatabase,
@@ -287,6 +291,45 @@ def unmarshal_PublicCatalogProductPropertiesHardwareStorage(
287291
return PublicCatalogProductPropertiesHardwareStorage(**args)
288292

289293

294+
def unmarshal_PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType(
295+
data: Any,
296+
) -> PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType:
297+
if not isinstance(data, dict):
298+
raise TypeError(
299+
"Unmarshalling the type 'PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType' failed as data isn't a dictionary."
300+
)
301+
302+
args: dict[str, Any] = {}
303+
304+
return PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType(**args)
305+
306+
307+
def unmarshal_PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType(
308+
data: Any,
309+
) -> PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType:
310+
if not isinstance(data, dict):
311+
raise TypeError(
312+
"Unmarshalling the type 'PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType' failed as data isn't a dictionary."
313+
)
314+
315+
args: dict[str, Any] = {}
316+
317+
return PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType(**args)
318+
319+
320+
def unmarshal_PublicCatalogProductPropertiesKubernetesKosmosNodeType(
321+
data: Any,
322+
) -> PublicCatalogProductPropertiesKubernetesKosmosNodeType:
323+
if not isinstance(data, dict):
324+
raise TypeError(
325+
"Unmarshalling the type 'PublicCatalogProductPropertiesKubernetesKosmosNodeType' failed as data isn't a dictionary."
326+
)
327+
328+
args: dict[str, Any] = {}
329+
330+
return PublicCatalogProductPropertiesKubernetesKosmosNodeType(**args)
331+
332+
290333
def unmarshal_PublicCatalogProductPropertiesObjectStorageClassType(
291334
data: Any,
292335
) -> PublicCatalogProductPropertiesObjectStorageClassType:
@@ -587,6 +630,47 @@ def unmarshal_PublicCatalogProductPropertiesKeyManager(
587630
return PublicCatalogProductPropertiesKeyManager(**args)
588631

589632

633+
def unmarshal_PublicCatalogProductPropertiesKubernetes(
634+
data: Any,
635+
) -> PublicCatalogProductPropertiesKubernetes:
636+
if not isinstance(data, dict):
637+
raise TypeError(
638+
"Unmarshalling the type 'PublicCatalogProductPropertiesKubernetes' failed as data isn't a dictionary."
639+
)
640+
641+
args: dict[str, Any] = {}
642+
643+
field = data.get("kapsule_control_plane", None)
644+
if field is not None:
645+
args["kapsule_control_plane"] = (
646+
unmarshal_PublicCatalogProductPropertiesKubernetesKapsuleControlPlaneType(
647+
field
648+
)
649+
)
650+
else:
651+
args["kapsule_control_plane"] = None
652+
653+
field = data.get("kosmos_control_plane", None)
654+
if field is not None:
655+
args["kosmos_control_plane"] = (
656+
unmarshal_PublicCatalogProductPropertiesKubernetesKosmosControlPlaneType(
657+
field
658+
)
659+
)
660+
else:
661+
args["kosmos_control_plane"] = None
662+
663+
field = data.get("kosmos_node", None)
664+
if field is not None:
665+
args["kosmos_node"] = (
666+
unmarshal_PublicCatalogProductPropertiesKubernetesKosmosNodeType(field)
667+
)
668+
else:
669+
args["kosmos_node"] = None
670+
671+
return PublicCatalogProductPropertiesKubernetes(**args)
672+
673+
590674
def unmarshal_PublicCatalogProductPropertiesLoadBalancer(
591675
data: Any,
592676
) -> PublicCatalogProductPropertiesLoadBalancer:
@@ -877,6 +961,12 @@ def unmarshal_PublicCatalogProductProperties(
877961
else:
878962
args["key_manager"] = None
879963

964+
field = data.get("kubernetes", None)
965+
if field is not None:
966+
args["kubernetes"] = unmarshal_PublicCatalogProductPropertiesKubernetes(field)
967+
else:
968+
args["kubernetes"] = None
969+
880970
return PublicCatalogProductProperties(**args)
881971

882972

0 commit comments

Comments
 (0)