Skip to content

Commit eeff260

Browse files
committed
feat: update generated APIs
1 parent ae4c257 commit eeff260

File tree

8 files changed

+458
-60
lines changed

8 files changed

+458
-60
lines changed

scaleway-async/scaleway_async/container/v1beta1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
from .types import TriggerInputType
2424
from .types import TriggerStatus
2525
from .content import TRIGGER_TRANSIENT_STATUSES
26+
from .types import ContainerHealthCheckSpecHTTPProbe
27+
from .types import ContainerHealthCheckSpecTCPProbe
28+
from .types import ContainerHealthCheckSpec
2629
from .types import ContainerScalingOption
2730
from .types import SecretHashedValue
2831
from .types import TriggerMnqNatsClientConfig
@@ -100,6 +103,9 @@
100103
"TriggerInputType",
101104
"TriggerStatus",
102105
"TRIGGER_TRANSIENT_STATUSES",
106+
"ContainerHealthCheckSpecHTTPProbe",
107+
"ContainerHealthCheckSpecTCPProbe",
108+
"ContainerHealthCheckSpec",
103109
"ContainerScalingOption",
104110
"SecretHashedValue",
105111
"TriggerMnqNatsClientConfig",

scaleway-async/scaleway_async/container/v1beta1/api.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
ListTokensRequestOrderBy,
3030
ListTriggersRequestOrderBy,
3131
Container,
32+
ContainerHealthCheckSpec,
3233
ContainerScalingOption,
3334
CreateContainerRequest,
3435
CreateCronRequest,
@@ -603,6 +604,7 @@ async def create_container(
603604
sandbox: Optional[ContainerSandbox] = None,
604605
local_storage_limit: Optional[int] = None,
605606
scaling_option: Optional[ContainerScalingOption] = None,
607+
health_check: Optional[ContainerHealthCheckSpec] = None,
606608
) -> Container:
607609
"""
608610
Create a new container.
@@ -630,6 +632,8 @@ async def create_container(
630632
:param local_storage_limit: Local storage limit of the container (in MB).
631633
:param scaling_option: Possible values:
632634
- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance.
635+
- cpu_usage_threshold: Scale depending on the CPU usage of a container instance.
636+
:param health_check: Health check configuration of the container.
633637
:return: :class:`Container <Container>`
634638
635639
Usage:
@@ -670,6 +674,7 @@ async def create_container(
670674
sandbox=sandbox,
671675
local_storage_limit=local_storage_limit,
672676
scaling_option=scaling_option,
677+
health_check=health_check,
673678
),
674679
self.client,
675680
),
@@ -701,6 +706,7 @@ async def update_container(
701706
sandbox: Optional[ContainerSandbox] = None,
702707
local_storage_limit: Optional[int] = None,
703708
scaling_option: Optional[ContainerScalingOption] = None,
709+
health_check: Optional[ContainerHealthCheckSpec] = None,
704710
) -> Container:
705711
"""
706712
Update an existing container.
@@ -728,6 +734,8 @@ async def update_container(
728734
:param local_storage_limit: Local storage limit of the container (in MB).
729735
:param scaling_option: Possible values:
730736
- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance.
737+
- cpu_usage_threshold: Scale depending on the CPU usage of a container instance.
738+
:param health_check: Health check configuration of the container.
731739
:return: :class:`Container <Container>`
732740
733741
Usage:
@@ -768,6 +776,7 @@ async def update_container(
768776
sandbox=sandbox,
769777
local_storage_limit=local_storage_limit,
770778
scaling_option=scaling_option,
779+
health_check=health_check,
771780
),
772781
self.client,
773782
),

scaleway-async/scaleway_async/container/v1beta1/marshalling.py

Lines changed: 149 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
resolve_one_of,
1111
)
1212
from .types import (
13+
ContainerHealthCheckSpecHTTPProbe,
14+
ContainerHealthCheckSpecTCPProbe,
15+
ContainerHealthCheckSpec,
1316
ContainerScalingOption,
1417
SecretHashedValue,
1518
Container,
@@ -45,6 +48,69 @@
4548
)
4649

4750

51+
def unmarshal_ContainerHealthCheckSpecHTTPProbe(
52+
data: Any,
53+
) -> ContainerHealthCheckSpecHTTPProbe:
54+
if not isinstance(data, dict):
55+
raise TypeError(
56+
"Unmarshalling the type 'ContainerHealthCheckSpecHTTPProbe' failed as data isn't a dictionary."
57+
)
58+
59+
args: Dict[str, Any] = {}
60+
61+
field = data.get("path", None)
62+
if field is not None:
63+
args["path"] = field
64+
65+
return ContainerHealthCheckSpecHTTPProbe(**args)
66+
67+
68+
def unmarshal_ContainerHealthCheckSpecTCPProbe(
69+
data: Any,
70+
) -> ContainerHealthCheckSpecTCPProbe:
71+
if not isinstance(data, dict):
72+
raise TypeError(
73+
"Unmarshalling the type 'ContainerHealthCheckSpecTCPProbe' failed as data isn't a dictionary."
74+
)
75+
76+
args: Dict[str, Any] = {}
77+
78+
return ContainerHealthCheckSpecTCPProbe(**args)
79+
80+
81+
def unmarshal_ContainerHealthCheckSpec(data: Any) -> ContainerHealthCheckSpec:
82+
if not isinstance(data, dict):
83+
raise TypeError(
84+
"Unmarshalling the type 'ContainerHealthCheckSpec' failed as data isn't a dictionary."
85+
)
86+
87+
args: Dict[str, Any] = {}
88+
89+
field = data.get("failure_threshold", None)
90+
if field is not None:
91+
args["failure_threshold"] = field
92+
93+
field = data.get("http", None)
94+
if field is not None:
95+
args["http"] = unmarshal_ContainerHealthCheckSpecHTTPProbe(field)
96+
else:
97+
args["http"] = None
98+
99+
field = data.get("tcp", None)
100+
if field is not None:
101+
args["tcp"] = unmarshal_ContainerHealthCheckSpecTCPProbe(field)
102+
else:
103+
args["tcp"] = None
104+
105+
field = data.get("interval", None)
106+
if field is not None:
107+
args["interval"] = field
108+
else:
109+
args["interval"] = None
110+
111+
return ContainerHealthCheckSpec(**args)
112+
113+
48114
def unmarshal_ContainerScalingOption(data: Any) -> ContainerScalingOption:
49115
if not isinstance(data, dict):
50116
raise TypeError(
@@ -59,6 +125,12 @@ def unmarshal_ContainerScalingOption(data: Any) -> ContainerScalingOption:
59125
else:
60126
args["concurrent_requests_threshold"] = None
61127

128+
field = data.get("cpu_usage_threshold", None)
129+
if field is not None:
130+
args["cpu_usage_threshold"] = field
131+
else:
132+
args["cpu_usage_threshold"] = None
133+
62134
return ContainerScalingOption(**args)
63135

64136

@@ -133,22 +205,6 @@ def unmarshal_Container(data: Any) -> Container:
133205
if field is not None:
134206
args["registry_image"] = field
135207

136-
field = data.get("max_concurrency", None)
137-
if field is not None:
138-
args["max_concurrency"] = field
139-
140-
field = data.get("domain_name", None)
141-
if field is not None:
142-
args["domain_name"] = field
143-
144-
field = data.get("protocol", None)
145-
if field is not None:
146-
args["protocol"] = field
147-
148-
field = data.get("port", None)
149-
if field is not None:
150-
args["port"] = field
151-
152208
field = data.get("timeout", None)
153209
if field is not None:
154210
args["timeout"] = field
@@ -167,6 +223,22 @@ def unmarshal_Container(data: Any) -> Container:
167223
else:
168224
args["description"] = None
169225

226+
field = data.get("max_concurrency", None)
227+
if field is not None:
228+
args["max_concurrency"] = field
229+
230+
field = data.get("domain_name", None)
231+
if field is not None:
232+
args["domain_name"] = field
233+
234+
field = data.get("protocol", None)
235+
if field is not None:
236+
args["protocol"] = field
237+
238+
field = data.get("port", None)
239+
if field is not None:
240+
args["port"] = field
241+
170242
field = data.get("secret_environment_variables", None)
171243
if field is not None:
172244
args["secret_environment_variables"] = (
@@ -197,6 +269,12 @@ def unmarshal_Container(data: Any) -> Container:
197269
else:
198270
args["scaling_option"] = None
199271

272+
field = data.get("health_check", None)
273+
if field is not None:
274+
args["health_check"] = unmarshal_ContainerHealthCheckSpec(field)
275+
else:
276+
args["health_check"] = None
277+
200278
field = data.get("created_at", None)
201279
if field is not None:
202280
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
@@ -690,6 +768,50 @@ def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse:
690768
return ListTriggersResponse(**args)
691769

692770

771+
def marshal_ContainerHealthCheckSpecHTTPProbe(
772+
request: ContainerHealthCheckSpecHTTPProbe,
773+
defaults: ProfileDefaults,
774+
) -> Dict[str, Any]:
775+
output: Dict[str, Any] = {}
776+
777+
if request.path is not None:
778+
output["path"] = request.path
779+
780+
return output
781+
782+
783+
def marshal_ContainerHealthCheckSpecTCPProbe(
784+
request: ContainerHealthCheckSpecTCPProbe,
785+
defaults: ProfileDefaults,
786+
) -> Dict[str, Any]:
787+
output: Dict[str, Any] = {}
788+
789+
return output
790+
791+
792+
def marshal_ContainerHealthCheckSpec(
793+
request: ContainerHealthCheckSpec,
794+
defaults: ProfileDefaults,
795+
) -> Dict[str, Any]:
796+
output: Dict[str, Any] = {}
797+
output.update(
798+
resolve_one_of(
799+
[
800+
OneOfPossibility("http", request.http),
801+
OneOfPossibility("tcp", request.tcp),
802+
]
803+
),
804+
)
805+
806+
if request.failure_threshold is not None:
807+
output["failure_threshold"] = request.failure_threshold
808+
809+
if request.interval is not None:
810+
output["interval"] = request.interval
811+
812+
return output
813+
814+
693815
def marshal_ContainerScalingOption(
694816
request: ContainerScalingOption,
695817
defaults: ProfileDefaults,
@@ -702,6 +824,7 @@ def marshal_ContainerScalingOption(
702824
"concurrent_requests_threshold",
703825
request.concurrent_requests_threshold,
704826
),
827+
OneOfPossibility("cpu_usage_threshold", request.cpu_usage_threshold),
705828
]
706829
),
707830
)
@@ -792,6 +915,11 @@ def marshal_CreateContainerRequest(
792915
request.scaling_option, defaults
793916
)
794917

918+
if request.health_check is not None:
919+
output["health_check"] = marshal_ContainerHealthCheckSpec(
920+
request.health_check, defaults
921+
)
922+
795923
return output
796924

797925

@@ -1036,6 +1164,11 @@ def marshal_UpdateContainerRequest(
10361164
request.scaling_option, defaults
10371165
)
10381166

1167+
if request.health_check is not None:
1168+
output["health_check"] = marshal_ContainerHealthCheckSpec(
1169+
request.health_check, defaults
1170+
)
1171+
10391172
return output
10401173

10411174

0 commit comments

Comments
 (0)