From faf45577628d466132adca3476c778886d40aa6c Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Fri, 1 Aug 2025 14:13:09 +0000 Subject: [PATCH] feat: update generated APIs --- .../scaleway_async/webhosting/v1/__init__.py | 8 +- .../scaleway_async/webhosting/v1/api.py | 9 + .../webhosting/v1/marshalling.py | 147 +++++++++++---- .../scaleway_async/webhosting/v1/types.py | 168 ++++++++++++------ scaleway/scaleway/webhosting/v1/__init__.py | 8 +- scaleway/scaleway/webhosting/v1/api.py | 9 + .../scaleway/webhosting/v1/marshalling.py | 147 +++++++++++---- scaleway/scaleway/webhosting/v1/types.py | 168 ++++++++++++------ 8 files changed, 484 insertions(+), 180 deletions(-) diff --git a/scaleway-async/scaleway_async/webhosting/v1/__init__.py b/scaleway-async/scaleway_async/webhosting/v1/__init__.py index 43df2e816..325d01061 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/__init__.py +++ b/scaleway-async/scaleway_async/webhosting/v1/__init__.py @@ -24,11 +24,13 @@ from .types import OfferOptionName from .types import OfferOptionWarning from .types import PlatformPlatformGroup +from .types import AutoConfigDomainDns from .types import PlatformControlPanelUrls +from .types import HostingDomainCustomDomain from .types import OfferOption from .types import PlatformControlPanel +from .types import HostingDomain from .types import CreateDatabaseRequestUser -from .types import AutoConfigDomainDns from .types import CreateHostingRequestDomainConfiguration from .types import OfferOptionRequest from .types import SyncDomainDnsRecordsRequestRecord @@ -130,11 +132,13 @@ "OfferOptionName", "OfferOptionWarning", "PlatformPlatformGroup", + "AutoConfigDomainDns", "PlatformControlPanelUrls", + "HostingDomainCustomDomain", "OfferOption", "PlatformControlPanel", + "HostingDomain", "CreateDatabaseRequestUser", - "AutoConfigDomainDns", "CreateHostingRequestDomainConfiguration", "OfferOptionRequest", "SyncDomainDnsRecordsRequestRecord", diff --git a/scaleway-async/scaleway_async/webhosting/v1/api.py b/scaleway-async/scaleway_async/webhosting/v1/api.py index 0988b7377..212b454c9 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/api.py +++ b/scaleway-async/scaleway_async/webhosting/v1/api.py @@ -1112,6 +1112,7 @@ async def create_hosting( region: Optional[ScwRegion] = None, project_id: Optional[str] = None, tags: Optional[List[str]] = None, + subdomain: Optional[str] = None, offer_options: Optional[List[OfferOptionRequest]] = None, language: Optional[StdLanguageCode] = None, domain_configuration: Optional[CreateHostingRequestDomainConfiguration] = None, @@ -1127,6 +1128,7 @@ async def create_hosting( :param region: Region to target. If none is passed will use default region from the config. :param project_id: ID of the Scaleway Project in which to create the Web Hosting plan. :param tags: List of tags for the Web Hosting plan. + :param subdomain: The name prefix to use as a free subdomain (for example, `mysite`) assigned to the Web Hosting plan. The full domain will be automatically created by adding it to the fixed base domain (e.g. `mysite.scw.site`). You do not need to include the base domain yourself. :param offer_options: List of the Web Hosting plan options IDs with their quantities. :param language: Default language for the control panel interface. :param domain_configuration: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_config_domain_dns instead). @@ -1159,6 +1161,7 @@ async def create_hosting( region=region, project_id=project_id, tags=tags, + subdomain=subdomain, offer_options=offer_options, language=language, domain_configuration=domain_configuration, @@ -1185,6 +1188,7 @@ async def list_hostings( project_id: Optional[str] = None, organization_id: Optional[str] = None, control_panels: Optional[List[str]] = None, + subdomain: Optional[str] = None, ) -> ListHostingsResponse: """ List all Web Hosting plans. @@ -1199,6 +1203,7 @@ async def list_hostings( :param project_id: Project ID to filter for, only Web Hosting plans from this Project will be returned. :param organization_id: Organization ID to filter for, only Web Hosting plans from this Organization will be returned. :param control_panels: Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned. + :param subdomain: Optional free subdomain linked to the Web Hosting plan. :return: :class:`ListHostingsResponse ` Usage: @@ -1224,6 +1229,7 @@ async def list_hostings( "page_size": page_size or self.client.default_page_size, "project_id": project_id or self.client.default_project_id, "statuses": statuses, + "subdomain": subdomain, "tags": tags, }, ) @@ -1244,6 +1250,7 @@ async def list_hostings_all( project_id: Optional[str] = None, organization_id: Optional[str] = None, control_panels: Optional[List[str]] = None, + subdomain: Optional[str] = None, ) -> List[HostingSummary]: """ List all Web Hosting plans. @@ -1258,6 +1265,7 @@ async def list_hostings_all( :param project_id: Project ID to filter for, only Web Hosting plans from this Project will be returned. :param organization_id: Organization ID to filter for, only Web Hosting plans from this Organization will be returned. :param control_panels: Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned. + :param subdomain: Optional free subdomain linked to the Web Hosting plan. :return: :class:`List[HostingSummary] ` Usage: @@ -1281,6 +1289,7 @@ async def list_hostings_all( "project_id": project_id, "organization_id": organization_id, "control_panels": control_panels, + "subdomain": subdomain, }, ) diff --git a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py index 901528da9..3825815ee 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py +++ b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py @@ -27,8 +27,10 @@ DnsRecords, Domain, PlatformControlPanelUrls, + HostingDomainCustomDomain, OfferOption, PlatformControlPanel, + HostingDomain, HostingUser, Offer, Platform, @@ -366,6 +368,35 @@ def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls: return PlatformControlPanelUrls(**args) +def unmarshal_HostingDomainCustomDomain(data: Any) -> HostingDomainCustomDomain: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'HostingDomainCustomDomain' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("domain", None) + if field is not None: + args["domain"] = field + + field = data.get("domain_status", None) + if field is not None: + args["domain_status"] = field + + field = data.get("dns_status", None) + if field is not None: + args["dns_status"] = field + + field = data.get("auto_config_domain_dns", None) + if field is not None: + args["auto_config_domain_dns"] = unmarshal_AutoConfigDomainDns(field) + else: + args["auto_config_domain_dns"] = None + + return HostingDomainCustomDomain(**args) + + def unmarshal_OfferOption(data: Any) -> OfferOption: if not isinstance(data, dict): raise TypeError( @@ -432,6 +463,27 @@ def unmarshal_PlatformControlPanel(data: Any) -> PlatformControlPanel: return PlatformControlPanel(**args) +def unmarshal_HostingDomain(data: Any) -> HostingDomain: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'HostingDomain' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("subdomain", None) + if field is not None: + args["subdomain"] = field + + field = data.get("custom_domain", None) + if field is not None: + args["custom_domain"] = unmarshal_HostingDomainCustomDomain(field) + else: + args["custom_domain"] = None + + return HostingDomain(**args) + + def unmarshal_HostingUser(data: Any) -> HostingUser: if not isinstance(data, dict): raise TypeError( @@ -571,18 +623,6 @@ def unmarshal_Hosting(data: Any) -> Hosting: if field is not None: args["status"] = field - field = data.get("domain", None) - if field is not None: - args["domain"] = field - - field = data.get("tags", None) - if field is not None: - args["tags"] = field - - field = data.get("ipv4", None) - if field is not None: - args["ipv4"] = field - field = data.get("updated_at", None) if field is not None: args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -595,17 +635,11 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["created_at"] = None - field = data.get("protected", None) - if field is not None: - args["protected"] = field - - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - - field = data.get("region", None) + field = data.get("domain", None) if field is not None: - args["region"] = field + args["domain"] = field + else: + args["domain"] = None field = data.get("offer", None) if field is not None: @@ -619,6 +653,22 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["platform"] = None + field = data.get("tags", None) + if field is not None: + args["tags"] = field + + field = data.get("ipv4", None) + if field is not None: + args["ipv4"] = field + + field = data.get("protected", None) + if field is not None: + args["protected"] = field + + field = data.get("region", None) + if field is not None: + args["region"] = field + field = data.get("dns_status", None) if field is not None: args["dns_status"] = field @@ -631,6 +681,18 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["user"] = None + field = data.get("domain_status", None) + if field is not None: + args["domain_status"] = field + else: + args["domain_status"] = None + + field = data.get("domain_info", None) + if field is not None: + args["domain_info"] = unmarshal_HostingDomain(field) + else: + args["domain_info"] = None + return Hosting(**args) @@ -767,10 +829,6 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: if field is not None: args["status"] = field - field = data.get("domain", None) - if field is not None: - args["domain"] = field - field = data.get("protected", None) if field is not None: args["protected"] = field @@ -779,10 +837,6 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: if field is not None: args["offer_name"] = field - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - field = data.get("region", None) if field is not None: args["region"] = field @@ -799,12 +853,30 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: else: args["updated_at"] = None + field = data.get("domain", None) + if field is not None: + args["domain"] = field + else: + args["domain"] = None + field = data.get("dns_status", None) if field is not None: args["dns_status"] = field else: args["dns_status"] = None + field = data.get("domain_status", None) + if field is not None: + args["domain_status"] = field + else: + args["domain_status"] = None + + field = data.get("domain_info", None) + if field is not None: + args["domain_info"] = unmarshal_HostingDomain(field) + else: + args["domain_info"] = None + return HostingSummary(**args) @@ -1083,8 +1155,16 @@ def marshal_DatabaseApiCreateDatabaseRequest( output.update( resolve_one_of( [ - OneOfPossibility("new_user", request.new_user), - OneOfPossibility("existing_username", request.existing_username), + OneOfPossibility( + param="new_user", + value=request.new_user, + marshal_func=marshal_CreateDatabaseRequestUser, + ), + OneOfPossibility( + param="existing_username", + value=request.existing_username, + marshal_func=None, + ), ] ), ) @@ -1292,6 +1372,9 @@ def marshal_HostingApiCreateHostingRequest( if request.tags is not None: output["tags"] = request.tags + if request.subdomain is not None: + output["subdomain"] = request.subdomain + if request.offer_options is not None: output["offer_options"] = [ marshal_OfferOptionRequest(item, defaults) for item in request.offer_options diff --git a/scaleway-async/scaleway_async/webhosting/v1/types.py b/scaleway-async/scaleway_async/webhosting/v1/types.py index 9d80eb681..13e8ef91e 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/types.py +++ b/scaleway-async/scaleway_async/webhosting/v1/types.py @@ -232,6 +232,34 @@ def __str__(self) -> str: return str(self.value) +@dataclass +class AutoConfigDomainDns: + nameservers: bool + """ + Whether or not to synchronize domain nameservers. + """ + + web_records: bool + """ + Whether or not to synchronize web records. + """ + + mail_records: bool + """ + Whether or not to synchronize mail records. + """ + + all_records: bool + """ + Whether or not to synchronize all types of records. Takes priority over the other fields. + """ + + none: bool + """ + No automatic domain configuration. Users must configure their domain for the Web Hosting to work. + """ + + @dataclass class PlatformControlPanelUrls: dashboard: str @@ -245,6 +273,29 @@ class PlatformControlPanelUrls: """ +@dataclass +class HostingDomainCustomDomain: + domain: str + """ + Custom domain linked to the hosting plan. + """ + + domain_status: DomainStatus + """ + Status of the custom domain verification. + """ + + dns_status: DnsRecordsStatus + """ + Status of the DNS configuration for the custom domain. + """ + + auto_config_domain_dns: Optional[AutoConfigDomainDns] + """ + Indicates whether to auto-configure DNS for this domain. + """ + + @dataclass class OfferOption: id: str @@ -302,38 +353,23 @@ class PlatformControlPanel: @dataclass -class CreateDatabaseRequestUser: - username: str - - password: str - - -@dataclass -class AutoConfigDomainDns: - nameservers: bool +class HostingDomain: + subdomain: str """ - Whether or not to synchronize domain nameservers. + Optional free subdomain linked to the Web Hosting plan. """ - web_records: bool + custom_domain: Optional[HostingDomainCustomDomain] """ - Whether or not to synchronize web records. + Optional custom domain linked to the Web Hosting plan. """ - mail_records: bool - """ - Whether or not to synchronize mail records. - """ - all_records: bool - """ - Whether or not to synchronize all types of records. Takes priority over the other fields. - """ +@dataclass +class CreateDatabaseRequestUser: + username: str - none: bool - """ - No automatic domain configuration. Users must configure their domain for the Web Hosting to work. - """ + password: str @dataclass @@ -606,11 +642,6 @@ class HostingSummary: Status of the Web Hosting plan. """ - domain: str - """ - Main domain associated with the Web Hosting plan. - """ - protected: bool """ Whether the hosting is protected or not. @@ -621,11 +652,6 @@ class HostingSummary: Name of the active offer for the Web Hosting plan. """ - domain_status: DomainStatus - """ - Main domain status of the Web Hosting plan. - """ - region: ScwRegion """ Region where the Web Hosting plan is hosted. @@ -641,11 +667,26 @@ class HostingSummary: Date on which the Web Hosting plan was last updated. """ + domain: Optional[str] + """ + Main domain associated with the Web Hosting plan (deprecated, use domain_info). + """ + dns_status: Optional[DnsRecordsStatus] """ DNS status of the Web Hosting plan. """ + domain_status: Optional[DomainStatus] + """ + Main domain status of the Web Hosting plan. + """ + + domain_info: Optional[HostingDomain] + """ + Domain configuration block (subdomain, optional custom domain, and DNS settings). + """ + @dataclass class MailAccount: @@ -1274,39 +1315,44 @@ class Hosting: Status of the Web Hosting plan. """ - domain: str + updated_at: Optional[datetime] """ - Main domain associated with the Web Hosting plan. + Date on which the Web Hosting plan was last updated. """ - tags: List[str] + created_at: Optional[datetime] """ - List of tags associated with the Web Hosting plan. + Date on which the Web Hosting plan was created. """ - ipv4: str + domain: Optional[str] """ - Current IPv4 address of the hosting. + Main domain associated with the Web Hosting plan (deprecated, use domain_info). """ - updated_at: Optional[datetime] + offer: Optional[Offer] """ - Date on which the Web Hosting plan was last updated. + Details of the Web Hosting plan offer and options. """ - created_at: Optional[datetime] + platform: Optional[Platform] """ - Date on which the Web Hosting plan was created. + Details of the hosting platform. """ - protected: bool + tags: List[str] """ - Whether the hosting is protected or not. + List of tags associated with the Web Hosting plan. """ - domain_status: DomainStatus + ipv4: str """ - Main domain status of the Web Hosting plan. + Current IPv4 address of the hosting. + """ + + protected: bool + """ + Whether the hosting is protected or not. """ region: ScwRegion @@ -1314,24 +1360,24 @@ class Hosting: Region where the Web Hosting plan is hosted. """ - offer: Optional[Offer] + dns_status: Optional[DnsRecordsStatus] """ - Details of the Web Hosting plan offer and options. + DNS status of the Web Hosting plan (deprecated, use domain_info). """ - platform: Optional[Platform] + user: Optional[HostingUser] """ - Details of the hosting platform. + Details of the hosting user. """ - dns_status: Optional[DnsRecordsStatus] + domain_status: Optional[DomainStatus] """ - DNS status of the Web Hosting plan. + Main domain status of the Web Hosting plan (deprecated, use domain_info). """ - user: Optional[HostingUser] + domain_info: Optional[HostingDomain] """ - Details of the hosting user. + Domain configuration block (subdomain, optional custom domain, and DNS settings). """ @@ -1367,6 +1413,11 @@ class HostingApiCreateHostingRequest: List of tags for the Web Hosting plan. """ + subdomain: Optional[str] + """ + The name prefix to use as a free subdomain (for example, `mysite`) assigned to the Web Hosting plan. The full domain will be automatically created by adding it to the fixed base domain (e.g. `mysite.scw.site`). You do not need to include the base domain yourself. + """ + offer_options: Optional[List[OfferOptionRequest]] """ List of the Web Hosting plan options IDs with their quantities. @@ -1497,6 +1548,11 @@ class HostingApiListHostingsRequest: Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned. """ + subdomain: Optional[str] + """ + Optional free subdomain linked to the Web Hosting plan. + """ + @dataclass class HostingApiResetHostingPasswordRequest: diff --git a/scaleway/scaleway/webhosting/v1/__init__.py b/scaleway/scaleway/webhosting/v1/__init__.py index 43df2e816..325d01061 100644 --- a/scaleway/scaleway/webhosting/v1/__init__.py +++ b/scaleway/scaleway/webhosting/v1/__init__.py @@ -24,11 +24,13 @@ from .types import OfferOptionName from .types import OfferOptionWarning from .types import PlatformPlatformGroup +from .types import AutoConfigDomainDns from .types import PlatformControlPanelUrls +from .types import HostingDomainCustomDomain from .types import OfferOption from .types import PlatformControlPanel +from .types import HostingDomain from .types import CreateDatabaseRequestUser -from .types import AutoConfigDomainDns from .types import CreateHostingRequestDomainConfiguration from .types import OfferOptionRequest from .types import SyncDomainDnsRecordsRequestRecord @@ -130,11 +132,13 @@ "OfferOptionName", "OfferOptionWarning", "PlatformPlatformGroup", + "AutoConfigDomainDns", "PlatformControlPanelUrls", + "HostingDomainCustomDomain", "OfferOption", "PlatformControlPanel", + "HostingDomain", "CreateDatabaseRequestUser", - "AutoConfigDomainDns", "CreateHostingRequestDomainConfiguration", "OfferOptionRequest", "SyncDomainDnsRecordsRequestRecord", diff --git a/scaleway/scaleway/webhosting/v1/api.py b/scaleway/scaleway/webhosting/v1/api.py index 7c925ee6e..8a6214acf 100644 --- a/scaleway/scaleway/webhosting/v1/api.py +++ b/scaleway/scaleway/webhosting/v1/api.py @@ -1112,6 +1112,7 @@ def create_hosting( region: Optional[ScwRegion] = None, project_id: Optional[str] = None, tags: Optional[List[str]] = None, + subdomain: Optional[str] = None, offer_options: Optional[List[OfferOptionRequest]] = None, language: Optional[StdLanguageCode] = None, domain_configuration: Optional[CreateHostingRequestDomainConfiguration] = None, @@ -1127,6 +1128,7 @@ def create_hosting( :param region: Region to target. If none is passed will use default region from the config. :param project_id: ID of the Scaleway Project in which to create the Web Hosting plan. :param tags: List of tags for the Web Hosting plan. + :param subdomain: The name prefix to use as a free subdomain (for example, `mysite`) assigned to the Web Hosting plan. The full domain will be automatically created by adding it to the fixed base domain (e.g. `mysite.scw.site`). You do not need to include the base domain yourself. :param offer_options: List of the Web Hosting plan options IDs with their quantities. :param language: Default language for the control panel interface. :param domain_configuration: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_config_domain_dns instead). @@ -1159,6 +1161,7 @@ def create_hosting( region=region, project_id=project_id, tags=tags, + subdomain=subdomain, offer_options=offer_options, language=language, domain_configuration=domain_configuration, @@ -1185,6 +1188,7 @@ def list_hostings( project_id: Optional[str] = None, organization_id: Optional[str] = None, control_panels: Optional[List[str]] = None, + subdomain: Optional[str] = None, ) -> ListHostingsResponse: """ List all Web Hosting plans. @@ -1199,6 +1203,7 @@ def list_hostings( :param project_id: Project ID to filter for, only Web Hosting plans from this Project will be returned. :param organization_id: Organization ID to filter for, only Web Hosting plans from this Organization will be returned. :param control_panels: Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned. + :param subdomain: Optional free subdomain linked to the Web Hosting plan. :return: :class:`ListHostingsResponse ` Usage: @@ -1224,6 +1229,7 @@ def list_hostings( "page_size": page_size or self.client.default_page_size, "project_id": project_id or self.client.default_project_id, "statuses": statuses, + "subdomain": subdomain, "tags": tags, }, ) @@ -1244,6 +1250,7 @@ def list_hostings_all( project_id: Optional[str] = None, organization_id: Optional[str] = None, control_panels: Optional[List[str]] = None, + subdomain: Optional[str] = None, ) -> List[HostingSummary]: """ List all Web Hosting plans. @@ -1258,6 +1265,7 @@ def list_hostings_all( :param project_id: Project ID to filter for, only Web Hosting plans from this Project will be returned. :param organization_id: Organization ID to filter for, only Web Hosting plans from this Organization will be returned. :param control_panels: Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned. + :param subdomain: Optional free subdomain linked to the Web Hosting plan. :return: :class:`List[HostingSummary] ` Usage: @@ -1281,6 +1289,7 @@ def list_hostings_all( "project_id": project_id, "organization_id": organization_id, "control_panels": control_panels, + "subdomain": subdomain, }, ) diff --git a/scaleway/scaleway/webhosting/v1/marshalling.py b/scaleway/scaleway/webhosting/v1/marshalling.py index 901528da9..3825815ee 100644 --- a/scaleway/scaleway/webhosting/v1/marshalling.py +++ b/scaleway/scaleway/webhosting/v1/marshalling.py @@ -27,8 +27,10 @@ DnsRecords, Domain, PlatformControlPanelUrls, + HostingDomainCustomDomain, OfferOption, PlatformControlPanel, + HostingDomain, HostingUser, Offer, Platform, @@ -366,6 +368,35 @@ def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls: return PlatformControlPanelUrls(**args) +def unmarshal_HostingDomainCustomDomain(data: Any) -> HostingDomainCustomDomain: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'HostingDomainCustomDomain' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("domain", None) + if field is not None: + args["domain"] = field + + field = data.get("domain_status", None) + if field is not None: + args["domain_status"] = field + + field = data.get("dns_status", None) + if field is not None: + args["dns_status"] = field + + field = data.get("auto_config_domain_dns", None) + if field is not None: + args["auto_config_domain_dns"] = unmarshal_AutoConfigDomainDns(field) + else: + args["auto_config_domain_dns"] = None + + return HostingDomainCustomDomain(**args) + + def unmarshal_OfferOption(data: Any) -> OfferOption: if not isinstance(data, dict): raise TypeError( @@ -432,6 +463,27 @@ def unmarshal_PlatformControlPanel(data: Any) -> PlatformControlPanel: return PlatformControlPanel(**args) +def unmarshal_HostingDomain(data: Any) -> HostingDomain: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'HostingDomain' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("subdomain", None) + if field is not None: + args["subdomain"] = field + + field = data.get("custom_domain", None) + if field is not None: + args["custom_domain"] = unmarshal_HostingDomainCustomDomain(field) + else: + args["custom_domain"] = None + + return HostingDomain(**args) + + def unmarshal_HostingUser(data: Any) -> HostingUser: if not isinstance(data, dict): raise TypeError( @@ -571,18 +623,6 @@ def unmarshal_Hosting(data: Any) -> Hosting: if field is not None: args["status"] = field - field = data.get("domain", None) - if field is not None: - args["domain"] = field - - field = data.get("tags", None) - if field is not None: - args["tags"] = field - - field = data.get("ipv4", None) - if field is not None: - args["ipv4"] = field - field = data.get("updated_at", None) if field is not None: args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -595,17 +635,11 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["created_at"] = None - field = data.get("protected", None) - if field is not None: - args["protected"] = field - - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - - field = data.get("region", None) + field = data.get("domain", None) if field is not None: - args["region"] = field + args["domain"] = field + else: + args["domain"] = None field = data.get("offer", None) if field is not None: @@ -619,6 +653,22 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["platform"] = None + field = data.get("tags", None) + if field is not None: + args["tags"] = field + + field = data.get("ipv4", None) + if field is not None: + args["ipv4"] = field + + field = data.get("protected", None) + if field is not None: + args["protected"] = field + + field = data.get("region", None) + if field is not None: + args["region"] = field + field = data.get("dns_status", None) if field is not None: args["dns_status"] = field @@ -631,6 +681,18 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["user"] = None + field = data.get("domain_status", None) + if field is not None: + args["domain_status"] = field + else: + args["domain_status"] = None + + field = data.get("domain_info", None) + if field is not None: + args["domain_info"] = unmarshal_HostingDomain(field) + else: + args["domain_info"] = None + return Hosting(**args) @@ -767,10 +829,6 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: if field is not None: args["status"] = field - field = data.get("domain", None) - if field is not None: - args["domain"] = field - field = data.get("protected", None) if field is not None: args["protected"] = field @@ -779,10 +837,6 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: if field is not None: args["offer_name"] = field - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - field = data.get("region", None) if field is not None: args["region"] = field @@ -799,12 +853,30 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: else: args["updated_at"] = None + field = data.get("domain", None) + if field is not None: + args["domain"] = field + else: + args["domain"] = None + field = data.get("dns_status", None) if field is not None: args["dns_status"] = field else: args["dns_status"] = None + field = data.get("domain_status", None) + if field is not None: + args["domain_status"] = field + else: + args["domain_status"] = None + + field = data.get("domain_info", None) + if field is not None: + args["domain_info"] = unmarshal_HostingDomain(field) + else: + args["domain_info"] = None + return HostingSummary(**args) @@ -1083,8 +1155,16 @@ def marshal_DatabaseApiCreateDatabaseRequest( output.update( resolve_one_of( [ - OneOfPossibility("new_user", request.new_user), - OneOfPossibility("existing_username", request.existing_username), + OneOfPossibility( + param="new_user", + value=request.new_user, + marshal_func=marshal_CreateDatabaseRequestUser, + ), + OneOfPossibility( + param="existing_username", + value=request.existing_username, + marshal_func=None, + ), ] ), ) @@ -1292,6 +1372,9 @@ def marshal_HostingApiCreateHostingRequest( if request.tags is not None: output["tags"] = request.tags + if request.subdomain is not None: + output["subdomain"] = request.subdomain + if request.offer_options is not None: output["offer_options"] = [ marshal_OfferOptionRequest(item, defaults) for item in request.offer_options diff --git a/scaleway/scaleway/webhosting/v1/types.py b/scaleway/scaleway/webhosting/v1/types.py index 9d80eb681..13e8ef91e 100644 --- a/scaleway/scaleway/webhosting/v1/types.py +++ b/scaleway/scaleway/webhosting/v1/types.py @@ -232,6 +232,34 @@ def __str__(self) -> str: return str(self.value) +@dataclass +class AutoConfigDomainDns: + nameservers: bool + """ + Whether or not to synchronize domain nameservers. + """ + + web_records: bool + """ + Whether or not to synchronize web records. + """ + + mail_records: bool + """ + Whether or not to synchronize mail records. + """ + + all_records: bool + """ + Whether or not to synchronize all types of records. Takes priority over the other fields. + """ + + none: bool + """ + No automatic domain configuration. Users must configure their domain for the Web Hosting to work. + """ + + @dataclass class PlatformControlPanelUrls: dashboard: str @@ -245,6 +273,29 @@ class PlatformControlPanelUrls: """ +@dataclass +class HostingDomainCustomDomain: + domain: str + """ + Custom domain linked to the hosting plan. + """ + + domain_status: DomainStatus + """ + Status of the custom domain verification. + """ + + dns_status: DnsRecordsStatus + """ + Status of the DNS configuration for the custom domain. + """ + + auto_config_domain_dns: Optional[AutoConfigDomainDns] + """ + Indicates whether to auto-configure DNS for this domain. + """ + + @dataclass class OfferOption: id: str @@ -302,38 +353,23 @@ class PlatformControlPanel: @dataclass -class CreateDatabaseRequestUser: - username: str - - password: str - - -@dataclass -class AutoConfigDomainDns: - nameservers: bool +class HostingDomain: + subdomain: str """ - Whether or not to synchronize domain nameservers. + Optional free subdomain linked to the Web Hosting plan. """ - web_records: bool + custom_domain: Optional[HostingDomainCustomDomain] """ - Whether or not to synchronize web records. + Optional custom domain linked to the Web Hosting plan. """ - mail_records: bool - """ - Whether or not to synchronize mail records. - """ - all_records: bool - """ - Whether or not to synchronize all types of records. Takes priority over the other fields. - """ +@dataclass +class CreateDatabaseRequestUser: + username: str - none: bool - """ - No automatic domain configuration. Users must configure their domain for the Web Hosting to work. - """ + password: str @dataclass @@ -606,11 +642,6 @@ class HostingSummary: Status of the Web Hosting plan. """ - domain: str - """ - Main domain associated with the Web Hosting plan. - """ - protected: bool """ Whether the hosting is protected or not. @@ -621,11 +652,6 @@ class HostingSummary: Name of the active offer for the Web Hosting plan. """ - domain_status: DomainStatus - """ - Main domain status of the Web Hosting plan. - """ - region: ScwRegion """ Region where the Web Hosting plan is hosted. @@ -641,11 +667,26 @@ class HostingSummary: Date on which the Web Hosting plan was last updated. """ + domain: Optional[str] + """ + Main domain associated with the Web Hosting plan (deprecated, use domain_info). + """ + dns_status: Optional[DnsRecordsStatus] """ DNS status of the Web Hosting plan. """ + domain_status: Optional[DomainStatus] + """ + Main domain status of the Web Hosting plan. + """ + + domain_info: Optional[HostingDomain] + """ + Domain configuration block (subdomain, optional custom domain, and DNS settings). + """ + @dataclass class MailAccount: @@ -1274,39 +1315,44 @@ class Hosting: Status of the Web Hosting plan. """ - domain: str + updated_at: Optional[datetime] """ - Main domain associated with the Web Hosting plan. + Date on which the Web Hosting plan was last updated. """ - tags: List[str] + created_at: Optional[datetime] """ - List of tags associated with the Web Hosting plan. + Date on which the Web Hosting plan was created. """ - ipv4: str + domain: Optional[str] """ - Current IPv4 address of the hosting. + Main domain associated with the Web Hosting plan (deprecated, use domain_info). """ - updated_at: Optional[datetime] + offer: Optional[Offer] """ - Date on which the Web Hosting plan was last updated. + Details of the Web Hosting plan offer and options. """ - created_at: Optional[datetime] + platform: Optional[Platform] """ - Date on which the Web Hosting plan was created. + Details of the hosting platform. """ - protected: bool + tags: List[str] """ - Whether the hosting is protected or not. + List of tags associated with the Web Hosting plan. """ - domain_status: DomainStatus + ipv4: str """ - Main domain status of the Web Hosting plan. + Current IPv4 address of the hosting. + """ + + protected: bool + """ + Whether the hosting is protected or not. """ region: ScwRegion @@ -1314,24 +1360,24 @@ class Hosting: Region where the Web Hosting plan is hosted. """ - offer: Optional[Offer] + dns_status: Optional[DnsRecordsStatus] """ - Details of the Web Hosting plan offer and options. + DNS status of the Web Hosting plan (deprecated, use domain_info). """ - platform: Optional[Platform] + user: Optional[HostingUser] """ - Details of the hosting platform. + Details of the hosting user. """ - dns_status: Optional[DnsRecordsStatus] + domain_status: Optional[DomainStatus] """ - DNS status of the Web Hosting plan. + Main domain status of the Web Hosting plan (deprecated, use domain_info). """ - user: Optional[HostingUser] + domain_info: Optional[HostingDomain] """ - Details of the hosting user. + Domain configuration block (subdomain, optional custom domain, and DNS settings). """ @@ -1367,6 +1413,11 @@ class HostingApiCreateHostingRequest: List of tags for the Web Hosting plan. """ + subdomain: Optional[str] + """ + The name prefix to use as a free subdomain (for example, `mysite`) assigned to the Web Hosting plan. The full domain will be automatically created by adding it to the fixed base domain (e.g. `mysite.scw.site`). You do not need to include the base domain yourself. + """ + offer_options: Optional[List[OfferOptionRequest]] """ List of the Web Hosting plan options IDs with their quantities. @@ -1497,6 +1548,11 @@ class HostingApiListHostingsRequest: Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned. """ + subdomain: Optional[str] + """ + Optional free subdomain linked to the Web Hosting plan. + """ + @dataclass class HostingApiResetHostingPasswordRequest: