diff --git a/scaleway-async/scaleway_async/dedibox/v1/__init__.py b/scaleway-async/scaleway_async/dedibox/v1/__init__.py index e6b1144a..5f6169f8 100644 --- a/scaleway-async/scaleway_async/dedibox/v1/__init__.py +++ b/scaleway-async/scaleway_async/dedibox/v1/__init__.py @@ -104,6 +104,7 @@ from .types import InstallPartition from .types import FailoverIP from .types import ListIPv6BlockSubnetsAvailableResponseSubnet +from .types import IPv6Block from .types import InvoiceSummary from .types import RpnSanIp from .types import RefundSummary @@ -158,19 +159,20 @@ from .types import GetServerInstallRequest from .types import GetServerRequest from .types import GetServiceRequest -from .types import IPv6Block from .types import IPv6BlockApiCreateIPv6BlockRequest from .types import IPv6BlockApiCreateIPv6BlockSubnetRequest from .types import IPv6BlockApiDeleteIPv6BlockRequest from .types import IPv6BlockApiGetIPv6BlockQuotasRequest from .types import IPv6BlockApiGetIPv6BlockRequest from .types import IPv6BlockApiListIPv6BlockSubnetsAvailableRequest +from .types import IPv6BlockApiListIPv6BlocksRequest from .types import IPv6BlockApiUpdateIPv6BlockRequest from .types import InstallServerRequest from .types import Invoice from .types import ListFailoverIPsRequest from .types import ListFailoverIPsResponse from .types import ListIPv6BlockSubnetsAvailableResponse +from .types import ListIPv6BlocksResponse from .types import ListInvoicesResponse from .types import ListIpsResponse from .types import ListOSRequest @@ -374,6 +376,7 @@ "InstallPartition", "FailoverIP", "ListIPv6BlockSubnetsAvailableResponseSubnet", + "IPv6Block", "InvoiceSummary", "RpnSanIp", "RefundSummary", @@ -428,19 +431,20 @@ "GetServerInstallRequest", "GetServerRequest", "GetServiceRequest", - "IPv6Block", "IPv6BlockApiCreateIPv6BlockRequest", "IPv6BlockApiCreateIPv6BlockSubnetRequest", "IPv6BlockApiDeleteIPv6BlockRequest", "IPv6BlockApiGetIPv6BlockQuotasRequest", "IPv6BlockApiGetIPv6BlockRequest", "IPv6BlockApiListIPv6BlockSubnetsAvailableRequest", + "IPv6BlockApiListIPv6BlocksRequest", "IPv6BlockApiUpdateIPv6BlockRequest", "InstallServerRequest", "Invoice", "ListFailoverIPsRequest", "ListFailoverIPsResponse", "ListIPv6BlockSubnetsAvailableResponse", + "ListIPv6BlocksResponse", "ListInvoicesResponse", "ListIpsResponse", "ListOSRequest", diff --git a/scaleway-async/scaleway_async/dedibox/v1/api.py b/scaleway-async/scaleway_async/dedibox/v1/api.py index cfb717bd..a6cf8a81 100644 --- a/scaleway-async/scaleway_async/dedibox/v1/api.py +++ b/scaleway-async/scaleway_async/dedibox/v1/api.py @@ -66,6 +66,7 @@ InvoiceSummary, ListFailoverIPsResponse, ListIPv6BlockSubnetsAvailableResponse, + ListIPv6BlocksResponse, ListInvoicesResponse, ListIpsResponse, ListOSResponse, @@ -153,6 +154,7 @@ unmarshal_RpnV2Group, unmarshal_Service, unmarshal_FailoverIP, + unmarshal_IPv6Block, unmarshal_BMCAccess, unmarshal_Backup, unmarshal_CanOrderResponse, @@ -160,10 +162,10 @@ unmarshal_GetIPv6BlockQuotasResponse, unmarshal_GetRemainingQuotaResponse, unmarshal_GetRpnStatusResponse, - unmarshal_IPv6Block, unmarshal_Invoice, unmarshal_ListFailoverIPsResponse, unmarshal_ListIPv6BlockSubnetsAvailableResponse, + unmarshal_ListIPv6BlocksResponse, unmarshal_ListInvoicesResponse, unmarshal_ListIpsResponse, unmarshal_ListOSResponse, @@ -2812,14 +2814,42 @@ async def create_i_pv6_block( self._throw_on_error(res) return unmarshal_IPv6Block(res.json()) + async def list_i_pv6_blocks( + self, + *, + project_id: Optional[str] = None, + ) -> ListIPv6BlocksResponse: + """ + List IPv6 blocks. + List IPv6 blocks associated given project ID. + :param project_id: + :return: :class:`ListIPv6BlocksResponse ` + + Usage: + :: + + result = await api.list_i_pv6_blocks() + """ + + res = self._request( + "GET", + "/dedibox/v1/ipv6-blocks", + params={ + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListIPv6BlocksResponse(res.json()) + async def get_i_pv6_block( self, *, project_id: Optional[str] = None, ) -> IPv6Block: """ - Get a specific IPv6 block. - Get the IPv6 block associated with the given ID. + Get first IPv6 block. + Get the first IPv6 block associated with the given project ID. :param project_id: ID of the project. :return: :class:`IPv6Block ` diff --git a/scaleway-async/scaleway_async/dedibox/v1/marshalling.py b/scaleway-async/scaleway_async/dedibox/v1/marshalling.py index e4f233c0..6c1ad69c 100644 --- a/scaleway-async/scaleway_async/dedibox/v1/marshalling.py +++ b/scaleway-async/scaleway_async/dedibox/v1/marshalling.py @@ -77,6 +77,7 @@ Service, FailoverBlock, FailoverIP, + IPv6Block, BMCAccess, Backup, CanOrderResponse, @@ -85,11 +86,11 @@ GetIPv6BlockQuotasResponse, GetRemainingQuotaResponse, GetRpnStatusResponse, - IPv6Block, Invoice, ListFailoverIPsResponse, ListIPv6BlockSubnetsAvailableResponseSubnet, ListIPv6BlockSubnetsAvailableResponse, + ListIPv6BlocksResponse, InvoiceSummary, ListInvoicesResponse, RpnSanIpRpnV2Group, @@ -1802,6 +1803,61 @@ def unmarshal_FailoverIP(data: Any) -> FailoverIP: return FailoverIP(**args) +def unmarshal_IPv6Block(data: Any) -> IPv6Block: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'IPv6Block' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + else: + args["id"] = 0 + + field = data.get("address", None) + if field is not None: + args["address"] = field + else: + args["address"] = None + + field = data.get("duid", None) + if field is not None: + args["duid"] = field + else: + args["duid"] = None + + field = data.get("nameservers", None) + if field is not None: + args["nameservers"] = field + else: + args["nameservers"] = [] + + field = data.get("cidr", None) + if field is not None: + args["cidr"] = field + else: + args["cidr"] = 0 + + field = data.get("subnets", None) + if field is not None: + args["subnets"] = ( + [unmarshal_IPv6Block(v) for v in field] if field is not None else None + ) + else: + args["subnets"] = [] + + field = data.get("delegation_status", None) + if field is not None: + args["delegation_status"] = field + else: + args["delegation_status"] = IPv6BlockDelegationStatus.UNKNOWN_STATUS + + return IPv6Block(**args) + + def unmarshal_BMCAccess(data: Any) -> BMCAccess: if not isinstance(data, dict): raise TypeError( @@ -2108,61 +2164,6 @@ def unmarshal_GetRpnStatusResponse(data: Any) -> GetRpnStatusResponse: return GetRpnStatusResponse(**args) -def unmarshal_IPv6Block(data: Any) -> IPv6Block: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'IPv6Block' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - else: - args["id"] = 0 - - field = data.get("address", None) - if field is not None: - args["address"] = field - else: - args["address"] = None - - field = data.get("duid", None) - if field is not None: - args["duid"] = field - else: - args["duid"] = None - - field = data.get("nameservers", None) - if field is not None: - args["nameservers"] = field - else: - args["nameservers"] = [] - - field = data.get("cidr", None) - if field is not None: - args["cidr"] = field - else: - args["cidr"] = 0 - - field = data.get("subnets", None) - if field is not None: - args["subnets"] = ( - [unmarshal_IPv6Block(v) for v in field] if field is not None else None - ) - else: - args["subnets"] = [] - - field = data.get("delegation_status", None) - if field is not None: - args["delegation_status"] = field - else: - args["delegation_status"] = IPv6BlockDelegationStatus.UNKNOWN_STATUS - - return IPv6Block(**args) - - def unmarshal_Invoice(data: Any) -> Invoice: if not isinstance(data, dict): raise TypeError( @@ -2307,6 +2308,31 @@ def unmarshal_ListIPv6BlockSubnetsAvailableResponse( return ListIPv6BlockSubnetsAvailableResponse(**args) +def unmarshal_ListIPv6BlocksResponse(data: Any) -> ListIPv6BlocksResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListIPv6BlocksResponse' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = None + + field = data.get("ipv6_blocks", None) + if field is not None: + args["ipv6_blocks"] = ( + [unmarshal_IPv6Block(v) for v in field] if field is not None else None + ) + else: + args["ipv6_blocks"] = None + + return ListIPv6BlocksResponse(**args) + + def unmarshal_InvoiceSummary(data: Any) -> InvoiceSummary: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway-async/scaleway_async/dedibox/v1/types.py b/scaleway-async/scaleway_async/dedibox/v1/types.py index 7d9fc2de..6f75d791 100644 --- a/scaleway-async/scaleway_async/dedibox/v1/types.py +++ b/scaleway-async/scaleway_async/dedibox/v1/types.py @@ -1576,6 +1576,44 @@ class ListIPv6BlockSubnetsAvailableResponseSubnet: cidr: int +@dataclass +class IPv6Block: + id: int + """ + ID of the IPv6. + """ + + address: str + """ + Address of the IPv6. + """ + + duid: str + """ + DUID of the IPv6. + """ + + nameservers: list[str] + """ + DNS linked to the IPv6. + """ + + cidr: int + """ + Classless InterDomain Routing notation of the IPv6. + """ + + subnets: list[IPv6Block] + """ + All IPv6 subnets. + """ + + delegation_status: IPv6BlockDelegationStatus + """ + The nameservers delegation status. + """ + + @dataclass class InvoiceSummary: id: int @@ -2654,44 +2692,6 @@ class GetServiceRequest: """ -@dataclass -class IPv6Block: - id: int - """ - ID of the IPv6. - """ - - address: str - """ - Address of the IPv6. - """ - - duid: str - """ - DUID of the IPv6. - """ - - nameservers: list[str] - """ - DNS linked to the IPv6. - """ - - cidr: int - """ - Classless InterDomain Routing notation of the IPv6. - """ - - subnets: list[IPv6Block] - """ - All IPv6 subnets. - """ - - delegation_status: IPv6BlockDelegationStatus - """ - The nameservers delegation status. - """ - - @dataclass class IPv6BlockApiCreateIPv6BlockRequest: project_id: Optional[str] = None @@ -2750,6 +2750,11 @@ class IPv6BlockApiListIPv6BlockSubnetsAvailableRequest: """ +@dataclass +class IPv6BlockApiListIPv6BlocksRequest: + project_id: Optional[str] = None + + @dataclass class IPv6BlockApiUpdateIPv6BlockRequest: block_id: int @@ -2906,6 +2911,12 @@ class ListIPv6BlockSubnetsAvailableResponse: """ +@dataclass +class ListIPv6BlocksResponse: + total_count: int + ipv6_blocks: list[IPv6Block] + + @dataclass class ListInvoicesResponse: total_count: int diff --git a/scaleway/scaleway/dedibox/v1/__init__.py b/scaleway/scaleway/dedibox/v1/__init__.py index e6b1144a..5f6169f8 100644 --- a/scaleway/scaleway/dedibox/v1/__init__.py +++ b/scaleway/scaleway/dedibox/v1/__init__.py @@ -104,6 +104,7 @@ from .types import InstallPartition from .types import FailoverIP from .types import ListIPv6BlockSubnetsAvailableResponseSubnet +from .types import IPv6Block from .types import InvoiceSummary from .types import RpnSanIp from .types import RefundSummary @@ -158,19 +159,20 @@ from .types import GetServerInstallRequest from .types import GetServerRequest from .types import GetServiceRequest -from .types import IPv6Block from .types import IPv6BlockApiCreateIPv6BlockRequest from .types import IPv6BlockApiCreateIPv6BlockSubnetRequest from .types import IPv6BlockApiDeleteIPv6BlockRequest from .types import IPv6BlockApiGetIPv6BlockQuotasRequest from .types import IPv6BlockApiGetIPv6BlockRequest from .types import IPv6BlockApiListIPv6BlockSubnetsAvailableRequest +from .types import IPv6BlockApiListIPv6BlocksRequest from .types import IPv6BlockApiUpdateIPv6BlockRequest from .types import InstallServerRequest from .types import Invoice from .types import ListFailoverIPsRequest from .types import ListFailoverIPsResponse from .types import ListIPv6BlockSubnetsAvailableResponse +from .types import ListIPv6BlocksResponse from .types import ListInvoicesResponse from .types import ListIpsResponse from .types import ListOSRequest @@ -374,6 +376,7 @@ "InstallPartition", "FailoverIP", "ListIPv6BlockSubnetsAvailableResponseSubnet", + "IPv6Block", "InvoiceSummary", "RpnSanIp", "RefundSummary", @@ -428,19 +431,20 @@ "GetServerInstallRequest", "GetServerRequest", "GetServiceRequest", - "IPv6Block", "IPv6BlockApiCreateIPv6BlockRequest", "IPv6BlockApiCreateIPv6BlockSubnetRequest", "IPv6BlockApiDeleteIPv6BlockRequest", "IPv6BlockApiGetIPv6BlockQuotasRequest", "IPv6BlockApiGetIPv6BlockRequest", "IPv6BlockApiListIPv6BlockSubnetsAvailableRequest", + "IPv6BlockApiListIPv6BlocksRequest", "IPv6BlockApiUpdateIPv6BlockRequest", "InstallServerRequest", "Invoice", "ListFailoverIPsRequest", "ListFailoverIPsResponse", "ListIPv6BlockSubnetsAvailableResponse", + "ListIPv6BlocksResponse", "ListInvoicesResponse", "ListIpsResponse", "ListOSRequest", diff --git a/scaleway/scaleway/dedibox/v1/api.py b/scaleway/scaleway/dedibox/v1/api.py index 02a34ac5..f11df7de 100644 --- a/scaleway/scaleway/dedibox/v1/api.py +++ b/scaleway/scaleway/dedibox/v1/api.py @@ -66,6 +66,7 @@ InvoiceSummary, ListFailoverIPsResponse, ListIPv6BlockSubnetsAvailableResponse, + ListIPv6BlocksResponse, ListInvoicesResponse, ListIpsResponse, ListOSResponse, @@ -153,6 +154,7 @@ unmarshal_RpnV2Group, unmarshal_Service, unmarshal_FailoverIP, + unmarshal_IPv6Block, unmarshal_BMCAccess, unmarshal_Backup, unmarshal_CanOrderResponse, @@ -160,10 +162,10 @@ unmarshal_GetIPv6BlockQuotasResponse, unmarshal_GetRemainingQuotaResponse, unmarshal_GetRpnStatusResponse, - unmarshal_IPv6Block, unmarshal_Invoice, unmarshal_ListFailoverIPsResponse, unmarshal_ListIPv6BlockSubnetsAvailableResponse, + unmarshal_ListIPv6BlocksResponse, unmarshal_ListInvoicesResponse, unmarshal_ListIpsResponse, unmarshal_ListOSResponse, @@ -2808,14 +2810,42 @@ def create_i_pv6_block( self._throw_on_error(res) return unmarshal_IPv6Block(res.json()) + def list_i_pv6_blocks( + self, + *, + project_id: Optional[str] = None, + ) -> ListIPv6BlocksResponse: + """ + List IPv6 blocks. + List IPv6 blocks associated given project ID. + :param project_id: + :return: :class:`ListIPv6BlocksResponse ` + + Usage: + :: + + result = api.list_i_pv6_blocks() + """ + + res = self._request( + "GET", + "/dedibox/v1/ipv6-blocks", + params={ + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListIPv6BlocksResponse(res.json()) + def get_i_pv6_block( self, *, project_id: Optional[str] = None, ) -> IPv6Block: """ - Get a specific IPv6 block. - Get the IPv6 block associated with the given ID. + Get first IPv6 block. + Get the first IPv6 block associated with the given project ID. :param project_id: ID of the project. :return: :class:`IPv6Block ` diff --git a/scaleway/scaleway/dedibox/v1/marshalling.py b/scaleway/scaleway/dedibox/v1/marshalling.py index e4f233c0..6c1ad69c 100644 --- a/scaleway/scaleway/dedibox/v1/marshalling.py +++ b/scaleway/scaleway/dedibox/v1/marshalling.py @@ -77,6 +77,7 @@ Service, FailoverBlock, FailoverIP, + IPv6Block, BMCAccess, Backup, CanOrderResponse, @@ -85,11 +86,11 @@ GetIPv6BlockQuotasResponse, GetRemainingQuotaResponse, GetRpnStatusResponse, - IPv6Block, Invoice, ListFailoverIPsResponse, ListIPv6BlockSubnetsAvailableResponseSubnet, ListIPv6BlockSubnetsAvailableResponse, + ListIPv6BlocksResponse, InvoiceSummary, ListInvoicesResponse, RpnSanIpRpnV2Group, @@ -1802,6 +1803,61 @@ def unmarshal_FailoverIP(data: Any) -> FailoverIP: return FailoverIP(**args) +def unmarshal_IPv6Block(data: Any) -> IPv6Block: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'IPv6Block' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + else: + args["id"] = 0 + + field = data.get("address", None) + if field is not None: + args["address"] = field + else: + args["address"] = None + + field = data.get("duid", None) + if field is not None: + args["duid"] = field + else: + args["duid"] = None + + field = data.get("nameservers", None) + if field is not None: + args["nameservers"] = field + else: + args["nameservers"] = [] + + field = data.get("cidr", None) + if field is not None: + args["cidr"] = field + else: + args["cidr"] = 0 + + field = data.get("subnets", None) + if field is not None: + args["subnets"] = ( + [unmarshal_IPv6Block(v) for v in field] if field is not None else None + ) + else: + args["subnets"] = [] + + field = data.get("delegation_status", None) + if field is not None: + args["delegation_status"] = field + else: + args["delegation_status"] = IPv6BlockDelegationStatus.UNKNOWN_STATUS + + return IPv6Block(**args) + + def unmarshal_BMCAccess(data: Any) -> BMCAccess: if not isinstance(data, dict): raise TypeError( @@ -2108,61 +2164,6 @@ def unmarshal_GetRpnStatusResponse(data: Any) -> GetRpnStatusResponse: return GetRpnStatusResponse(**args) -def unmarshal_IPv6Block(data: Any) -> IPv6Block: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'IPv6Block' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - else: - args["id"] = 0 - - field = data.get("address", None) - if field is not None: - args["address"] = field - else: - args["address"] = None - - field = data.get("duid", None) - if field is not None: - args["duid"] = field - else: - args["duid"] = None - - field = data.get("nameservers", None) - if field is not None: - args["nameservers"] = field - else: - args["nameservers"] = [] - - field = data.get("cidr", None) - if field is not None: - args["cidr"] = field - else: - args["cidr"] = 0 - - field = data.get("subnets", None) - if field is not None: - args["subnets"] = ( - [unmarshal_IPv6Block(v) for v in field] if field is not None else None - ) - else: - args["subnets"] = [] - - field = data.get("delegation_status", None) - if field is not None: - args["delegation_status"] = field - else: - args["delegation_status"] = IPv6BlockDelegationStatus.UNKNOWN_STATUS - - return IPv6Block(**args) - - def unmarshal_Invoice(data: Any) -> Invoice: if not isinstance(data, dict): raise TypeError( @@ -2307,6 +2308,31 @@ def unmarshal_ListIPv6BlockSubnetsAvailableResponse( return ListIPv6BlockSubnetsAvailableResponse(**args) +def unmarshal_ListIPv6BlocksResponse(data: Any) -> ListIPv6BlocksResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListIPv6BlocksResponse' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = None + + field = data.get("ipv6_blocks", None) + if field is not None: + args["ipv6_blocks"] = ( + [unmarshal_IPv6Block(v) for v in field] if field is not None else None + ) + else: + args["ipv6_blocks"] = None + + return ListIPv6BlocksResponse(**args) + + def unmarshal_InvoiceSummary(data: Any) -> InvoiceSummary: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway/scaleway/dedibox/v1/types.py b/scaleway/scaleway/dedibox/v1/types.py index 7d9fc2de..6f75d791 100644 --- a/scaleway/scaleway/dedibox/v1/types.py +++ b/scaleway/scaleway/dedibox/v1/types.py @@ -1576,6 +1576,44 @@ class ListIPv6BlockSubnetsAvailableResponseSubnet: cidr: int +@dataclass +class IPv6Block: + id: int + """ + ID of the IPv6. + """ + + address: str + """ + Address of the IPv6. + """ + + duid: str + """ + DUID of the IPv6. + """ + + nameservers: list[str] + """ + DNS linked to the IPv6. + """ + + cidr: int + """ + Classless InterDomain Routing notation of the IPv6. + """ + + subnets: list[IPv6Block] + """ + All IPv6 subnets. + """ + + delegation_status: IPv6BlockDelegationStatus + """ + The nameservers delegation status. + """ + + @dataclass class InvoiceSummary: id: int @@ -2654,44 +2692,6 @@ class GetServiceRequest: """ -@dataclass -class IPv6Block: - id: int - """ - ID of the IPv6. - """ - - address: str - """ - Address of the IPv6. - """ - - duid: str - """ - DUID of the IPv6. - """ - - nameservers: list[str] - """ - DNS linked to the IPv6. - """ - - cidr: int - """ - Classless InterDomain Routing notation of the IPv6. - """ - - subnets: list[IPv6Block] - """ - All IPv6 subnets. - """ - - delegation_status: IPv6BlockDelegationStatus - """ - The nameservers delegation status. - """ - - @dataclass class IPv6BlockApiCreateIPv6BlockRequest: project_id: Optional[str] = None @@ -2750,6 +2750,11 @@ class IPv6BlockApiListIPv6BlockSubnetsAvailableRequest: """ +@dataclass +class IPv6BlockApiListIPv6BlocksRequest: + project_id: Optional[str] = None + + @dataclass class IPv6BlockApiUpdateIPv6BlockRequest: block_id: int @@ -2906,6 +2911,12 @@ class ListIPv6BlockSubnetsAvailableResponse: """ +@dataclass +class ListIPv6BlocksResponse: + total_count: int + ipv6_blocks: list[IPv6Block] + + @dataclass class ListInvoicesResponse: total_count: int