Skip to content

Commit 298fd6d

Browse files
chore(webhosting): handle deprecated_optional fields
1 parent 1d973b1 commit 298fd6d

6 files changed

Lines changed: 178 additions & 186 deletions

File tree

scaleway-async/scaleway_async/webhosting/v1/api.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,22 +1232,22 @@ async def sync_domain_dns_records(
12321232
self,
12331233
*,
12341234
domain: str,
1235-
update_web_records: bool,
1236-
update_mail_records: bool,
1237-
update_all_records: bool,
1238-
update_nameservers: bool,
12391235
region: Optional[ScwRegion] = None,
1236+
update_web_records: Optional[bool] = None,
1237+
update_mail_records: Optional[bool] = None,
1238+
update_all_records: Optional[bool] = None,
1239+
update_nameservers: Optional[bool] = None,
12401240
custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = None,
12411241
auto_config_domain_dns: Optional[AutoConfigDomainDns] = None,
12421242
) -> DnsRecords:
12431243
"""
12441244
Synchronize your DNS records on the Elements Console and on cPanel.
12451245
:param domain: Domain for which the DNS records will be synchronized.
1246+
:param region: Region to target. If none is passed will use default region from the config.
12461247
:param update_web_records: Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns).
12471248
:param update_mail_records: Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns).
12481249
:param update_all_records: Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns).
12491250
:param update_nameservers: Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns).
1250-
:param region: Region to target. If none is passed will use default region from the config.
12511251
:param custom_records: Custom records to synchronize.
12521252
:param auto_config_domain_dns: Whether or not to synchronize each types of records.
12531253
:return: :class:`DnsRecords <DnsRecords>`
@@ -1257,10 +1257,6 @@ async def sync_domain_dns_records(
12571257
12581258
result = await api.sync_domain_dns_records(
12591259
domain="example",
1260-
update_web_records=False,
1261-
update_mail_records=False,
1262-
update_all_records=False,
1263-
update_nameservers=False,
12641260
)
12651261
"""
12661262

@@ -1275,11 +1271,11 @@ async def sync_domain_dns_records(
12751271
body=marshal_DnsApiSyncDomainDnsRecordsRequest(
12761272
DnsApiSyncDomainDnsRecordsRequest(
12771273
domain=domain,
1274+
region=region,
12781275
update_web_records=update_web_records,
12791276
update_mail_records=update_mail_records,
12801277
update_all_records=update_all_records,
12811278
update_nameservers=update_nameservers,
1282-
region=region,
12831279
custom_records=custom_records,
12841280
auto_config_domain_dns=auto_config_domain_dns,
12851281
),

scaleway-async/scaleway_async/webhosting/v1/marshalling.py

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -350,36 +350,18 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary:
350350
else:
351351
args["status"] = HostingStatus.UNKNOWN_STATUS
352352

353-
field = data.get("domain", None)
354-
if field is not None:
355-
args["domain"] = field
356-
else:
357-
args["domain"] = None
358-
359353
field = data.get("protected", None)
360354
if field is not None:
361355
args["protected"] = field
362356
else:
363357
args["protected"] = False
364358

365-
field = data.get("dns_status", None)
366-
if field is not None:
367-
args["dns_status"] = field
368-
else:
369-
args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS
370-
371359
field = data.get("offer_name", None)
372360
if field is not None:
373361
args["offer_name"] = field
374362
else:
375363
args["offer_name"] = None
376364

377-
field = data.get("domain_status", None)
378-
if field is not None:
379-
args["domain_status"] = field
380-
else:
381-
args["domain_status"] = DomainStatus.UNKNOWN_STATUS
382-
383365
field = data.get("region", None)
384366
if field is not None:
385367
args["region"] = field
@@ -398,6 +380,24 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary:
398380
else:
399381
args["updated_at"] = None
400382

383+
field = data.get("domain", None)
384+
if field is not None:
385+
args["domain"] = field
386+
else:
387+
args["domain"] = None
388+
389+
field = data.get("dns_status", None)
390+
if field is not None:
391+
args["dns_status"] = field
392+
else:
393+
args["dns_status"] = None
394+
395+
field = data.get("domain_status", None)
396+
if field is not None:
397+
args["domain_status"] = field
398+
else:
399+
args["domain_status"] = None
400+
401401
field = data.get("domain_info", None)
402402
if field is not None:
403403
args["domain_info"] = unmarshal_HostingDomain(field)
@@ -650,7 +650,7 @@ def unmarshal_DnsRecords(data: Any) -> DnsRecords:
650650
[DomainDnsAction(v) for v in field] if field is not None else None
651651
)
652652
else:
653-
args["dns_config"] = []
653+
args["dns_config"] = None
654654

655655
field = data.get("auto_config_domain_dns", None)
656656
if field is not None:
@@ -707,7 +707,7 @@ def unmarshal_Domain(data: Any) -> Domain:
707707
[DomainDnsAction(v) for v in field] if field is not None else None
708708
)
709709
else:
710-
args["available_dns_actions"] = []
710+
args["available_dns_actions"] = None
711711

712712
field = data.get("auto_config_domain_dns", None)
713713
if field is not None:
@@ -1145,12 +1145,6 @@ def unmarshal_Hosting(data: Any) -> Hosting:
11451145
else:
11461146
args["status"] = HostingStatus.UNKNOWN_STATUS
11471147

1148-
field = data.get("domain", None)
1149-
if field is not None:
1150-
args["domain"] = field
1151-
else:
1152-
args["domain"] = None
1153-
11541148
field = data.get("updated_at", None)
11551149
if field is not None:
11561150
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
@@ -1163,6 +1157,12 @@ def unmarshal_Hosting(data: Any) -> Hosting:
11631157
else:
11641158
args["created_at"] = None
11651159

1160+
field = data.get("domain", None)
1161+
if field is not None:
1162+
args["domain"] = field
1163+
else:
1164+
args["domain"] = None
1165+
11661166
field = data.get("offer", None)
11671167
if field is not None:
11681168
args["offer"] = unmarshal_Offer(field)
@@ -1181,12 +1181,6 @@ def unmarshal_Hosting(data: Any) -> Hosting:
11811181
else:
11821182
args["tags"] = []
11831183

1184-
field = data.get("dns_status", None)
1185-
if field is not None:
1186-
args["dns_status"] = field
1187-
else:
1188-
args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS
1189-
11901184
field = data.get("ipv4", None)
11911185
if field is not None:
11921186
args["ipv4"] = field
@@ -1199,24 +1193,30 @@ def unmarshal_Hosting(data: Any) -> Hosting:
11991193
else:
12001194
args["protected"] = False
12011195

1202-
field = data.get("domain_status", None)
1203-
if field is not None:
1204-
args["domain_status"] = field
1205-
else:
1206-
args["domain_status"] = DomainStatus.UNKNOWN_STATUS
1207-
12081196
field = data.get("region", None)
12091197
if field is not None:
12101198
args["region"] = field
12111199
else:
12121200
args["region"] = None
12131201

1202+
field = data.get("dns_status", None)
1203+
if field is not None:
1204+
args["dns_status"] = field
1205+
else:
1206+
args["dns_status"] = None
1207+
12141208
field = data.get("user", None)
12151209
if field is not None:
12161210
args["user"] = unmarshal_HostingUser(field)
12171211
else:
12181212
args["user"] = None
12191213

1214+
field = data.get("domain_status", None)
1215+
if field is not None:
1216+
args["domain_status"] = field
1217+
else:
1218+
args["domain_status"] = None
1219+
12201220
field = data.get("domain_info", None)
12211221
if field is not None:
12221222
args["domain_info"] = unmarshal_HostingDomain(field)

0 commit comments

Comments
 (0)