Skip to content
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
2 changes: 2 additions & 0 deletions scaleway-async/scaleway_async/vpc/v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from .types import DeleteSubnetsRequest
from .types import DeleteSubnetsResponse
from .types import DeleteVPCRequest
from .types import EnableCustomRoutesPropagationRequest
from .types import EnableDHCPRequest
from .types import EnableRoutingRequest
from .types import GetAclRequest
Expand Down Expand Up @@ -61,6 +62,7 @@
"DeleteSubnetsRequest",
"DeleteSubnetsResponse",
"DeleteVPCRequest",
"EnableCustomRoutesPropagationRequest",
"EnableDHCPRequest",
"EnableRoutingRequest",
"GetAclRequest",
Expand Down
35 changes: 35 additions & 0 deletions scaleway-async/scaleway_async/vpc/v2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,41 @@ async def enable_routing(
self._throw_on_error(res)
return unmarshal_VPC(res.json())

async def enable_custom_routes_propagation(
self,
*,
vpc_id: str,
region: Optional[ScwRegion] = None,
) -> VPC:
"""
Enable custom routes propagation on a VPC.
Enable custom routes propagation on an existing VPC. Note that you will not be able to deactivate it afterwards.
:param vpc_id: VPC ID.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`VPC <VPC>`

Usage:
::

result = await api.enable_custom_routes_propagation(
vpc_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_vpc_id = validate_path_param("vpc_id", vpc_id)

res = self._request(
"POST",
f"/vpc/v2/regions/{param_region}/vpcs/{param_vpc_id}/enable-custom-routes-propagation",
body={},
)

self._throw_on_error(res)
return unmarshal_VPC(res.json())

async def list_subnets(
self,
*,
Expand Down
4 changes: 4 additions & 0 deletions scaleway-async/scaleway_async/vpc/v2/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ def unmarshal_VPC(data: Any) -> VPC:
if field is not None:
args["routing_enabled"] = field

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

field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
Expand Down
18 changes: 18 additions & 0 deletions scaleway-async/scaleway_async/vpc/v2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ class VPC:
Defines whether the VPC routes traffic between its Private Networks.
"""

custom_routes_propagation_enabled: bool
"""
Defines whether the VPC advertises custom routes between its Private Networks.
"""

created_at: Optional[datetime]
"""
Date the VPC was created.
Expand Down Expand Up @@ -516,6 +521,19 @@ class DeleteVPCRequest:
"""


@dataclass
class EnableCustomRoutesPropagationRequest:
vpc_id: str
"""
VPC ID.
"""

region: Optional[ScwRegion]
"""
Region to target. If none is passed will use default region from the config.
"""


@dataclass
class EnableDHCPRequest:
private_network_id: str
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/vpc/v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from .types import DeleteSubnetsRequest
from .types import DeleteSubnetsResponse
from .types import DeleteVPCRequest
from .types import EnableCustomRoutesPropagationRequest
from .types import EnableDHCPRequest
from .types import EnableRoutingRequest
from .types import GetAclRequest
Expand Down Expand Up @@ -61,6 +62,7 @@
"DeleteSubnetsRequest",
"DeleteSubnetsResponse",
"DeleteVPCRequest",
"EnableCustomRoutesPropagationRequest",
"EnableDHCPRequest",
"EnableRoutingRequest",
"GetAclRequest",
Expand Down
35 changes: 35 additions & 0 deletions scaleway/scaleway/vpc/v2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,41 @@ def enable_routing(
self._throw_on_error(res)
return unmarshal_VPC(res.json())

def enable_custom_routes_propagation(
self,
*,
vpc_id: str,
region: Optional[ScwRegion] = None,
) -> VPC:
"""
Enable custom routes propagation on a VPC.
Enable custom routes propagation on an existing VPC. Note that you will not be able to deactivate it afterwards.
:param vpc_id: VPC ID.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`VPC <VPC>`

Usage:
::

result = api.enable_custom_routes_propagation(
vpc_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_vpc_id = validate_path_param("vpc_id", vpc_id)

res = self._request(
"POST",
f"/vpc/v2/regions/{param_region}/vpcs/{param_vpc_id}/enable-custom-routes-propagation",
body={},
)

self._throw_on_error(res)
return unmarshal_VPC(res.json())

def list_subnets(
self,
*,
Expand Down
4 changes: 4 additions & 0 deletions scaleway/scaleway/vpc/v2/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ def unmarshal_VPC(data: Any) -> VPC:
if field is not None:
args["routing_enabled"] = field

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

field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
Expand Down
18 changes: 18 additions & 0 deletions scaleway/scaleway/vpc/v2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ class VPC:
Defines whether the VPC routes traffic between its Private Networks.
"""

custom_routes_propagation_enabled: bool
"""
Defines whether the VPC advertises custom routes between its Private Networks.
"""

created_at: Optional[datetime]
"""
Date the VPC was created.
Expand Down Expand Up @@ -516,6 +521,19 @@ class DeleteVPCRequest:
"""


@dataclass
class EnableCustomRoutesPropagationRequest:
vpc_id: str
"""
VPC ID.
"""

region: Optional[ScwRegion]
"""
Region to target. If none is passed will use default region from the config.
"""


@dataclass
class EnableDHCPRequest:
private_network_id: str
Expand Down