Skip to content

feat(containers): add VPC integration feature flag #991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion scaleway-async/scaleway_async/container/v1beta1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ async def wait_for_namespace(
async def create_namespace(
self,
*,
activate_vpc_integration: bool,
region: Optional[ScwRegion] = None,
name: Optional[str] = None,
environment_variables: Optional[Dict[str, str]] = None,
Expand All @@ -278,6 +279,7 @@ async def create_namespace(
"""
Create a new namespace.
Create a new namespace in a specified region.
:param activate_vpc_integration:
:param region: Region to target. If none is passed will use default region from the config.
:param name: Name of the namespace to create.
:param environment_variables: Environment variables of the namespace to create.
Expand All @@ -290,7 +292,9 @@ async def create_namespace(
Usage:
::

result = await api.create_namespace()
result = await api.create_namespace(
activate_vpc_integration=False,
)
"""

param_region = validate_path_param(
Expand All @@ -302,6 +306,7 @@ async def create_namespace(
f"/containers/v1beta1/regions/{param_region}/namespaces",
body=marshal_CreateNamespaceRequest(
CreateNamespaceRequest(
activate_vpc_integration=activate_vpc_integration,
region=region,
name=name or random_name(prefix="cns"),
environment_variables=environment_variables,
Expand Down Expand Up @@ -606,6 +611,7 @@ async def create_container(
scaling_option: Optional[ContainerScalingOption] = None,
health_check: Optional[ContainerHealthCheckSpec] = None,
tags: Optional[List[str]] = None,
private_network_id: Optional[str] = None,
) -> Container:
"""
Create a new container.
Expand Down Expand Up @@ -637,6 +643,7 @@ async def create_container(
- memory_usage_threshold: Scale depending on the memory usage of a container instance.
:param health_check: Health check configuration of the container.
:param tags: Tags of the Serverless Container.
:param private_network_id:
:return: :class:`Container <Container>`

Usage:
Expand Down Expand Up @@ -679,6 +686,7 @@ async def create_container(
scaling_option=scaling_option,
health_check=health_check,
tags=tags,
private_network_id=private_network_id,
),
self.client,
),
Expand Down Expand Up @@ -712,6 +720,7 @@ async def update_container(
scaling_option: Optional[ContainerScalingOption] = None,
health_check: Optional[ContainerHealthCheckSpec] = None,
tags: Optional[List[str]] = None,
private_network_id: Optional[str] = None,
) -> Container:
"""
Update an existing container.
Expand Down Expand Up @@ -743,6 +752,7 @@ async def update_container(
- memory_usage_threshold: Scale depending on the memory usage of a container instance.
:param health_check: Health check configuration of the container.
:param tags: Tags of the Serverless Container.
:param private_network_id:
:return: :class:`Container <Container>`

Usage:
Expand Down Expand Up @@ -785,6 +795,7 @@ async def update_container(
scaling_option=scaling_option,
health_check=health_check,
tags=tags,
private_network_id=private_network_id,
),
self.client,
),
Expand Down
33 changes: 27 additions & 6 deletions scaleway-async/scaleway_async/container/v1beta1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ def unmarshal_Container(data: Any) -> Container:
else:
args["ready_at"] = None

field = data.get("private_network_id", None)
if field is not None:
args["private_network_id"] = field
else:
args["private_network_id"] = None

return Container(**args)


Expand Down Expand Up @@ -416,6 +422,12 @@ def unmarshal_Namespace(data: Any) -> Namespace:
if field is not None:
args["registry_namespace_id"] = field

field = data.get("error_message", None)
if field is not None:
args["error_message"] = field
else:
args["error_message"] = None

field = data.get("registry_endpoint", None)
if field is not None:
args["registry_endpoint"] = field
Expand All @@ -436,12 +448,6 @@ def unmarshal_Namespace(data: Any) -> Namespace:
if field is not None:
args["tags"] = field

field = data.get("error_message", None)
if field is not None:
args["error_message"] = field
else:
args["error_message"] = None

field = data.get("description", None)
if field is not None:
args["description"] = field
Expand All @@ -460,6 +466,12 @@ def unmarshal_Namespace(data: Any) -> Namespace:
else:
args["updated_at"] = None

field = data.get("vpc_integration_activated", None)
if field is not None:
args["vpc_integration_activated"] = field
else:
args["vpc_integration_activated"] = None

return Namespace(**args)


Expand Down Expand Up @@ -948,6 +960,9 @@ def marshal_CreateContainerRequest(
if request.tags is not None:
output["tags"] = request.tags

if request.private_network_id is not None:
output["private_network_id"] = request.private_network_id

return output


Expand Down Expand Up @@ -993,6 +1008,9 @@ def marshal_CreateNamespaceRequest(
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.activate_vpc_integration is not None:
output["activate_vpc_integration"] = request.activate_vpc_integration

if request.name is not None:
output["name"] = request.name

Expand Down Expand Up @@ -1200,6 +1218,9 @@ def marshal_UpdateContainerRequest(
if request.tags is not None:
output["tags"] = request.tags

if request.private_network_id is not None:
output["private_network_id"] = request.private_network_id

return output


Expand Down
20 changes: 15 additions & 5 deletions scaleway-async/scaleway_async/container/v1beta1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ class Container:
Last date when the container was successfully deployed and set to ready.
"""

private_network_id: Optional[str]


@dataclass
class Cron:
Expand Down Expand Up @@ -615,6 +617,11 @@ class Namespace:
UUID of the registry namespace.
"""

error_message: Optional[str]
"""
Last error message of the namesace.
"""

registry_endpoint: str
"""
Registry endpoint of the namespace.
Expand All @@ -635,11 +642,6 @@ class Namespace:
List of tags applied to the Serverless Container Namespace.
"""

error_message: Optional[str]
"""
Last error message of the namesace.
"""

description: Optional[str]
"""
Description of the endpoint.
Expand All @@ -655,6 +657,8 @@ class Namespace:
Last update date of the namespace.
"""

vpc_integration_activated: Optional[bool]


@dataclass
class Token:
Expand Down Expand Up @@ -861,6 +865,8 @@ class CreateContainerRequest:
Tags of the Serverless Container.
"""

private_network_id: Optional[str]


@dataclass
class CreateCronRequest:
Expand Down Expand Up @@ -910,6 +916,8 @@ class CreateDomainRequest:

@dataclass
class CreateNamespaceRequest:
activate_vpc_integration: bool

region: Optional[ScwRegion]
"""
Region to target. If none is passed will use default region from the config.
Expand Down Expand Up @@ -1545,6 +1553,8 @@ class UpdateContainerRequest:
Tags of the Serverless Container.
"""

private_network_id: Optional[str]


@dataclass
class UpdateCronRequest:
Expand Down
13 changes: 12 additions & 1 deletion scaleway/scaleway/container/v1beta1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ def wait_for_namespace(
def create_namespace(
self,
*,
activate_vpc_integration: bool,
region: Optional[ScwRegion] = None,
name: Optional[str] = None,
environment_variables: Optional[Dict[str, str]] = None,
Expand All @@ -276,6 +277,7 @@ def create_namespace(
"""
Create a new namespace.
Create a new namespace in a specified region.
:param activate_vpc_integration:
:param region: Region to target. If none is passed will use default region from the config.
:param name: Name of the namespace to create.
:param environment_variables: Environment variables of the namespace to create.
Expand All @@ -288,7 +290,9 @@ def create_namespace(
Usage:
::

result = api.create_namespace()
result = api.create_namespace(
activate_vpc_integration=False,
)
"""

param_region = validate_path_param(
Expand All @@ -300,6 +304,7 @@ def create_namespace(
f"/containers/v1beta1/regions/{param_region}/namespaces",
body=marshal_CreateNamespaceRequest(
CreateNamespaceRequest(
activate_vpc_integration=activate_vpc_integration,
region=region,
name=name or random_name(prefix="cns"),
environment_variables=environment_variables,
Expand Down Expand Up @@ -602,6 +607,7 @@ def create_container(
scaling_option: Optional[ContainerScalingOption] = None,
health_check: Optional[ContainerHealthCheckSpec] = None,
tags: Optional[List[str]] = None,
private_network_id: Optional[str] = None,
) -> Container:
"""
Create a new container.
Expand Down Expand Up @@ -633,6 +639,7 @@ def create_container(
- memory_usage_threshold: Scale depending on the memory usage of a container instance.
:param health_check: Health check configuration of the container.
:param tags: Tags of the Serverless Container.
:param private_network_id:
:return: :class:`Container <Container>`

Usage:
Expand Down Expand Up @@ -675,6 +682,7 @@ def create_container(
scaling_option=scaling_option,
health_check=health_check,
tags=tags,
private_network_id=private_network_id,
),
self.client,
),
Expand Down Expand Up @@ -708,6 +716,7 @@ def update_container(
scaling_option: Optional[ContainerScalingOption] = None,
health_check: Optional[ContainerHealthCheckSpec] = None,
tags: Optional[List[str]] = None,
private_network_id: Optional[str] = None,
) -> Container:
"""
Update an existing container.
Expand Down Expand Up @@ -739,6 +748,7 @@ def update_container(
- memory_usage_threshold: Scale depending on the memory usage of a container instance.
:param health_check: Health check configuration of the container.
:param tags: Tags of the Serverless Container.
:param private_network_id:
:return: :class:`Container <Container>`

Usage:
Expand Down Expand Up @@ -781,6 +791,7 @@ def update_container(
scaling_option=scaling_option,
health_check=health_check,
tags=tags,
private_network_id=private_network_id,
),
self.client,
),
Expand Down
33 changes: 27 additions & 6 deletions scaleway/scaleway/container/v1beta1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ def unmarshal_Container(data: Any) -> Container:
else:
args["ready_at"] = None

field = data.get("private_network_id", None)
if field is not None:
args["private_network_id"] = field
else:
args["private_network_id"] = None

return Container(**args)


Expand Down Expand Up @@ -416,6 +422,12 @@ def unmarshal_Namespace(data: Any) -> Namespace:
if field is not None:
args["registry_namespace_id"] = field

field = data.get("error_message", None)
if field is not None:
args["error_message"] = field
else:
args["error_message"] = None

field = data.get("registry_endpoint", None)
if field is not None:
args["registry_endpoint"] = field
Expand All @@ -436,12 +448,6 @@ def unmarshal_Namespace(data: Any) -> Namespace:
if field is not None:
args["tags"] = field

field = data.get("error_message", None)
if field is not None:
args["error_message"] = field
else:
args["error_message"] = None

field = data.get("description", None)
if field is not None:
args["description"] = field
Expand All @@ -460,6 +466,12 @@ def unmarshal_Namespace(data: Any) -> Namespace:
else:
args["updated_at"] = None

field = data.get("vpc_integration_activated", None)
if field is not None:
args["vpc_integration_activated"] = field
else:
args["vpc_integration_activated"] = None

return Namespace(**args)


Expand Down Expand Up @@ -948,6 +960,9 @@ def marshal_CreateContainerRequest(
if request.tags is not None:
output["tags"] = request.tags

if request.private_network_id is not None:
output["private_network_id"] = request.private_network_id

return output


Expand Down Expand Up @@ -993,6 +1008,9 @@ def marshal_CreateNamespaceRequest(
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.activate_vpc_integration is not None:
output["activate_vpc_integration"] = request.activate_vpc_integration

if request.name is not None:
output["name"] = request.name

Expand Down Expand Up @@ -1200,6 +1218,9 @@ def marshal_UpdateContainerRequest(
if request.tags is not None:
output["tags"] = request.tags

if request.private_network_id is not None:
output["private_network_id"] = request.private_network_id

return output


Expand Down
Loading