Skip to content

Commit c966107

Browse files
authored
feat(edge_services): add serverless container backend (scaleway#1405)
1 parent 11f7c86 commit c966107

File tree

6 files changed

+100
-0
lines changed

6 files changed

+100
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from .types import RuleHttpMatchPathFilter
3131
from .types import ScalewayLbBackendConfig
3232
from .types import ScalewayS3BackendConfig
33+
from .types import ScalewayServerlessContainerBackendConfig
3334
from .types import PipelineError
3435
from .types import TLSSecret
3536
from .types import RuleHttpMatch
@@ -160,6 +161,7 @@
160161
"RuleHttpMatchPathFilter",
161162
"ScalewayLbBackendConfig",
162163
"ScalewayS3BackendConfig",
164+
"ScalewayServerlessContainerBackendConfig",
163165
"PipelineError",
164166
"TLSSecret",
165167
"RuleHttpMatch",

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ScalewayLb,
2424
ScalewayLbBackendConfig,
2525
ScalewayS3BackendConfig,
26+
ScalewayServerlessContainerBackendConfig,
2627
BackendStage,
2728
CacheStage,
2829
DNSStage,
@@ -187,6 +188,31 @@ def unmarshal_ScalewayS3BackendConfig(data: Any) -> ScalewayS3BackendConfig:
187188
return ScalewayS3BackendConfig(**args)
188189

189190

191+
def unmarshal_ScalewayServerlessContainerBackendConfig(
192+
data: Any,
193+
) -> ScalewayServerlessContainerBackendConfig:
194+
if not isinstance(data, dict):
195+
raise TypeError(
196+
"Unmarshalling the type 'ScalewayServerlessContainerBackendConfig' failed as data isn't a dictionary."
197+
)
198+
199+
args: dict[str, Any] = {}
200+
201+
field = data.get("region", None)
202+
if field is not None:
203+
args["region"] = field
204+
else:
205+
args["region"] = None
206+
207+
field = data.get("container_id", None)
208+
if field is not None:
209+
args["container_id"] = field
210+
else:
211+
args["container_id"] = None
212+
213+
return ScalewayServerlessContainerBackendConfig(**args)
214+
215+
190216
def unmarshal_BackendStage(data: Any) -> BackendStage:
191217
if not isinstance(data, dict):
192218
raise TypeError(
@@ -231,6 +257,14 @@ def unmarshal_BackendStage(data: Any) -> BackendStage:
231257
else:
232258
args["scaleway_lb"] = None
233259

260+
field = data.get("scaleway_serverless_container", None)
261+
if field is not None:
262+
args["scaleway_serverless_container"] = (
263+
unmarshal_ScalewayServerlessContainerBackendConfig(field)
264+
)
265+
else:
266+
args["scaleway_serverless_container"] = None
267+
234268
return BackendStage(**args)
235269

236270

scaleway-async/scaleway_async/edge_services/v1beta1/types.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,16 @@ class ScalewayS3BackendConfig:
338338
"""
339339

340340

341+
@dataclass
342+
class ScalewayServerlessContainerBackendConfig:
343+
region: ScwRegion
344+
"""
345+
Region to target. If none is passed will use default region from the config.
346+
"""
347+
348+
container_id: str
349+
350+
341351
@dataclass
342352
class PipelineError:
343353
stage: PipelineErrorStage
@@ -399,6 +409,10 @@ class BackendStage:
399409

400410
scaleway_lb: Optional[ScalewayLbBackendConfig] = None
401411

412+
scaleway_serverless_container: Optional[
413+
ScalewayServerlessContainerBackendConfig
414+
] = None
415+
402416

403417
@dataclass
404418
class CacheStage:

scaleway/scaleway/edge_services/v1beta1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from .types import RuleHttpMatchPathFilter
3131
from .types import ScalewayLbBackendConfig
3232
from .types import ScalewayS3BackendConfig
33+
from .types import ScalewayServerlessContainerBackendConfig
3334
from .types import PipelineError
3435
from .types import TLSSecret
3536
from .types import RuleHttpMatch
@@ -160,6 +161,7 @@
160161
"RuleHttpMatchPathFilter",
161162
"ScalewayLbBackendConfig",
162163
"ScalewayS3BackendConfig",
164+
"ScalewayServerlessContainerBackendConfig",
163165
"PipelineError",
164166
"TLSSecret",
165167
"RuleHttpMatch",

scaleway/scaleway/edge_services/v1beta1/marshalling.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ScalewayLb,
2424
ScalewayLbBackendConfig,
2525
ScalewayS3BackendConfig,
26+
ScalewayServerlessContainerBackendConfig,
2627
BackendStage,
2728
CacheStage,
2829
DNSStage,
@@ -187,6 +188,31 @@ def unmarshal_ScalewayS3BackendConfig(data: Any) -> ScalewayS3BackendConfig:
187188
return ScalewayS3BackendConfig(**args)
188189

189190

191+
def unmarshal_ScalewayServerlessContainerBackendConfig(
192+
data: Any,
193+
) -> ScalewayServerlessContainerBackendConfig:
194+
if not isinstance(data, dict):
195+
raise TypeError(
196+
"Unmarshalling the type 'ScalewayServerlessContainerBackendConfig' failed as data isn't a dictionary."
197+
)
198+
199+
args: dict[str, Any] = {}
200+
201+
field = data.get("region", None)
202+
if field is not None:
203+
args["region"] = field
204+
else:
205+
args["region"] = None
206+
207+
field = data.get("container_id", None)
208+
if field is not None:
209+
args["container_id"] = field
210+
else:
211+
args["container_id"] = None
212+
213+
return ScalewayServerlessContainerBackendConfig(**args)
214+
215+
190216
def unmarshal_BackendStage(data: Any) -> BackendStage:
191217
if not isinstance(data, dict):
192218
raise TypeError(
@@ -231,6 +257,14 @@ def unmarshal_BackendStage(data: Any) -> BackendStage:
231257
else:
232258
args["scaleway_lb"] = None
233259

260+
field = data.get("scaleway_serverless_container", None)
261+
if field is not None:
262+
args["scaleway_serverless_container"] = (
263+
unmarshal_ScalewayServerlessContainerBackendConfig(field)
264+
)
265+
else:
266+
args["scaleway_serverless_container"] = None
267+
234268
return BackendStage(**args)
235269

236270

scaleway/scaleway/edge_services/v1beta1/types.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,16 @@ class ScalewayS3BackendConfig:
338338
"""
339339

340340

341+
@dataclass
342+
class ScalewayServerlessContainerBackendConfig:
343+
region: ScwRegion
344+
"""
345+
Region to target. If none is passed will use default region from the config.
346+
"""
347+
348+
container_id: str
349+
350+
341351
@dataclass
342352
class PipelineError:
343353
stage: PipelineErrorStage
@@ -399,6 +409,10 @@ class BackendStage:
399409

400410
scaleway_lb: Optional[ScalewayLbBackendConfig] = None
401411

412+
scaleway_serverless_container: Optional[
413+
ScalewayServerlessContainerBackendConfig
414+
] = None
415+
402416

403417
@dataclass
404418
class CacheStage:

0 commit comments

Comments
 (0)