From 298fd6d9ac7b1419259dcbc4793fbfdc9c994220 Mon Sep 17 00:00:00 2001 From: Estelle Soulard Date: Fri, 27 Mar 2026 10:33:06 +0100 Subject: [PATCH] chore(webhosting): handle deprecated_optional fields --- .../scaleway_async/webhosting/v1/api.py | 16 ++-- .../webhosting/v1/marshalling.py | 76 ++++++++-------- .../scaleway_async/webhosting/v1/types.py | 90 +++++++++---------- scaleway/scaleway/webhosting/v1/api.py | 16 ++-- .../scaleway/webhosting/v1/marshalling.py | 76 ++++++++-------- scaleway/scaleway/webhosting/v1/types.py | 90 +++++++++---------- 6 files changed, 178 insertions(+), 186 deletions(-) diff --git a/scaleway-async/scaleway_async/webhosting/v1/api.py b/scaleway-async/scaleway_async/webhosting/v1/api.py index 44df63d04..dd0f1f70a 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/api.py +++ b/scaleway-async/scaleway_async/webhosting/v1/api.py @@ -1232,22 +1232,22 @@ async def sync_domain_dns_records( self, *, domain: str, - update_web_records: bool, - update_mail_records: bool, - update_all_records: bool, - update_nameservers: bool, region: Optional[ScwRegion] = None, + update_web_records: Optional[bool] = None, + update_mail_records: Optional[bool] = None, + update_all_records: Optional[bool] = None, + update_nameservers: Optional[bool] = None, custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = None, auto_config_domain_dns: Optional[AutoConfigDomainDns] = None, ) -> DnsRecords: """ Synchronize your DNS records on the Elements Console and on cPanel. :param domain: Domain for which the DNS records will be synchronized. + :param region: Region to target. If none is passed will use default region from the config. :param update_web_records: Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns). :param update_mail_records: Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns). :param update_all_records: Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns). :param update_nameservers: Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns). - :param region: Region to target. If none is passed will use default region from the config. :param custom_records: Custom records to synchronize. :param auto_config_domain_dns: Whether or not to synchronize each types of records. :return: :class:`DnsRecords ` @@ -1257,10 +1257,6 @@ async def sync_domain_dns_records( result = await api.sync_domain_dns_records( domain="example", - update_web_records=False, - update_mail_records=False, - update_all_records=False, - update_nameservers=False, ) """ @@ -1275,11 +1271,11 @@ async def sync_domain_dns_records( body=marshal_DnsApiSyncDomainDnsRecordsRequest( DnsApiSyncDomainDnsRecordsRequest( domain=domain, + region=region, update_web_records=update_web_records, update_mail_records=update_mail_records, update_all_records=update_all_records, update_nameservers=update_nameservers, - region=region, custom_records=custom_records, auto_config_domain_dns=auto_config_domain_dns, ), diff --git a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py index 44f87579b..3a5cfa52a 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py +++ b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py @@ -350,36 +350,18 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: else: args["status"] = HostingStatus.UNKNOWN_STATUS - field = data.get("domain", None) - if field is not None: - args["domain"] = field - else: - args["domain"] = None - field = data.get("protected", None) if field is not None: args["protected"] = field else: args["protected"] = False - field = data.get("dns_status", None) - if field is not None: - args["dns_status"] = field - else: - args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS - field = data.get("offer_name", None) if field is not None: args["offer_name"] = field else: args["offer_name"] = None - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - else: - args["domain_status"] = DomainStatus.UNKNOWN_STATUS - field = data.get("region", None) if field is not None: args["region"] = field @@ -398,6 +380,24 @@ 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) @@ -650,7 +650,7 @@ def unmarshal_DnsRecords(data: Any) -> DnsRecords: [DomainDnsAction(v) for v in field] if field is not None else None ) else: - args["dns_config"] = [] + args["dns_config"] = None field = data.get("auto_config_domain_dns", None) if field is not None: @@ -707,7 +707,7 @@ def unmarshal_Domain(data: Any) -> Domain: [DomainDnsAction(v) for v in field] if field is not None else None ) else: - args["available_dns_actions"] = [] + args["available_dns_actions"] = None field = data.get("auto_config_domain_dns", None) if field is not None: @@ -1145,12 +1145,6 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["status"] = HostingStatus.UNKNOWN_STATUS - field = data.get("domain", None) - if field is not None: - args["domain"] = field - else: - args["domain"] = None - field = data.get("updated_at", None) if field is not None: args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -1163,6 +1157,12 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["created_at"] = None + field = data.get("domain", None) + if field is not None: + args["domain"] = field + else: + args["domain"] = None + field = data.get("offer", None) if field is not None: args["offer"] = unmarshal_Offer(field) @@ -1181,12 +1181,6 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["tags"] = [] - field = data.get("dns_status", None) - if field is not None: - args["dns_status"] = field - else: - args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS - field = data.get("ipv4", None) if field is not None: args["ipv4"] = field @@ -1199,24 +1193,30 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["protected"] = False - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - else: - args["domain_status"] = DomainStatus.UNKNOWN_STATUS - field = data.get("region", None) if field is not None: args["region"] = field else: args["region"] = None + field = data.get("dns_status", None) + if field is not None: + args["dns_status"] = field + else: + args["dns_status"] = None + field = data.get("user", None) if field is not None: args["user"] = unmarshal_HostingUser(field) 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) diff --git a/scaleway-async/scaleway_async/webhosting/v1/types.py b/scaleway-async/scaleway_async/webhosting/v1/types.py index 07d378d5a..4df2c5424 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/types.py +++ b/scaleway-async/scaleway_async/webhosting/v1/types.py @@ -891,31 +891,16 @@ class HostingSummary: Status of the Web Hosting plan. """ - domain: str - """ - Main domain associated with the Web Hosting plan (deprecated, use domain_info). - """ - protected: bool """ Whether the hosting is protected or not. """ - dns_status: DnsRecordsStatus - """ - DNS status of the Web Hosting plan. - """ - offer_name: str """ 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. @@ -931,6 +916,21 @@ class HostingSummary: Date on which the Web Hosting plan was last updated. """ + domain: Optional[str] = None + """ + Main domain associated with the Web Hosting plan (deprecated, use domain_info). + """ + + dns_status: Optional[DnsRecordsStatus] = None + """ + DNS status of the Web Hosting plan. + """ + + domain_status: Optional[DomainStatus] = None + """ + Main domain status of the Web Hosting plan. + """ + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). @@ -1523,31 +1523,31 @@ class DnsApiSyncDomainDnsRecordsRequest: Domain for which the DNS records will be synchronized. """ - update_web_records: bool + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + update_web_records: Optional[bool] = None """ Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns). """ - update_mail_records: bool + update_mail_records: Optional[bool] = None """ Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns). """ - update_all_records: bool + update_all_records: Optional[bool] = None """ Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns). """ - update_nameservers: bool + update_nameservers: Optional[bool] = None """ Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns). """ - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = field( default_factory=list ) @@ -1578,7 +1578,7 @@ class DnsRecords: Status of the records. """ - dns_config: list[DomainDnsAction] + dns_config: Optional[list[DomainDnsAction]] = field(default_factory=list) """ Records dns auto configuration settings (deprecated, use auto_config_domain_dns). """ @@ -1616,7 +1616,7 @@ class Domain: A list of actions that can be performed on the domain. """ - available_dns_actions: list[DomainDnsAction] + available_dns_actions: Optional[list[DomainDnsAction]] = field(default_factory=list) """ A list of DNS-related actions that can be auto configured for the domain (deprecated, use auto_config_domain_dns instead). """ @@ -1784,21 +1784,11 @@ class Hosting: Status of the Web Hosting plan. """ - domain: str - """ - Main domain associated with the Web Hosting plan (deprecated, use domain_info). - """ - tags: list[str] """ List of tags associated with the Web Hosting plan. """ - dns_status: DnsRecordsStatus - """ - DNS status of the Web Hosting plan (deprecated, use domain_info). - """ - ipv4: str """ Current IPv4 address of the hosting. @@ -1809,11 +1799,6 @@ class Hosting: Whether the hosting is protected or not. """ - domain_status: DomainStatus - """ - Main domain status of the Web Hosting plan (deprecated, use domain_info). - """ - region: ScwRegion """ Region where the Web Hosting plan is hosted. @@ -1829,6 +1814,11 @@ class Hosting: Date on which the Web Hosting plan was created. """ + domain: Optional[str] = None + """ + Main domain associated with the Web Hosting plan (deprecated, use domain_info). + """ + offer: Optional[Offer] = None """ Details of the Web Hosting plan offer and options. @@ -1839,11 +1829,21 @@ class Hosting: Details of the hosting platform. """ + dns_status: Optional[DnsRecordsStatus] = None + """ + DNS status of the Web Hosting plan (deprecated, use domain_info). + """ + user: Optional[HostingUser] = None """ Details of the hosting user. """ + domain_status: Optional[DomainStatus] = None + """ + Main domain status of the Web Hosting plan (deprecated, use domain_info). + """ + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). @@ -2517,14 +2517,14 @@ class Progress: @dataclass class ResetHostingPasswordResponse: - one_time_password: str + one_time_password_b64: str """ - New temporary password (deprecated, use password_b64 instead). + New temporary password, encoded in base64. """ - one_time_password_b64: str + one_time_password: Optional[str] = None """ - New temporary password, encoded in base64. + New temporary password (deprecated, use password_b64 instead). """ diff --git a/scaleway/scaleway/webhosting/v1/api.py b/scaleway/scaleway/webhosting/v1/api.py index 19ba4db9a..dd9cece7b 100644 --- a/scaleway/scaleway/webhosting/v1/api.py +++ b/scaleway/scaleway/webhosting/v1/api.py @@ -1232,22 +1232,22 @@ def sync_domain_dns_records( self, *, domain: str, - update_web_records: bool, - update_mail_records: bool, - update_all_records: bool, - update_nameservers: bool, region: Optional[ScwRegion] = None, + update_web_records: Optional[bool] = None, + update_mail_records: Optional[bool] = None, + update_all_records: Optional[bool] = None, + update_nameservers: Optional[bool] = None, custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = None, auto_config_domain_dns: Optional[AutoConfigDomainDns] = None, ) -> DnsRecords: """ Synchronize your DNS records on the Elements Console and on cPanel. :param domain: Domain for which the DNS records will be synchronized. + :param region: Region to target. If none is passed will use default region from the config. :param update_web_records: Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns). :param update_mail_records: Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns). :param update_all_records: Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns). :param update_nameservers: Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns). - :param region: Region to target. If none is passed will use default region from the config. :param custom_records: Custom records to synchronize. :param auto_config_domain_dns: Whether or not to synchronize each types of records. :return: :class:`DnsRecords ` @@ -1257,10 +1257,6 @@ def sync_domain_dns_records( result = api.sync_domain_dns_records( domain="example", - update_web_records=False, - update_mail_records=False, - update_all_records=False, - update_nameservers=False, ) """ @@ -1275,11 +1271,11 @@ def sync_domain_dns_records( body=marshal_DnsApiSyncDomainDnsRecordsRequest( DnsApiSyncDomainDnsRecordsRequest( domain=domain, + region=region, update_web_records=update_web_records, update_mail_records=update_mail_records, update_all_records=update_all_records, update_nameservers=update_nameservers, - region=region, custom_records=custom_records, auto_config_domain_dns=auto_config_domain_dns, ), diff --git a/scaleway/scaleway/webhosting/v1/marshalling.py b/scaleway/scaleway/webhosting/v1/marshalling.py index 44f87579b..3a5cfa52a 100644 --- a/scaleway/scaleway/webhosting/v1/marshalling.py +++ b/scaleway/scaleway/webhosting/v1/marshalling.py @@ -350,36 +350,18 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: else: args["status"] = HostingStatus.UNKNOWN_STATUS - field = data.get("domain", None) - if field is not None: - args["domain"] = field - else: - args["domain"] = None - field = data.get("protected", None) if field is not None: args["protected"] = field else: args["protected"] = False - field = data.get("dns_status", None) - if field is not None: - args["dns_status"] = field - else: - args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS - field = data.get("offer_name", None) if field is not None: args["offer_name"] = field else: args["offer_name"] = None - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - else: - args["domain_status"] = DomainStatus.UNKNOWN_STATUS - field = data.get("region", None) if field is not None: args["region"] = field @@ -398,6 +380,24 @@ 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) @@ -650,7 +650,7 @@ def unmarshal_DnsRecords(data: Any) -> DnsRecords: [DomainDnsAction(v) for v in field] if field is not None else None ) else: - args["dns_config"] = [] + args["dns_config"] = None field = data.get("auto_config_domain_dns", None) if field is not None: @@ -707,7 +707,7 @@ def unmarshal_Domain(data: Any) -> Domain: [DomainDnsAction(v) for v in field] if field is not None else None ) else: - args["available_dns_actions"] = [] + args["available_dns_actions"] = None field = data.get("auto_config_domain_dns", None) if field is not None: @@ -1145,12 +1145,6 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["status"] = HostingStatus.UNKNOWN_STATUS - field = data.get("domain", None) - if field is not None: - args["domain"] = field - else: - args["domain"] = None - field = data.get("updated_at", None) if field is not None: args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -1163,6 +1157,12 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["created_at"] = None + field = data.get("domain", None) + if field is not None: + args["domain"] = field + else: + args["domain"] = None + field = data.get("offer", None) if field is not None: args["offer"] = unmarshal_Offer(field) @@ -1181,12 +1181,6 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["tags"] = [] - field = data.get("dns_status", None) - if field is not None: - args["dns_status"] = field - else: - args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS - field = data.get("ipv4", None) if field is not None: args["ipv4"] = field @@ -1199,24 +1193,30 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["protected"] = False - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - else: - args["domain_status"] = DomainStatus.UNKNOWN_STATUS - field = data.get("region", None) if field is not None: args["region"] = field else: args["region"] = None + field = data.get("dns_status", None) + if field is not None: + args["dns_status"] = field + else: + args["dns_status"] = None + field = data.get("user", None) if field is not None: args["user"] = unmarshal_HostingUser(field) 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) diff --git a/scaleway/scaleway/webhosting/v1/types.py b/scaleway/scaleway/webhosting/v1/types.py index 07d378d5a..4df2c5424 100644 --- a/scaleway/scaleway/webhosting/v1/types.py +++ b/scaleway/scaleway/webhosting/v1/types.py @@ -891,31 +891,16 @@ class HostingSummary: Status of the Web Hosting plan. """ - domain: str - """ - Main domain associated with the Web Hosting plan (deprecated, use domain_info). - """ - protected: bool """ Whether the hosting is protected or not. """ - dns_status: DnsRecordsStatus - """ - DNS status of the Web Hosting plan. - """ - offer_name: str """ 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. @@ -931,6 +916,21 @@ class HostingSummary: Date on which the Web Hosting plan was last updated. """ + domain: Optional[str] = None + """ + Main domain associated with the Web Hosting plan (deprecated, use domain_info). + """ + + dns_status: Optional[DnsRecordsStatus] = None + """ + DNS status of the Web Hosting plan. + """ + + domain_status: Optional[DomainStatus] = None + """ + Main domain status of the Web Hosting plan. + """ + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). @@ -1523,31 +1523,31 @@ class DnsApiSyncDomainDnsRecordsRequest: Domain for which the DNS records will be synchronized. """ - update_web_records: bool + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + update_web_records: Optional[bool] = None """ Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns). """ - update_mail_records: bool + update_mail_records: Optional[bool] = None """ Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns). """ - update_all_records: bool + update_all_records: Optional[bool] = None """ Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns). """ - update_nameservers: bool + update_nameservers: Optional[bool] = None """ Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns). """ - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = field( default_factory=list ) @@ -1578,7 +1578,7 @@ class DnsRecords: Status of the records. """ - dns_config: list[DomainDnsAction] + dns_config: Optional[list[DomainDnsAction]] = field(default_factory=list) """ Records dns auto configuration settings (deprecated, use auto_config_domain_dns). """ @@ -1616,7 +1616,7 @@ class Domain: A list of actions that can be performed on the domain. """ - available_dns_actions: list[DomainDnsAction] + available_dns_actions: Optional[list[DomainDnsAction]] = field(default_factory=list) """ A list of DNS-related actions that can be auto configured for the domain (deprecated, use auto_config_domain_dns instead). """ @@ -1784,21 +1784,11 @@ class Hosting: Status of the Web Hosting plan. """ - domain: str - """ - Main domain associated with the Web Hosting plan (deprecated, use domain_info). - """ - tags: list[str] """ List of tags associated with the Web Hosting plan. """ - dns_status: DnsRecordsStatus - """ - DNS status of the Web Hosting plan (deprecated, use domain_info). - """ - ipv4: str """ Current IPv4 address of the hosting. @@ -1809,11 +1799,6 @@ class Hosting: Whether the hosting is protected or not. """ - domain_status: DomainStatus - """ - Main domain status of the Web Hosting plan (deprecated, use domain_info). - """ - region: ScwRegion """ Region where the Web Hosting plan is hosted. @@ -1829,6 +1814,11 @@ class Hosting: Date on which the Web Hosting plan was created. """ + domain: Optional[str] = None + """ + Main domain associated with the Web Hosting plan (deprecated, use domain_info). + """ + offer: Optional[Offer] = None """ Details of the Web Hosting plan offer and options. @@ -1839,11 +1829,21 @@ class Hosting: Details of the hosting platform. """ + dns_status: Optional[DnsRecordsStatus] = None + """ + DNS status of the Web Hosting plan (deprecated, use domain_info). + """ + user: Optional[HostingUser] = None """ Details of the hosting user. """ + domain_status: Optional[DomainStatus] = None + """ + Main domain status of the Web Hosting plan (deprecated, use domain_info). + """ + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). @@ -2517,14 +2517,14 @@ class Progress: @dataclass class ResetHostingPasswordResponse: - one_time_password: str + one_time_password_b64: str """ - New temporary password (deprecated, use password_b64 instead). + New temporary password, encoded in base64. """ - one_time_password_b64: str + one_time_password: Optional[str] = None """ - New temporary password, encoded in base64. + New temporary password (deprecated, use password_b64 instead). """