From 5fea0dad46fe6fb7f66dcbbfd70412fdc22b2096 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Sat, 20 Jun 2026 11:10:53 +0000 Subject: [PATCH] feat: update generated APIs --- .../scaleway_async/k8s/v1/marshalling.py | 12 +- scaleway-async/scaleway_async/k8s/v1/types.py | 10 +- .../mailbox/v1alpha1/__init__.py | 14 +- .../scaleway_async/mailbox/v1alpha1/api.py | 188 +++++++++++++++++- .../mailbox/v1alpha1/marshalling.py | 137 ++++++++----- .../scaleway_async/mailbox/v1alpha1/types.py | 155 +++++++++++---- .../product_catalog/v2alpha1/__init__.py | 2 + .../product_catalog/v2alpha1/marshalling.py | 20 ++ .../product_catalog/v2alpha1/types.py | 8 + .../scaleway_async/search/v1alpha1/types.py | 1 + .../scaleway_async/searchdb/v1alpha1/api.py | 14 +- .../searchdb/v1alpha1/marshalling.py | 12 +- .../scaleway_async/searchdb/v1alpha1/types.py | 20 +- .../scaleway_async/vpc/v2/__init__.py | 8 - scaleway-async/scaleway_async/vpc/v2/api.py | 100 ---------- .../scaleway_async/vpc/v2/marshalling.py | 62 ------ scaleway-async/scaleway_async/vpc/v2/types.py | 46 ----- scaleway/scaleway/k8s/v1/marshalling.py | 12 +- scaleway/scaleway/k8s/v1/types.py | 10 +- .../scaleway/mailbox/v1alpha1/__init__.py | 14 +- scaleway/scaleway/mailbox/v1alpha1/api.py | 188 +++++++++++++++++- .../scaleway/mailbox/v1alpha1/marshalling.py | 137 ++++++++----- scaleway/scaleway/mailbox/v1alpha1/types.py | 155 +++++++++++---- .../product_catalog/v2alpha1/__init__.py | 2 + .../product_catalog/v2alpha1/marshalling.py | 20 ++ .../product_catalog/v2alpha1/types.py | 8 + scaleway/scaleway/search/v1alpha1/types.py | 1 + scaleway/scaleway/searchdb/v1alpha1/api.py | 14 +- .../scaleway/searchdb/v1alpha1/marshalling.py | 12 +- scaleway/scaleway/searchdb/v1alpha1/types.py | 20 +- scaleway/scaleway/vpc/v2/__init__.py | 8 - scaleway/scaleway/vpc/v2/api.py | 100 ---------- scaleway/scaleway/vpc/v2/marshalling.py | 62 ------ scaleway/scaleway/vpc/v2/types.py | 46 ----- 34 files changed, 922 insertions(+), 696 deletions(-) diff --git a/scaleway-async/scaleway_async/k8s/v1/marshalling.py b/scaleway-async/scaleway_async/k8s/v1/marshalling.py index 16dcd5b04..73026fd8b 100644 --- a/scaleway-async/scaleway_async/k8s/v1/marshalling.py +++ b/scaleway-async/scaleway_async/k8s/v1/marshalling.py @@ -838,18 +838,18 @@ def unmarshal_Pool(data: Any) -> Pool: else: args["startup_taints"] = [] - field = data.get("private_network_id", None) - if field is not None: - args["private_network_id"] = field - else: - args["private_network_id"] = None - field = data.get("region", None) if field is not None: args["region"] = field else: args["region"] = 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 Pool(**args) diff --git a/scaleway-async/scaleway_async/k8s/v1/types.py b/scaleway-async/scaleway_async/k8s/v1/types.py index ada47d10e..e50e09fae 100644 --- a/scaleway-async/scaleway_async/k8s/v1/types.py +++ b/scaleway-async/scaleway_async/k8s/v1/types.py @@ -1078,11 +1078,6 @@ class Pool: Kubernetes taints applied at node creation but not reconciled afterwards. """ - private_network_id: str - """ - Private network where the nodes are attached. Should be member of the same VPC as the API Server. - """ - region: ScwRegion """ Cluster region of the pool. @@ -1113,6 +1108,11 @@ class Pool: System volume disk size. """ + private_network_id: Optional[str] = None + """ + Private network where the nodes are attached. Should be member of the same VPC as the API Server. + """ + @dataclass class NodeMetadataCoreV1Taint: diff --git a/scaleway-async/scaleway_async/mailbox/v1alpha1/__init__.py b/scaleway-async/scaleway_async/mailbox/v1alpha1/__init__.py index b1035b544..730ab8101 100644 --- a/scaleway-async/scaleway_async/mailbox/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/mailbox/v1alpha1/__init__.py @@ -8,6 +8,7 @@ from .content import DOMAIN_RECORD_TRANSIENT_STATUSES from .types import DomainStatus from .content import DOMAIN_TRANSIENT_STATUSES +from .types import ListAliasesRequestOrderBy from .types import ListDomainsRequestOrderBy from .types import ListMailboxesRequestOrderBy from .types import MailboxStatus @@ -16,18 +17,22 @@ from .types import BatchCreateMailboxesRequestMailboxParameters from .types import Mailbox from .types import DomainRecord -from .types import Domain from .types import Alias +from .types import Domain from .types import BatchCreateMailboxesRequest from .types import BatchCreateMailboxesResponse from .types import CreateAliasRequest from .types import CreateDomainRequest +from .types import DeleteAliasRequest from .types import DeleteDomainRequest from .types import DeleteMailboxRequest +from .types import GetAliasRequest from .types import GetDomainRecordsRequest from .types import GetDomainRecordsResponse from .types import GetDomainRequest from .types import GetMailboxRequest +from .types import ListAliasesRequest +from .types import ListAliasesResponse from .types import ListDomainsRequest from .types import ListDomainsResponse from .types import ListMailboxesRequest @@ -46,6 +51,7 @@ "DOMAIN_RECORD_TRANSIENT_STATUSES", "DomainStatus", "DOMAIN_TRANSIENT_STATUSES", + "ListAliasesRequestOrderBy", "ListDomainsRequestOrderBy", "ListMailboxesRequestOrderBy", "MailboxStatus", @@ -54,18 +60,22 @@ "BatchCreateMailboxesRequestMailboxParameters", "Mailbox", "DomainRecord", - "Domain", "Alias", + "Domain", "BatchCreateMailboxesRequest", "BatchCreateMailboxesResponse", "CreateAliasRequest", "CreateDomainRequest", + "DeleteAliasRequest", "DeleteDomainRequest", "DeleteMailboxRequest", + "GetAliasRequest", "GetDomainRecordsRequest", "GetDomainRecordsResponse", "GetDomainRequest", "GetMailboxRequest", + "ListAliasesRequest", + "ListAliasesResponse", "ListDomainsRequest", "ListDomainsResponse", "ListMailboxesRequest", diff --git a/scaleway-async/scaleway_async/mailbox/v1alpha1/api.py b/scaleway-async/scaleway_async/mailbox/v1alpha1/api.py index 148331c45..ae6914806 100644 --- a/scaleway-async/scaleway_async/mailbox/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/mailbox/v1alpha1/api.py @@ -11,7 +11,9 @@ wait_for_resource_async, ) from .types import ( + AliasStatus, DomainStatus, + ListAliasesRequestOrderBy, ListDomainsRequestOrderBy, ListMailboxesRequestOrderBy, MailboxStatus, @@ -24,21 +26,24 @@ CreateDomainRequest, Domain, GetDomainRecordsResponse, + ListAliasesResponse, ListDomainsResponse, ListMailboxesResponse, Mailbox, UpdateMailboxRequest, ) from .content import ( + ALIAS_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, MAILBOX_TRANSIENT_STATUSES, ) from .marshalling import ( unmarshal_Mailbox, - unmarshal_Domain, unmarshal_Alias, + unmarshal_Domain, unmarshal_BatchCreateMailboxesResponse, unmarshal_GetDomainRecordsResponse, + unmarshal_ListAliasesResponse, unmarshal_ListDomainsResponse, unmarshal_ListMailboxesResponse, marshal_BatchCreateMailboxesRequest, @@ -364,6 +369,7 @@ async def list_mailboxes( domain_id: Optional[str] = None, statuses: Optional[list[MailboxStatus]] = None, search: Optional[str] = None, + project_id: Optional[str] = None, ) -> ListMailboxesResponse: """ List mailboxes in an organization. @@ -374,6 +380,7 @@ async def list_mailboxes( :param domain_id: (Optional) ID of the domain in which to list the mailboxes. :param statuses: (Optional) Filter mailboxes by their statuses. :param search: (Optional) Search term to filter mailboxes on name and local_part. + :param project_id: (Optional) Project ID to filter mailboxes on. :return: :class:`ListMailboxesResponse ` Usage: @@ -390,6 +397,7 @@ async def list_mailboxes( "order_by": order_by, "page": page, "page_size": page_size or self.client.default_page_size, + "project_id": project_id or self.client.default_project_id, "search": search, "statuses": statuses, }, @@ -407,6 +415,7 @@ async def list_mailboxes_all( domain_id: Optional[str] = None, statuses: Optional[list[MailboxStatus]] = None, search: Optional[str] = None, + project_id: Optional[str] = None, ) -> list[Mailbox]: """ List mailboxes in an organization. @@ -417,6 +426,7 @@ async def list_mailboxes_all( :param domain_id: (Optional) ID of the domain in which to list the mailboxes. :param statuses: (Optional) Filter mailboxes by their statuses. :param search: (Optional) Search term to filter mailboxes on name and local_part. + :param project_id: (Optional) Project ID to filter mailboxes on. :return: :class:`list[Mailbox] ` Usage: @@ -436,6 +446,7 @@ async def list_mailboxes_all( "domain_id": domain_id, "statuses": statuses, "search": search, + "project_id": project_id, }, ) @@ -620,11 +631,9 @@ async def create_alias( ) """ - param_mailbox_id = validate_path_param("mailbox_id", mailbox_id) - res = self._request( "POST", - f"/mailbox/v1alpha1/mailboxes/{param_mailbox_id}/aliases", + "/mailbox/v1alpha1/aliases", body=marshal_CreateAliasRequest( CreateAliasRequest( local_part=local_part, @@ -637,3 +646,174 @@ async def create_alias( self._throw_on_error(res) return unmarshal_Alias(res.json()) + + async def list_aliases( + self, + *, + order_by: Optional[ListAliasesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + mailbox_id: Optional[str] = None, + status: Optional[AliasStatus] = None, + project_id: Optional[str] = None, + ) -> ListAliasesResponse: + """ + List aliases for a mailbox. + :param order_by: Order aliases by specific criteria. + :param page: Requested page number. Value must be greater or equal to 1. + :param page_size: Requested page size. Value must be between 1 and 100. + :param mailbox_id: ID of the mailbox for which to list aliases. + :param status: (Optional) Filter aliases by their status. + :param project_id: Project ID to filter on. + :return: :class:`ListAliasesResponse ` + + Usage: + :: + + result = await api.list_aliases() + """ + + res = self._request( + "GET", + "/mailbox/v1alpha1/aliases", + params={ + "mailbox_id": mailbox_id, + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + "project_id": project_id or self.client.default_project_id, + "status": status, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListAliasesResponse(res.json()) + + async def list_aliases_all( + self, + *, + order_by: Optional[ListAliasesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + mailbox_id: Optional[str] = None, + status: Optional[AliasStatus] = None, + project_id: Optional[str] = None, + ) -> list[Alias]: + """ + List aliases for a mailbox. + :param order_by: Order aliases by specific criteria. + :param page: Requested page number. Value must be greater or equal to 1. + :param page_size: Requested page size. Value must be between 1 and 100. + :param mailbox_id: ID of the mailbox for which to list aliases. + :param status: (Optional) Filter aliases by their status. + :param project_id: Project ID to filter on. + :return: :class:`list[Alias] ` + + Usage: + :: + + result = await api.list_aliases_all() + """ + + return await fetch_all_pages_async( + type=ListAliasesResponse, + key="aliases", + fetcher=self.list_aliases, + args={ + "order_by": order_by, + "page": page, + "page_size": page_size, + "mailbox_id": mailbox_id, + "status": status, + "project_id": project_id, + }, + ) + + async def get_alias( + self, + *, + alias_id: str, + ) -> Alias: + """ + Get an alias by its ID. + :param alias_id: ID of the alias to get. + :return: :class:`Alias ` + + Usage: + :: + + result = await api.get_alias( + alias_id="example", + ) + """ + + param_alias_id = validate_path_param("alias_id", alias_id) + + res = self._request( + "GET", + f"/mailbox/v1alpha1/aliases/{param_alias_id}", + ) + + self._throw_on_error(res) + return unmarshal_Alias(res.json()) + + async def wait_for_alias( + self, + *, + alias_id: str, + options: Optional[WaitForOptions[Alias, Union[bool, Awaitable[bool]]]] = None, + ) -> Alias: + """ + Get an alias by its ID. + :param alias_id: ID of the alias to get. + :return: :class:`Alias ` + + Usage: + :: + + result = await api.get_alias( + alias_id="example", + ) + """ + + if not options: + options = WaitForOptions() + + if not options.stop: + options.stop = lambda res: res.status not in ALIAS_TRANSIENT_STATUSES + + return await wait_for_resource_async( + fetcher=self.get_alias, + options=options, + args={ + "alias_id": alias_id, + }, + ) + + async def delete_alias( + self, + *, + alias_id: str, + ) -> Alias: + """ + Delete an alias by its ID. + :param alias_id: ID of the alias to delete. + :return: :class:`Alias ` + + Usage: + :: + + result = await api.delete_alias( + alias_id="example", + ) + """ + + param_alias_id = validate_path_param("alias_id", alias_id) + + res = self._request( + "DELETE", + f"/mailbox/v1alpha1/aliases/{param_alias_id}", + ) + + self._throw_on_error(res) + return unmarshal_Alias(res.json()) diff --git a/scaleway-async/scaleway_async/mailbox/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/mailbox/v1alpha1/marshalling.py index 5c1a0a325..fae8fd1af 100644 --- a/scaleway-async/scaleway_async/mailbox/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/mailbox/v1alpha1/marshalling.py @@ -14,11 +14,12 @@ MailboxStatus, MailboxSubscriptionPeriod, Mailbox, - Domain, Alias, + Domain, BatchCreateMailboxesResponse, DomainRecord, GetDomainRecordsResponse, + ListAliasesResponse, ListDomainsResponse, ListMailboxesResponse, BatchCreateMailboxesRequestMailboxParameters, @@ -116,6 +117,59 @@ def unmarshal_Mailbox(data: Any) -> Mailbox: return Mailbox(**args) +def unmarshal_Alias(data: Any) -> Alias: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Alias' 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"] = None + + field = data.get("email", None) + if field is not None: + args["email"] = field + else: + args["email"] = None + + field = data.get("mailbox_id", None) + if field is not None: + args["mailbox_id"] = field + else: + args["mailbox_id"] = None + + field = data.get("description", None) + if field is not None: + args["description"] = field + else: + args["description"] = None + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = AliasStatus.UNKNOWN_STATUS + + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("updated_at", None) + if field is not None: + args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["updated_at"] = None + + return Alias(**args) + + def unmarshal_Domain(data: Any) -> Domain: if not isinstance(data, dict): raise TypeError( @@ -193,59 +247,6 @@ def unmarshal_Domain(data: Any) -> Domain: return Domain(**args) -def unmarshal_Alias(data: Any) -> Alias: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Alias' 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"] = None - - field = data.get("email", None) - if field is not None: - args["email"] = field - else: - args["email"] = None - - field = data.get("mailbox_id", None) - if field is not None: - args["mailbox_id"] = field - else: - args["mailbox_id"] = None - - field = data.get("description", None) - if field is not None: - args["description"] = field - else: - args["description"] = None - - field = data.get("status", None) - if field is not None: - args["status"] = field - else: - args["status"] = AliasStatus.UNKNOWN_STATUS - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - return Alias(**args) - - def unmarshal_BatchCreateMailboxesResponse(data: Any) -> BatchCreateMailboxesResponse: if not isinstance(data, dict): raise TypeError( @@ -419,6 +420,31 @@ def unmarshal_GetDomainRecordsResponse(data: Any) -> GetDomainRecordsResponse: return GetDomainRecordsResponse(**args) +def unmarshal_ListAliasesResponse(data: Any) -> ListAliasesResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListAliasesResponse' 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"] = 0 + + field = data.get("aliases", None) + if field is not None: + args["aliases"] = ( + [unmarshal_Alias(v) for v in field] if field is not None else None + ) + else: + args["aliases"] = [] + + return ListAliasesResponse(**args) + + def unmarshal_ListDomainsResponse(data: Any) -> ListDomainsResponse: if not isinstance(data, dict): raise TypeError( @@ -514,6 +540,9 @@ def marshal_CreateAliasRequest( if request.local_part is not None: output["local_part"] = request.local_part + if request.mailbox_id is not None: + output["mailbox_id"] = request.mailbox_id + if request.description is not None: output["description"] = request.description diff --git a/scaleway-async/scaleway_async/mailbox/v1alpha1/types.py b/scaleway-async/scaleway_async/mailbox/v1alpha1/types.py index 69d944ae4..84b8b34bc 100644 --- a/scaleway-async/scaleway_async/mailbox/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/mailbox/v1alpha1/types.py @@ -68,6 +68,18 @@ def __str__(self) -> str: return str(self.value) +class ListAliasesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_DESC = "created_at_desc" + CREATED_AT_ASC = "created_at_asc" + UPDATED_AT_DESC = "updated_at_desc" + UPDATED_AT_ASC = "updated_at_asc" + NAME_DESC = "name_desc" + NAME_ASC = "name_asc" + + def __str__(self) -> str: + return str(self.value) + + class ListDomainsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): CREATED_AT_DESC = "created_at_desc" CREATED_AT_ASC = "created_at_asc" @@ -239,98 +251,98 @@ class DomainRecord: @dataclass -class Domain: +class Alias: id: str """ - Unique identifier of the domain. + Unique identifier of the alias. """ - project_id: str + email: str """ - ID of the Project to which the domain belongs. + Email address of the alias as local_part@domain. """ - name: str + mailbox_id: str """ - Fully qualified domain name. + ID of the mailbox to which the alias belongs. """ - status: DomainStatus + description: str """ - Status of the domain. + Description of the alias. """ - mailbox_total_count: int + status: AliasStatus """ - Number of mailboxes of the domain. + Current status of the alias. """ - webmail_url: str + created_at: Optional[datetime] = None """ - URL of the domain's webmail. + Date and time of alias creation. """ - imap_url: str + updated_at: Optional[datetime] = None """ - URL of the domain's IMAP service. + Date and time when the alias was last updated. """ - pop3_url: str + +@dataclass +class Domain: + id: str """ - URL of the domain's POP3 service. + Unique identifier of the domain. """ - smtp_url: str + project_id: str """ - URL of the domain's SMTP service. + ID of the Project to which the domain belongs. """ - created_at: Optional[datetime] = None + name: str """ - Date and time of domain creation. + Fully qualified domain name. """ - updated_at: Optional[datetime] = None + status: DomainStatus """ - Date and time of the domain's last update. + Status of the domain. """ - -@dataclass -class Alias: - id: str + mailbox_total_count: int """ - Unique identifier of the alias. + Number of mailboxes of the domain. """ - email: str + webmail_url: str """ - Email address of the alias as local_part@domain. + URL of the domain's webmail. """ - mailbox_id: str + imap_url: str """ - ID of the mailbox to which the alias belongs. + URL of the domain's IMAP service. """ - description: str + pop3_url: str """ - Description of the alias. + URL of the domain's POP3 service. """ - status: AliasStatus + smtp_url: str """ - Current status of the alias. + URL of the domain's SMTP service. """ created_at: Optional[datetime] = None """ - Date and time of alias creation. + Date and time of domain creation. """ updated_at: Optional[datetime] = None """ - Date and time when the alias was last updated. + Date and time of the domain's last update. """ @@ -395,6 +407,14 @@ class CreateDomainRequest: """ +@dataclass +class DeleteAliasRequest: + alias_id: str + """ + ID of the alias to delete. + """ + + @dataclass class DeleteDomainRequest: domain_id: str @@ -411,6 +431,14 @@ class DeleteMailboxRequest: """ +@dataclass +class GetAliasRequest: + alias_id: str + """ + ID of the alias to get. + """ + + @dataclass class GetDomainRecordsRequest: domain_id: str @@ -498,6 +526,54 @@ class GetMailboxRequest: """ +@dataclass +class ListAliasesRequest: + order_by: Optional[ListAliasesRequestOrderBy] = ( + ListAliasesRequestOrderBy.CREATED_AT_DESC + ) + """ + Order aliases by specific criteria. + """ + + page: Optional[int] = 0 + """ + Requested page number. Value must be greater or equal to 1. + """ + + page_size: Optional[int] = 0 + """ + Requested page size. Value must be between 1 and 100. + """ + + mailbox_id: Optional[str] = None + """ + ID of the mailbox for which to list aliases. + """ + + status: Optional[AliasStatus] = AliasStatus.UNKNOWN_STATUS + """ + (Optional) Filter aliases by their status. + """ + + project_id: Optional[str] = None + """ + Project ID to filter on. + """ + + +@dataclass +class ListAliasesResponse: + total_count: int + """ + Number of aliases that match the request (without pagination). + """ + + aliases: list[Alias] + """ + Single page of aliases matching the requested criteria. + """ + + @dataclass class ListDomainsRequest: order_by: Optional[ListDomainsRequestOrderBy] = None @@ -555,6 +631,11 @@ class ListMailboxesRequest: (Optional) Search term to filter mailboxes on name and local_part. """ + project_id: Optional[str] = None + """ + (Optional) Project ID to filter mailboxes on. + """ + @dataclass class ListMailboxesResponse: diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py index 7058d557b..25f5937ef 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py @@ -63,6 +63,7 @@ from .types import PublicCatalogProductPropertiesManagedRedisDatabase from .types import PublicCatalogProductPropertiesManagedRelationalDatabase from .types import PublicCatalogProductPropertiesObjectStorage +from .types import PublicCatalogProductPropertiesOpenSearch from .types import PublicCatalogProductPropertiesSecretManager from .types import PublicCatalogProductPropertiesServerlessContainers from .types import PublicCatalogProductPropertiesServerlessFunctions @@ -133,6 +134,7 @@ "PublicCatalogProductPropertiesManagedRedisDatabase", "PublicCatalogProductPropertiesManagedRelationalDatabase", "PublicCatalogProductPropertiesObjectStorage", + "PublicCatalogProductPropertiesOpenSearch", "PublicCatalogProductPropertiesSecretManager", "PublicCatalogProductPropertiesServerlessContainers", "PublicCatalogProductPropertiesServerlessFunctions", diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py index c683a3cd4..1c585beae 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py @@ -58,6 +58,7 @@ PublicCatalogProductPropertiesManagedRedisDatabase, PublicCatalogProductPropertiesManagedRelationalDatabase, PublicCatalogProductPropertiesObjectStorage, + PublicCatalogProductPropertiesOpenSearch, PublicCatalogProductPropertiesSecretManager, PublicCatalogProductPropertiesServerlessContainers, PublicCatalogProductPropertiesServerlessFunctions, @@ -1139,6 +1140,19 @@ def unmarshal_PublicCatalogProductPropertiesObjectStorage( return PublicCatalogProductPropertiesObjectStorage(**args) +def unmarshal_PublicCatalogProductPropertiesOpenSearch( + data: Any, +) -> PublicCatalogProductPropertiesOpenSearch: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesOpenSearch' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + return PublicCatalogProductPropertiesOpenSearch(**args) + + def unmarshal_PublicCatalogProductPropertiesSecretManager( data: Any, ) -> PublicCatalogProductPropertiesSecretManager: @@ -1428,6 +1442,12 @@ def unmarshal_PublicCatalogProductProperties( else: args["apache_kafka"] = None + field = data.get("open_search", None) + if field is not None: + args["open_search"] = unmarshal_PublicCatalogProductPropertiesOpenSearch(field) + else: + args["open_search"] = None + return PublicCatalogProductProperties(**args) diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py index 84aafcf61..99ae87c8d 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py @@ -38,6 +38,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe SERVERLESS_CONTAINERS = "serverless_containers" SERVERLESS_JOBS = "serverless_jobs" APACHE_KAFKA = "apache_kafka" + OPEN_SEARCH = "open_search" def __str__(self) -> str: return str(self.value) @@ -704,6 +705,11 @@ class PublicCatalogProductPropertiesObjectStorage: ] = None +@dataclass +class PublicCatalogProductPropertiesOpenSearch: + pass + + @dataclass class PublicCatalogProductPropertiesSecretManager: pass @@ -802,6 +808,8 @@ class PublicCatalogProductProperties: apache_kafka: Optional[PublicCatalogProductPropertiesApacheKafka] = None + open_search: Optional[PublicCatalogProductPropertiesOpenSearch] = None + @dataclass class PublicCatalogProductUnitOfMeasure: diff --git a/scaleway-async/scaleway_async/search/v1alpha1/types.py b/scaleway-async/scaleway_async/search/v1alpha1/types.py index c59b8af7b..c0eb0155e 100644 --- a/scaleway-async/scaleway_async/search/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/search/v1alpha1/types.py @@ -122,6 +122,7 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta): IAM_GROUP = "iam_group" IAM_POLICY = "iam_policy" SEDB_CLUSTER = "sedb_cluster" + AUTOSCALING_GROUP = "autoscaling_group" def __str__(self) -> str: return str(self.value) diff --git a/scaleway-async/scaleway_async/searchdb/v1alpha1/api.py b/scaleway-async/scaleway_async/searchdb/v1alpha1/api.py index ce4806834..0ef280013 100644 --- a/scaleway-async/scaleway_async/searchdb/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/searchdb/v1alpha1/api.py @@ -67,13 +67,13 @@ async def create_deployment( self, *, name: str, - node_amount: int, - node_count: int, node_type: str, version: str, region: Optional[ScwRegion] = None, project_id: Optional[str] = None, tags: Optional[list[str]] = None, + node_amount: Optional[int] = None, + node_count: Optional[int] = None, user_name: Optional[str] = None, password: Optional[str] = None, volume: Optional[Volume] = None, @@ -82,13 +82,13 @@ async def create_deployment( """ Create a new Cloud Essentials for OpenSearch deployment. :param name: Name of the deployment. - :param node_amount: DEPRECATED: Use node_count instead. Number of nodes. - :param node_count: Number of nodes. :param node_type: Node type. :param version: The Opensearch version to use. :param region: Region to target. If none is passed will use default region from the config. :param project_id: Project ID in which to create the deployment. :param tags: Tags. + :param node_amount: DEPRECATED: Use node_count instead. Number of nodes. + :param node_count: Number of nodes. :param user_name: Username for the deployment user. :param password: Password for the deployment user. :param volume: Volume. @@ -100,8 +100,6 @@ async def create_deployment( result = await api.create_deployment( name="example", - node_amount=1, - node_count=1, node_type="example", version="example", ) @@ -117,13 +115,13 @@ async def create_deployment( body=marshal_CreateDeploymentRequest( CreateDeploymentRequest( name=name, - node_amount=node_amount, - node_count=node_count, node_type=node_type, version=version, region=region, project_id=project_id, tags=tags, + node_amount=node_amount, + node_count=node_count, user_name=user_name, password=password, volume=volume, diff --git a/scaleway-async/scaleway_async/searchdb/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/searchdb/v1alpha1/marshalling.py index b86dc5620..fc8600257 100644 --- a/scaleway-async/scaleway_async/searchdb/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/searchdb/v1alpha1/marshalling.py @@ -599,12 +599,6 @@ def marshal_CreateDeploymentRequest( if request.name is not None: output["name"] = request.name - if request.node_amount is not None: - output["node_amount"] = request.node_amount - - if request.node_count is not None: - output["node_count"] = request.node_count - if request.node_type is not None: output["node_type"] = request.node_type @@ -619,6 +613,12 @@ def marshal_CreateDeploymentRequest( if request.tags is not None: output["tags"] = request.tags + if request.node_amount is not None: + output["node_amount"] = request.node_amount + + if request.node_count is not None: + output["node_count"] = request.node_count + if request.user_name is not None: output["user_name"] = request.user_name diff --git a/scaleway-async/scaleway_async/searchdb/v1alpha1/types.py b/scaleway-async/scaleway_async/searchdb/v1alpha1/types.py index d8802b4d5..c01281cb4 100644 --- a/scaleway-async/scaleway_async/searchdb/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/searchdb/v1alpha1/types.py @@ -353,16 +353,6 @@ class CreateDeploymentRequest: Name of the deployment. """ - node_amount: int - """ - DEPRECATED: Use node_count instead. Number of nodes. - """ - - node_count: int - """ - Number of nodes. - """ - node_type: str """ Node type. @@ -388,6 +378,16 @@ class CreateDeploymentRequest: Tags. """ + node_amount: Optional[int] = 0 + """ + DEPRECATED: Use node_count instead. Number of nodes. + """ + + node_count: Optional[int] = 0 + """ + Number of nodes. + """ + user_name: Optional[str] = None """ Username for the deployment user. diff --git a/scaleway-async/scaleway_async/vpc/v2/__init__.py b/scaleway-async/scaleway_async/vpc/v2/__init__.py index 7efd3eea0..41ef83f45 100644 --- a/scaleway-async/scaleway_async/vpc/v2/__init__.py +++ b/scaleway-async/scaleway_async/vpc/v2/__init__.py @@ -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 @@ -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 @@ -84,8 +80,6 @@ "ListSubnetOverlapsResponseSubnetOverlap", "VPCConnector", "VPC", - "AddSubnetsRequest", - "AddSubnetsResponse", "CreateIngressRuleRequest", "CreatePrivateNetworkRequest", "CreateRouteRequest", @@ -94,8 +88,6 @@ "DeleteIngressRuleRequest", "DeletePrivateNetworkRequest", "DeleteRouteRequest", - "DeleteSubnetsRequest", - "DeleteSubnetsResponse", "DeleteVPCConnectorRequest", "DeleteVPCRequest", "EnableCustomRoutesPropagationRequest", diff --git a/scaleway-async/scaleway_async/vpc/v2/api.py b/scaleway-async/scaleway_async/vpc/v2/api.py index d5f42c24e..8058b9ace 100644 --- a/scaleway-async/scaleway_async/vpc/v2/api.py +++ b/scaleway-async/scaleway_async/vpc/v2/api.py @@ -22,15 +22,11 @@ ListVPCsRequestOrderBy, VPCConnectorStatus, AclRule, - AddSubnetsRequest, - AddSubnetsResponse, CreateIngressRuleRequest, CreatePrivateNetworkRequest, CreateRouteRequest, CreateVPCConnectorRequest, CreateVPCRequest, - DeleteSubnetsRequest, - DeleteSubnetsResponse, GetAclResponse, IngressRule, ListIngressRulesResponse, @@ -59,8 +55,6 @@ unmarshal_IngressRule, unmarshal_VPCConnector, unmarshal_VPC, - unmarshal_AddSubnetsResponse, - unmarshal_DeleteSubnetsResponse, unmarshal_GetAclResponse, unmarshal_ListIngressRulesResponse, unmarshal_ListPrivateNetworksResponse, @@ -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, @@ -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 ` - - 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 ` - - 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, *, diff --git a/scaleway-async/scaleway_async/vpc/v2/marshalling.py b/scaleway-async/scaleway_async/vpc/v2/marshalling.py index 1a7d00818..c7c6c7cb1 100644 --- a/scaleway-async/scaleway_async/vpc/v2/marshalling.py +++ b/scaleway-async/scaleway_async/vpc/v2/marshalling.py @@ -15,8 +15,6 @@ VPCConnectorPeerInfo, VPCConnector, VPC, - AddSubnetsResponse, - DeleteSubnetsResponse, AclRule, GetAclResponse, ListIngressRulesResponse, @@ -27,13 +25,11 @@ ListVPCConnectorsResponse, ListVPCsResponse, SetAclResponse, - AddSubnetsRequest, CreateIngressRuleRequest, CreatePrivateNetworkRequest, CreateRouteRequest, CreateVPCConnectorRequest, CreateVPCRequest, - DeleteSubnetsRequest, SetAclRequest, UpdateIngressRuleRequest, UpdatePrivateNetworkRequest, @@ -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( @@ -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, @@ -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, diff --git a/scaleway-async/scaleway_async/vpc/v2/types.py b/scaleway-async/scaleway_async/vpc/v2/types.py index 1d070c6c4..55d615025 100644 --- a/scaleway-async/scaleway_async/vpc/v2/types.py +++ b/scaleway-async/scaleway_async/vpc/v2/types.py @@ -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 @@ -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 diff --git a/scaleway/scaleway/k8s/v1/marshalling.py b/scaleway/scaleway/k8s/v1/marshalling.py index 16dcd5b04..73026fd8b 100644 --- a/scaleway/scaleway/k8s/v1/marshalling.py +++ b/scaleway/scaleway/k8s/v1/marshalling.py @@ -838,18 +838,18 @@ def unmarshal_Pool(data: Any) -> Pool: else: args["startup_taints"] = [] - field = data.get("private_network_id", None) - if field is not None: - args["private_network_id"] = field - else: - args["private_network_id"] = None - field = data.get("region", None) if field is not None: args["region"] = field else: args["region"] = 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 Pool(**args) diff --git a/scaleway/scaleway/k8s/v1/types.py b/scaleway/scaleway/k8s/v1/types.py index ada47d10e..e50e09fae 100644 --- a/scaleway/scaleway/k8s/v1/types.py +++ b/scaleway/scaleway/k8s/v1/types.py @@ -1078,11 +1078,6 @@ class Pool: Kubernetes taints applied at node creation but not reconciled afterwards. """ - private_network_id: str - """ - Private network where the nodes are attached. Should be member of the same VPC as the API Server. - """ - region: ScwRegion """ Cluster region of the pool. @@ -1113,6 +1108,11 @@ class Pool: System volume disk size. """ + private_network_id: Optional[str] = None + """ + Private network where the nodes are attached. Should be member of the same VPC as the API Server. + """ + @dataclass class NodeMetadataCoreV1Taint: diff --git a/scaleway/scaleway/mailbox/v1alpha1/__init__.py b/scaleway/scaleway/mailbox/v1alpha1/__init__.py index b1035b544..730ab8101 100644 --- a/scaleway/scaleway/mailbox/v1alpha1/__init__.py +++ b/scaleway/scaleway/mailbox/v1alpha1/__init__.py @@ -8,6 +8,7 @@ from .content import DOMAIN_RECORD_TRANSIENT_STATUSES from .types import DomainStatus from .content import DOMAIN_TRANSIENT_STATUSES +from .types import ListAliasesRequestOrderBy from .types import ListDomainsRequestOrderBy from .types import ListMailboxesRequestOrderBy from .types import MailboxStatus @@ -16,18 +17,22 @@ from .types import BatchCreateMailboxesRequestMailboxParameters from .types import Mailbox from .types import DomainRecord -from .types import Domain from .types import Alias +from .types import Domain from .types import BatchCreateMailboxesRequest from .types import BatchCreateMailboxesResponse from .types import CreateAliasRequest from .types import CreateDomainRequest +from .types import DeleteAliasRequest from .types import DeleteDomainRequest from .types import DeleteMailboxRequest +from .types import GetAliasRequest from .types import GetDomainRecordsRequest from .types import GetDomainRecordsResponse from .types import GetDomainRequest from .types import GetMailboxRequest +from .types import ListAliasesRequest +from .types import ListAliasesResponse from .types import ListDomainsRequest from .types import ListDomainsResponse from .types import ListMailboxesRequest @@ -46,6 +51,7 @@ "DOMAIN_RECORD_TRANSIENT_STATUSES", "DomainStatus", "DOMAIN_TRANSIENT_STATUSES", + "ListAliasesRequestOrderBy", "ListDomainsRequestOrderBy", "ListMailboxesRequestOrderBy", "MailboxStatus", @@ -54,18 +60,22 @@ "BatchCreateMailboxesRequestMailboxParameters", "Mailbox", "DomainRecord", - "Domain", "Alias", + "Domain", "BatchCreateMailboxesRequest", "BatchCreateMailboxesResponse", "CreateAliasRequest", "CreateDomainRequest", + "DeleteAliasRequest", "DeleteDomainRequest", "DeleteMailboxRequest", + "GetAliasRequest", "GetDomainRecordsRequest", "GetDomainRecordsResponse", "GetDomainRequest", "GetMailboxRequest", + "ListAliasesRequest", + "ListAliasesResponse", "ListDomainsRequest", "ListDomainsResponse", "ListMailboxesRequest", diff --git a/scaleway/scaleway/mailbox/v1alpha1/api.py b/scaleway/scaleway/mailbox/v1alpha1/api.py index c0ddd00a4..6d2c4b48a 100644 --- a/scaleway/scaleway/mailbox/v1alpha1/api.py +++ b/scaleway/scaleway/mailbox/v1alpha1/api.py @@ -11,7 +11,9 @@ wait_for_resource, ) from .types import ( + AliasStatus, DomainStatus, + ListAliasesRequestOrderBy, ListDomainsRequestOrderBy, ListMailboxesRequestOrderBy, MailboxStatus, @@ -24,21 +26,24 @@ CreateDomainRequest, Domain, GetDomainRecordsResponse, + ListAliasesResponse, ListDomainsResponse, ListMailboxesResponse, Mailbox, UpdateMailboxRequest, ) from .content import ( + ALIAS_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, MAILBOX_TRANSIENT_STATUSES, ) from .marshalling import ( unmarshal_Mailbox, - unmarshal_Domain, unmarshal_Alias, + unmarshal_Domain, unmarshal_BatchCreateMailboxesResponse, unmarshal_GetDomainRecordsResponse, + unmarshal_ListAliasesResponse, unmarshal_ListDomainsResponse, unmarshal_ListMailboxesResponse, marshal_BatchCreateMailboxesRequest, @@ -364,6 +369,7 @@ def list_mailboxes( domain_id: Optional[str] = None, statuses: Optional[list[MailboxStatus]] = None, search: Optional[str] = None, + project_id: Optional[str] = None, ) -> ListMailboxesResponse: """ List mailboxes in an organization. @@ -374,6 +380,7 @@ def list_mailboxes( :param domain_id: (Optional) ID of the domain in which to list the mailboxes. :param statuses: (Optional) Filter mailboxes by their statuses. :param search: (Optional) Search term to filter mailboxes on name and local_part. + :param project_id: (Optional) Project ID to filter mailboxes on. :return: :class:`ListMailboxesResponse ` Usage: @@ -390,6 +397,7 @@ def list_mailboxes( "order_by": order_by, "page": page, "page_size": page_size or self.client.default_page_size, + "project_id": project_id or self.client.default_project_id, "search": search, "statuses": statuses, }, @@ -407,6 +415,7 @@ def list_mailboxes_all( domain_id: Optional[str] = None, statuses: Optional[list[MailboxStatus]] = None, search: Optional[str] = None, + project_id: Optional[str] = None, ) -> list[Mailbox]: """ List mailboxes in an organization. @@ -417,6 +426,7 @@ def list_mailboxes_all( :param domain_id: (Optional) ID of the domain in which to list the mailboxes. :param statuses: (Optional) Filter mailboxes by their statuses. :param search: (Optional) Search term to filter mailboxes on name and local_part. + :param project_id: (Optional) Project ID to filter mailboxes on. :return: :class:`list[Mailbox] ` Usage: @@ -436,6 +446,7 @@ def list_mailboxes_all( "domain_id": domain_id, "statuses": statuses, "search": search, + "project_id": project_id, }, ) @@ -620,11 +631,9 @@ def create_alias( ) """ - param_mailbox_id = validate_path_param("mailbox_id", mailbox_id) - res = self._request( "POST", - f"/mailbox/v1alpha1/mailboxes/{param_mailbox_id}/aliases", + "/mailbox/v1alpha1/aliases", body=marshal_CreateAliasRequest( CreateAliasRequest( local_part=local_part, @@ -637,3 +646,174 @@ def create_alias( self._throw_on_error(res) return unmarshal_Alias(res.json()) + + def list_aliases( + self, + *, + order_by: Optional[ListAliasesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + mailbox_id: Optional[str] = None, + status: Optional[AliasStatus] = None, + project_id: Optional[str] = None, + ) -> ListAliasesResponse: + """ + List aliases for a mailbox. + :param order_by: Order aliases by specific criteria. + :param page: Requested page number. Value must be greater or equal to 1. + :param page_size: Requested page size. Value must be between 1 and 100. + :param mailbox_id: ID of the mailbox for which to list aliases. + :param status: (Optional) Filter aliases by their status. + :param project_id: Project ID to filter on. + :return: :class:`ListAliasesResponse ` + + Usage: + :: + + result = api.list_aliases() + """ + + res = self._request( + "GET", + "/mailbox/v1alpha1/aliases", + params={ + "mailbox_id": mailbox_id, + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + "project_id": project_id or self.client.default_project_id, + "status": status, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListAliasesResponse(res.json()) + + def list_aliases_all( + self, + *, + order_by: Optional[ListAliasesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + mailbox_id: Optional[str] = None, + status: Optional[AliasStatus] = None, + project_id: Optional[str] = None, + ) -> list[Alias]: + """ + List aliases for a mailbox. + :param order_by: Order aliases by specific criteria. + :param page: Requested page number. Value must be greater or equal to 1. + :param page_size: Requested page size. Value must be between 1 and 100. + :param mailbox_id: ID of the mailbox for which to list aliases. + :param status: (Optional) Filter aliases by their status. + :param project_id: Project ID to filter on. + :return: :class:`list[Alias] ` + + Usage: + :: + + result = api.list_aliases_all() + """ + + return fetch_all_pages( + type=ListAliasesResponse, + key="aliases", + fetcher=self.list_aliases, + args={ + "order_by": order_by, + "page": page, + "page_size": page_size, + "mailbox_id": mailbox_id, + "status": status, + "project_id": project_id, + }, + ) + + def get_alias( + self, + *, + alias_id: str, + ) -> Alias: + """ + Get an alias by its ID. + :param alias_id: ID of the alias to get. + :return: :class:`Alias ` + + Usage: + :: + + result = api.get_alias( + alias_id="example", + ) + """ + + param_alias_id = validate_path_param("alias_id", alias_id) + + res = self._request( + "GET", + f"/mailbox/v1alpha1/aliases/{param_alias_id}", + ) + + self._throw_on_error(res) + return unmarshal_Alias(res.json()) + + def wait_for_alias( + self, + *, + alias_id: str, + options: Optional[WaitForOptions[Alias, bool]] = None, + ) -> Alias: + """ + Get an alias by its ID. + :param alias_id: ID of the alias to get. + :return: :class:`Alias ` + + Usage: + :: + + result = api.get_alias( + alias_id="example", + ) + """ + + if not options: + options = WaitForOptions() + + if not options.stop: + options.stop = lambda res: res.status not in ALIAS_TRANSIENT_STATUSES + + return wait_for_resource( + fetcher=self.get_alias, + options=options, + args={ + "alias_id": alias_id, + }, + ) + + def delete_alias( + self, + *, + alias_id: str, + ) -> Alias: + """ + Delete an alias by its ID. + :param alias_id: ID of the alias to delete. + :return: :class:`Alias ` + + Usage: + :: + + result = api.delete_alias( + alias_id="example", + ) + """ + + param_alias_id = validate_path_param("alias_id", alias_id) + + res = self._request( + "DELETE", + f"/mailbox/v1alpha1/aliases/{param_alias_id}", + ) + + self._throw_on_error(res) + return unmarshal_Alias(res.json()) diff --git a/scaleway/scaleway/mailbox/v1alpha1/marshalling.py b/scaleway/scaleway/mailbox/v1alpha1/marshalling.py index 5c1a0a325..fae8fd1af 100644 --- a/scaleway/scaleway/mailbox/v1alpha1/marshalling.py +++ b/scaleway/scaleway/mailbox/v1alpha1/marshalling.py @@ -14,11 +14,12 @@ MailboxStatus, MailboxSubscriptionPeriod, Mailbox, - Domain, Alias, + Domain, BatchCreateMailboxesResponse, DomainRecord, GetDomainRecordsResponse, + ListAliasesResponse, ListDomainsResponse, ListMailboxesResponse, BatchCreateMailboxesRequestMailboxParameters, @@ -116,6 +117,59 @@ def unmarshal_Mailbox(data: Any) -> Mailbox: return Mailbox(**args) +def unmarshal_Alias(data: Any) -> Alias: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Alias' 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"] = None + + field = data.get("email", None) + if field is not None: + args["email"] = field + else: + args["email"] = None + + field = data.get("mailbox_id", None) + if field is not None: + args["mailbox_id"] = field + else: + args["mailbox_id"] = None + + field = data.get("description", None) + if field is not None: + args["description"] = field + else: + args["description"] = None + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = AliasStatus.UNKNOWN_STATUS + + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("updated_at", None) + if field is not None: + args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["updated_at"] = None + + return Alias(**args) + + def unmarshal_Domain(data: Any) -> Domain: if not isinstance(data, dict): raise TypeError( @@ -193,59 +247,6 @@ def unmarshal_Domain(data: Any) -> Domain: return Domain(**args) -def unmarshal_Alias(data: Any) -> Alias: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Alias' 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"] = None - - field = data.get("email", None) - if field is not None: - args["email"] = field - else: - args["email"] = None - - field = data.get("mailbox_id", None) - if field is not None: - args["mailbox_id"] = field - else: - args["mailbox_id"] = None - - field = data.get("description", None) - if field is not None: - args["description"] = field - else: - args["description"] = None - - field = data.get("status", None) - if field is not None: - args["status"] = field - else: - args["status"] = AliasStatus.UNKNOWN_STATUS - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - return Alias(**args) - - def unmarshal_BatchCreateMailboxesResponse(data: Any) -> BatchCreateMailboxesResponse: if not isinstance(data, dict): raise TypeError( @@ -419,6 +420,31 @@ def unmarshal_GetDomainRecordsResponse(data: Any) -> GetDomainRecordsResponse: return GetDomainRecordsResponse(**args) +def unmarshal_ListAliasesResponse(data: Any) -> ListAliasesResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListAliasesResponse' 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"] = 0 + + field = data.get("aliases", None) + if field is not None: + args["aliases"] = ( + [unmarshal_Alias(v) for v in field] if field is not None else None + ) + else: + args["aliases"] = [] + + return ListAliasesResponse(**args) + + def unmarshal_ListDomainsResponse(data: Any) -> ListDomainsResponse: if not isinstance(data, dict): raise TypeError( @@ -514,6 +540,9 @@ def marshal_CreateAliasRequest( if request.local_part is not None: output["local_part"] = request.local_part + if request.mailbox_id is not None: + output["mailbox_id"] = request.mailbox_id + if request.description is not None: output["description"] = request.description diff --git a/scaleway/scaleway/mailbox/v1alpha1/types.py b/scaleway/scaleway/mailbox/v1alpha1/types.py index 69d944ae4..84b8b34bc 100644 --- a/scaleway/scaleway/mailbox/v1alpha1/types.py +++ b/scaleway/scaleway/mailbox/v1alpha1/types.py @@ -68,6 +68,18 @@ def __str__(self) -> str: return str(self.value) +class ListAliasesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_DESC = "created_at_desc" + CREATED_AT_ASC = "created_at_asc" + UPDATED_AT_DESC = "updated_at_desc" + UPDATED_AT_ASC = "updated_at_asc" + NAME_DESC = "name_desc" + NAME_ASC = "name_asc" + + def __str__(self) -> str: + return str(self.value) + + class ListDomainsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): CREATED_AT_DESC = "created_at_desc" CREATED_AT_ASC = "created_at_asc" @@ -239,98 +251,98 @@ class DomainRecord: @dataclass -class Domain: +class Alias: id: str """ - Unique identifier of the domain. + Unique identifier of the alias. """ - project_id: str + email: str """ - ID of the Project to which the domain belongs. + Email address of the alias as local_part@domain. """ - name: str + mailbox_id: str """ - Fully qualified domain name. + ID of the mailbox to which the alias belongs. """ - status: DomainStatus + description: str """ - Status of the domain. + Description of the alias. """ - mailbox_total_count: int + status: AliasStatus """ - Number of mailboxes of the domain. + Current status of the alias. """ - webmail_url: str + created_at: Optional[datetime] = None """ - URL of the domain's webmail. + Date and time of alias creation. """ - imap_url: str + updated_at: Optional[datetime] = None """ - URL of the domain's IMAP service. + Date and time when the alias was last updated. """ - pop3_url: str + +@dataclass +class Domain: + id: str """ - URL of the domain's POP3 service. + Unique identifier of the domain. """ - smtp_url: str + project_id: str """ - URL of the domain's SMTP service. + ID of the Project to which the domain belongs. """ - created_at: Optional[datetime] = None + name: str """ - Date and time of domain creation. + Fully qualified domain name. """ - updated_at: Optional[datetime] = None + status: DomainStatus """ - Date and time of the domain's last update. + Status of the domain. """ - -@dataclass -class Alias: - id: str + mailbox_total_count: int """ - Unique identifier of the alias. + Number of mailboxes of the domain. """ - email: str + webmail_url: str """ - Email address of the alias as local_part@domain. + URL of the domain's webmail. """ - mailbox_id: str + imap_url: str """ - ID of the mailbox to which the alias belongs. + URL of the domain's IMAP service. """ - description: str + pop3_url: str """ - Description of the alias. + URL of the domain's POP3 service. """ - status: AliasStatus + smtp_url: str """ - Current status of the alias. + URL of the domain's SMTP service. """ created_at: Optional[datetime] = None """ - Date and time of alias creation. + Date and time of domain creation. """ updated_at: Optional[datetime] = None """ - Date and time when the alias was last updated. + Date and time of the domain's last update. """ @@ -395,6 +407,14 @@ class CreateDomainRequest: """ +@dataclass +class DeleteAliasRequest: + alias_id: str + """ + ID of the alias to delete. + """ + + @dataclass class DeleteDomainRequest: domain_id: str @@ -411,6 +431,14 @@ class DeleteMailboxRequest: """ +@dataclass +class GetAliasRequest: + alias_id: str + """ + ID of the alias to get. + """ + + @dataclass class GetDomainRecordsRequest: domain_id: str @@ -498,6 +526,54 @@ class GetMailboxRequest: """ +@dataclass +class ListAliasesRequest: + order_by: Optional[ListAliasesRequestOrderBy] = ( + ListAliasesRequestOrderBy.CREATED_AT_DESC + ) + """ + Order aliases by specific criteria. + """ + + page: Optional[int] = 0 + """ + Requested page number. Value must be greater or equal to 1. + """ + + page_size: Optional[int] = 0 + """ + Requested page size. Value must be between 1 and 100. + """ + + mailbox_id: Optional[str] = None + """ + ID of the mailbox for which to list aliases. + """ + + status: Optional[AliasStatus] = AliasStatus.UNKNOWN_STATUS + """ + (Optional) Filter aliases by their status. + """ + + project_id: Optional[str] = None + """ + Project ID to filter on. + """ + + +@dataclass +class ListAliasesResponse: + total_count: int + """ + Number of aliases that match the request (without pagination). + """ + + aliases: list[Alias] + """ + Single page of aliases matching the requested criteria. + """ + + @dataclass class ListDomainsRequest: order_by: Optional[ListDomainsRequestOrderBy] = None @@ -555,6 +631,11 @@ class ListMailboxesRequest: (Optional) Search term to filter mailboxes on name and local_part. """ + project_id: Optional[str] = None + """ + (Optional) Project ID to filter mailboxes on. + """ + @dataclass class ListMailboxesResponse: diff --git a/scaleway/scaleway/product_catalog/v2alpha1/__init__.py b/scaleway/scaleway/product_catalog/v2alpha1/__init__.py index 7058d557b..25f5937ef 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/__init__.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/__init__.py @@ -63,6 +63,7 @@ from .types import PublicCatalogProductPropertiesManagedRedisDatabase from .types import PublicCatalogProductPropertiesManagedRelationalDatabase from .types import PublicCatalogProductPropertiesObjectStorage +from .types import PublicCatalogProductPropertiesOpenSearch from .types import PublicCatalogProductPropertiesSecretManager from .types import PublicCatalogProductPropertiesServerlessContainers from .types import PublicCatalogProductPropertiesServerlessFunctions @@ -133,6 +134,7 @@ "PublicCatalogProductPropertiesManagedRedisDatabase", "PublicCatalogProductPropertiesManagedRelationalDatabase", "PublicCatalogProductPropertiesObjectStorage", + "PublicCatalogProductPropertiesOpenSearch", "PublicCatalogProductPropertiesSecretManager", "PublicCatalogProductPropertiesServerlessContainers", "PublicCatalogProductPropertiesServerlessFunctions", diff --git a/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py b/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py index c683a3cd4..1c585beae 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py @@ -58,6 +58,7 @@ PublicCatalogProductPropertiesManagedRedisDatabase, PublicCatalogProductPropertiesManagedRelationalDatabase, PublicCatalogProductPropertiesObjectStorage, + PublicCatalogProductPropertiesOpenSearch, PublicCatalogProductPropertiesSecretManager, PublicCatalogProductPropertiesServerlessContainers, PublicCatalogProductPropertiesServerlessFunctions, @@ -1139,6 +1140,19 @@ def unmarshal_PublicCatalogProductPropertiesObjectStorage( return PublicCatalogProductPropertiesObjectStorage(**args) +def unmarshal_PublicCatalogProductPropertiesOpenSearch( + data: Any, +) -> PublicCatalogProductPropertiesOpenSearch: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesOpenSearch' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + return PublicCatalogProductPropertiesOpenSearch(**args) + + def unmarshal_PublicCatalogProductPropertiesSecretManager( data: Any, ) -> PublicCatalogProductPropertiesSecretManager: @@ -1428,6 +1442,12 @@ def unmarshal_PublicCatalogProductProperties( else: args["apache_kafka"] = None + field = data.get("open_search", None) + if field is not None: + args["open_search"] = unmarshal_PublicCatalogProductPropertiesOpenSearch(field) + else: + args["open_search"] = None + return PublicCatalogProductProperties(**args) diff --git a/scaleway/scaleway/product_catalog/v2alpha1/types.py b/scaleway/scaleway/product_catalog/v2alpha1/types.py index 84aafcf61..99ae87c8d 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/types.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/types.py @@ -38,6 +38,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe SERVERLESS_CONTAINERS = "serverless_containers" SERVERLESS_JOBS = "serverless_jobs" APACHE_KAFKA = "apache_kafka" + OPEN_SEARCH = "open_search" def __str__(self) -> str: return str(self.value) @@ -704,6 +705,11 @@ class PublicCatalogProductPropertiesObjectStorage: ] = None +@dataclass +class PublicCatalogProductPropertiesOpenSearch: + pass + + @dataclass class PublicCatalogProductPropertiesSecretManager: pass @@ -802,6 +808,8 @@ class PublicCatalogProductProperties: apache_kafka: Optional[PublicCatalogProductPropertiesApacheKafka] = None + open_search: Optional[PublicCatalogProductPropertiesOpenSearch] = None + @dataclass class PublicCatalogProductUnitOfMeasure: diff --git a/scaleway/scaleway/search/v1alpha1/types.py b/scaleway/scaleway/search/v1alpha1/types.py index c59b8af7b..c0eb0155e 100644 --- a/scaleway/scaleway/search/v1alpha1/types.py +++ b/scaleway/scaleway/search/v1alpha1/types.py @@ -122,6 +122,7 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta): IAM_GROUP = "iam_group" IAM_POLICY = "iam_policy" SEDB_CLUSTER = "sedb_cluster" + AUTOSCALING_GROUP = "autoscaling_group" def __str__(self) -> str: return str(self.value) diff --git a/scaleway/scaleway/searchdb/v1alpha1/api.py b/scaleway/scaleway/searchdb/v1alpha1/api.py index 513cbdf83..d6cacd54d 100644 --- a/scaleway/scaleway/searchdb/v1alpha1/api.py +++ b/scaleway/scaleway/searchdb/v1alpha1/api.py @@ -67,13 +67,13 @@ def create_deployment( self, *, name: str, - node_amount: int, - node_count: int, node_type: str, version: str, region: Optional[ScwRegion] = None, project_id: Optional[str] = None, tags: Optional[list[str]] = None, + node_amount: Optional[int] = None, + node_count: Optional[int] = None, user_name: Optional[str] = None, password: Optional[str] = None, volume: Optional[Volume] = None, @@ -82,13 +82,13 @@ def create_deployment( """ Create a new Cloud Essentials for OpenSearch deployment. :param name: Name of the deployment. - :param node_amount: DEPRECATED: Use node_count instead. Number of nodes. - :param node_count: Number of nodes. :param node_type: Node type. :param version: The Opensearch version to use. :param region: Region to target. If none is passed will use default region from the config. :param project_id: Project ID in which to create the deployment. :param tags: Tags. + :param node_amount: DEPRECATED: Use node_count instead. Number of nodes. + :param node_count: Number of nodes. :param user_name: Username for the deployment user. :param password: Password for the deployment user. :param volume: Volume. @@ -100,8 +100,6 @@ def create_deployment( result = api.create_deployment( name="example", - node_amount=1, - node_count=1, node_type="example", version="example", ) @@ -117,13 +115,13 @@ def create_deployment( body=marshal_CreateDeploymentRequest( CreateDeploymentRequest( name=name, - node_amount=node_amount, - node_count=node_count, node_type=node_type, version=version, region=region, project_id=project_id, tags=tags, + node_amount=node_amount, + node_count=node_count, user_name=user_name, password=password, volume=volume, diff --git a/scaleway/scaleway/searchdb/v1alpha1/marshalling.py b/scaleway/scaleway/searchdb/v1alpha1/marshalling.py index b86dc5620..fc8600257 100644 --- a/scaleway/scaleway/searchdb/v1alpha1/marshalling.py +++ b/scaleway/scaleway/searchdb/v1alpha1/marshalling.py @@ -599,12 +599,6 @@ def marshal_CreateDeploymentRequest( if request.name is not None: output["name"] = request.name - if request.node_amount is not None: - output["node_amount"] = request.node_amount - - if request.node_count is not None: - output["node_count"] = request.node_count - if request.node_type is not None: output["node_type"] = request.node_type @@ -619,6 +613,12 @@ def marshal_CreateDeploymentRequest( if request.tags is not None: output["tags"] = request.tags + if request.node_amount is not None: + output["node_amount"] = request.node_amount + + if request.node_count is not None: + output["node_count"] = request.node_count + if request.user_name is not None: output["user_name"] = request.user_name diff --git a/scaleway/scaleway/searchdb/v1alpha1/types.py b/scaleway/scaleway/searchdb/v1alpha1/types.py index d8802b4d5..c01281cb4 100644 --- a/scaleway/scaleway/searchdb/v1alpha1/types.py +++ b/scaleway/scaleway/searchdb/v1alpha1/types.py @@ -353,16 +353,6 @@ class CreateDeploymentRequest: Name of the deployment. """ - node_amount: int - """ - DEPRECATED: Use node_count instead. Number of nodes. - """ - - node_count: int - """ - Number of nodes. - """ - node_type: str """ Node type. @@ -388,6 +378,16 @@ class CreateDeploymentRequest: Tags. """ + node_amount: Optional[int] = 0 + """ + DEPRECATED: Use node_count instead. Number of nodes. + """ + + node_count: Optional[int] = 0 + """ + Number of nodes. + """ + user_name: Optional[str] = None """ Username for the deployment user. diff --git a/scaleway/scaleway/vpc/v2/__init__.py b/scaleway/scaleway/vpc/v2/__init__.py index 7efd3eea0..41ef83f45 100644 --- a/scaleway/scaleway/vpc/v2/__init__.py +++ b/scaleway/scaleway/vpc/v2/__init__.py @@ -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 @@ -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 @@ -84,8 +80,6 @@ "ListSubnetOverlapsResponseSubnetOverlap", "VPCConnector", "VPC", - "AddSubnetsRequest", - "AddSubnetsResponse", "CreateIngressRuleRequest", "CreatePrivateNetworkRequest", "CreateRouteRequest", @@ -94,8 +88,6 @@ "DeleteIngressRuleRequest", "DeletePrivateNetworkRequest", "DeleteRouteRequest", - "DeleteSubnetsRequest", - "DeleteSubnetsResponse", "DeleteVPCConnectorRequest", "DeleteVPCRequest", "EnableCustomRoutesPropagationRequest", diff --git a/scaleway/scaleway/vpc/v2/api.py b/scaleway/scaleway/vpc/v2/api.py index 8af7bedbb..ce72f5063 100644 --- a/scaleway/scaleway/vpc/v2/api.py +++ b/scaleway/scaleway/vpc/v2/api.py @@ -22,15 +22,11 @@ ListVPCsRequestOrderBy, VPCConnectorStatus, AclRule, - AddSubnetsRequest, - AddSubnetsResponse, CreateIngressRuleRequest, CreatePrivateNetworkRequest, CreateRouteRequest, CreateVPCConnectorRequest, CreateVPCRequest, - DeleteSubnetsRequest, - DeleteSubnetsResponse, GetAclResponse, IngressRule, ListIngressRulesResponse, @@ -59,8 +55,6 @@ unmarshal_IngressRule, unmarshal_VPCConnector, unmarshal_VPC, - unmarshal_AddSubnetsResponse, - unmarshal_DeleteSubnetsResponse, unmarshal_GetAclResponse, unmarshal_ListIngressRulesResponse, unmarshal_ListPrivateNetworksResponse, @@ -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, @@ -870,98 +862,6 @@ def list_subnets_all( }, ) - 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 ` - - Usage: - :: - - result = 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()) - - 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 ` - - Usage: - :: - - result = 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()) - def create_route( self, *, diff --git a/scaleway/scaleway/vpc/v2/marshalling.py b/scaleway/scaleway/vpc/v2/marshalling.py index 1a7d00818..c7c6c7cb1 100644 --- a/scaleway/scaleway/vpc/v2/marshalling.py +++ b/scaleway/scaleway/vpc/v2/marshalling.py @@ -15,8 +15,6 @@ VPCConnectorPeerInfo, VPCConnector, VPC, - AddSubnetsResponse, - DeleteSubnetsResponse, AclRule, GetAclResponse, ListIngressRulesResponse, @@ -27,13 +25,11 @@ ListVPCConnectorsResponse, ListVPCsResponse, SetAclResponse, - AddSubnetsRequest, CreateIngressRuleRequest, CreatePrivateNetworkRequest, CreateRouteRequest, CreateVPCConnectorRequest, CreateVPCRequest, - DeleteSubnetsRequest, SetAclRequest, UpdateIngressRuleRequest, UpdatePrivateNetworkRequest, @@ -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( @@ -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, @@ -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, diff --git a/scaleway/scaleway/vpc/v2/types.py b/scaleway/scaleway/vpc/v2/types.py index 1d070c6c4..55d615025 100644 --- a/scaleway/scaleway/vpc/v2/types.py +++ b/scaleway/scaleway/vpc/v2/types.py @@ -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 @@ -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