Skip to content
Open
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
8 changes: 0 additions & 8 deletions scaleway-async/scaleway_async/vpc/v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
from .types import ListSubnetOverlapsResponseSubnetOverlap
from .types import VPCConnector
from .types import VPC
from .types import AddSubnetsRequest
from .types import AddSubnetsResponse
from .types import CreateIngressRuleRequest
from .types import CreatePrivateNetworkRequest
from .types import CreateRouteRequest
Expand All @@ -29,8 +27,6 @@
from .types import DeleteIngressRuleRequest
from .types import DeletePrivateNetworkRequest
from .types import DeleteRouteRequest
from .types import DeleteSubnetsRequest
from .types import DeleteSubnetsResponse
from .types import DeleteVPCConnectorRequest
from .types import DeleteVPCRequest
from .types import EnableCustomRoutesPropagationRequest
Expand Down Expand Up @@ -84,8 +80,6 @@
"ListSubnetOverlapsResponseSubnetOverlap",
"VPCConnector",
"VPC",
"AddSubnetsRequest",
"AddSubnetsResponse",
"CreateIngressRuleRequest",
"CreatePrivateNetworkRequest",
"CreateRouteRequest",
Expand All @@ -94,8 +88,6 @@
"DeleteIngressRuleRequest",
"DeletePrivateNetworkRequest",
"DeleteRouteRequest",
"DeleteSubnetsRequest",
"DeleteSubnetsResponse",
"DeleteVPCConnectorRequest",
"DeleteVPCRequest",
"EnableCustomRoutesPropagationRequest",
Expand Down
100 changes: 0 additions & 100 deletions scaleway-async/scaleway_async/vpc/v2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@
ListVPCsRequestOrderBy,
VPCConnectorStatus,
AclRule,
AddSubnetsRequest,
AddSubnetsResponse,
CreateIngressRuleRequest,
CreatePrivateNetworkRequest,
CreateRouteRequest,
CreateVPCConnectorRequest,
CreateVPCRequest,
DeleteSubnetsRequest,
DeleteSubnetsResponse,
GetAclResponse,
IngressRule,
ListIngressRulesResponse,
Expand Down Expand Up @@ -59,8 +55,6 @@
unmarshal_IngressRule,
unmarshal_VPCConnector,
unmarshal_VPC,
unmarshal_AddSubnetsResponse,
unmarshal_DeleteSubnetsResponse,
unmarshal_GetAclResponse,
unmarshal_ListIngressRulesResponse,
unmarshal_ListPrivateNetworksResponse,
Expand All @@ -69,13 +63,11 @@
unmarshal_ListVPCConnectorsResponse,
unmarshal_ListVPCsResponse,
unmarshal_SetAclResponse,
marshal_AddSubnetsRequest,
marshal_CreateIngressRuleRequest,
marshal_CreatePrivateNetworkRequest,
marshal_CreateRouteRequest,
marshal_CreateVPCConnectorRequest,
marshal_CreateVPCRequest,
marshal_DeleteSubnetsRequest,
marshal_SetAclRequest,
marshal_UpdateIngressRuleRequest,
marshal_UpdatePrivateNetworkRequest,
Expand Down Expand Up @@ -870,98 +862,6 @@ async def list_subnets_all(
},
)

async def add_subnets(
self,
*,
private_network_id: str,
region: Optional[ScwRegion] = None,
subnets: Optional[list[str]] = None,
) -> AddSubnetsResponse:
"""
Add subnets to a Private Network.
Add new subnets to an existing Private Network.
:param private_network_id: Private Network ID.
:param region: Region to target. If none is passed will use default region from the config.
:param subnets: Private Network subnets CIDR.
:return: :class:`AddSubnetsResponse <AddSubnetsResponse>`

Usage:
::

result = await api.add_subnets(
private_network_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_private_network_id = validate_path_param(
"private_network_id", private_network_id
)

res = self._request(
"POST",
f"/vpc/v2/regions/{param_region}/private-networks/{param_private_network_id}/subnets",
body=marshal_AddSubnetsRequest(
AddSubnetsRequest(
private_network_id=private_network_id,
region=region,
subnets=subnets,
),
self.client,
),
)

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

async def delete_subnets(
self,
*,
private_network_id: str,
region: Optional[ScwRegion] = None,
subnets: Optional[list[str]] = None,
) -> DeleteSubnetsResponse:
"""
Delete subnets from a Private Network.
Delete the specified subnets from a Private Network.
:param private_network_id: Private Network ID.
:param region: Region to target. If none is passed will use default region from the config.
:param subnets: Private Network subnets CIDR.
:return: :class:`DeleteSubnetsResponse <DeleteSubnetsResponse>`

Usage:
::

result = await api.delete_subnets(
private_network_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_private_network_id = validate_path_param(
"private_network_id", private_network_id
)

res = self._request(
"DELETE",
f"/vpc/v2/regions/{param_region}/private-networks/{param_private_network_id}/subnets",
body=marshal_DeleteSubnetsRequest(
DeleteSubnetsRequest(
private_network_id=private_network_id,
region=region,
subnets=subnets,
),
self.client,
),
)

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

async def create_route(
self,
*,
Expand Down
62 changes: 0 additions & 62 deletions scaleway-async/scaleway_async/vpc/v2/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
VPCConnectorPeerInfo,
VPCConnector,
VPC,
AddSubnetsResponse,
DeleteSubnetsResponse,
AclRule,
GetAclResponse,
ListIngressRulesResponse,
Expand All @@ -27,13 +25,11 @@
ListVPCConnectorsResponse,
ListVPCsResponse,
SetAclResponse,
AddSubnetsRequest,
CreateIngressRuleRequest,
CreatePrivateNetworkRequest,
CreateRouteRequest,
CreateVPCConnectorRequest,
CreateVPCRequest,
DeleteSubnetsRequest,
SetAclRequest,
UpdateIngressRuleRequest,
UpdatePrivateNetworkRequest,
Expand Down Expand Up @@ -566,40 +562,6 @@ def unmarshal_VPC(data: Any) -> VPC:
return VPC(**args)


def unmarshal_AddSubnetsResponse(data: Any) -> AddSubnetsResponse:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'AddSubnetsResponse' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}

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

return AddSubnetsResponse(**args)


def unmarshal_DeleteSubnetsResponse(data: Any) -> DeleteSubnetsResponse:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'DeleteSubnetsResponse' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}

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

return DeleteSubnetsResponse(**args)


def unmarshal_AclRule(data: Any) -> AclRule:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -902,18 +864,6 @@ def unmarshal_SetAclResponse(data: Any) -> SetAclResponse:
return SetAclResponse(**args)


def marshal_AddSubnetsRequest(
request: AddSubnetsRequest,
defaults: ProfileDefaults,
) -> dict[str, Any]:
output: dict[str, Any] = {}

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

return output


def marshal_CreateIngressRuleRequest(
request: CreateIngressRuleRequest,
defaults: ProfileDefaults,
Expand Down Expand Up @@ -1049,18 +999,6 @@ def marshal_CreateVPCRequest(
return output


def marshal_DeleteSubnetsRequest(
request: DeleteSubnetsRequest,
defaults: ProfileDefaults,
) -> dict[str, Any]:
output: dict[str, Any] = {}

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

return output


def marshal_AclRule(
request: AclRule,
defaults: ProfileDefaults,
Expand Down
46 changes: 0 additions & 46 deletions scaleway-async/scaleway_async/vpc/v2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,29 +505,6 @@ class VPC:
"""


@dataclass
class AddSubnetsRequest:
private_network_id: str
"""
Private Network ID.
"""

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

subnets: Optional[list[str]] = field(default_factory=list)
"""
Private Network subnets CIDR.
"""


@dataclass
class AddSubnetsResponse:
subnets: list[str]


@dataclass
class CreateIngressRuleRequest:
vpc_id: str
Expand Down Expand Up @@ -720,29 +697,6 @@ class DeleteRouteRequest:
"""


@dataclass
class DeleteSubnetsRequest:
private_network_id: str
"""
Private Network ID.
"""

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

subnets: Optional[list[str]] = field(default_factory=list)
"""
Private Network subnets CIDR.
"""


@dataclass
class DeleteSubnetsResponse:
subnets: list[str]


@dataclass
class DeleteVPCConnectorRequest:
vpc_connector_id: str
Expand Down
8 changes: 0 additions & 8 deletions scaleway/scaleway/vpc/v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
from .types import ListSubnetOverlapsResponseSubnetOverlap
from .types import VPCConnector
from .types import VPC
from .types import AddSubnetsRequest
from .types import AddSubnetsResponse
from .types import CreateIngressRuleRequest
from .types import CreatePrivateNetworkRequest
from .types import CreateRouteRequest
Expand All @@ -29,8 +27,6 @@
from .types import DeleteIngressRuleRequest
from .types import DeletePrivateNetworkRequest
from .types import DeleteRouteRequest
from .types import DeleteSubnetsRequest
from .types import DeleteSubnetsResponse
from .types import DeleteVPCConnectorRequest
from .types import DeleteVPCRequest
from .types import EnableCustomRoutesPropagationRequest
Expand Down Expand Up @@ -84,8 +80,6 @@
"ListSubnetOverlapsResponseSubnetOverlap",
"VPCConnector",
"VPC",
"AddSubnetsRequest",
"AddSubnetsResponse",
"CreateIngressRuleRequest",
"CreatePrivateNetworkRequest",
"CreateRouteRequest",
Expand All @@ -94,8 +88,6 @@
"DeleteIngressRuleRequest",
"DeletePrivateNetworkRequest",
"DeleteRouteRequest",
"DeleteSubnetsRequest",
"DeleteSubnetsResponse",
"DeleteVPCConnectorRequest",
"DeleteVPCRequest",
"EnableCustomRoutesPropagationRequest",
Expand Down
Loading
Loading