Skip to content

Commit bf5c356

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

File tree

4 files changed

+166
-166
lines changed

4 files changed

+166
-166
lines changed

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)

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

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -891,31 +891,16 @@ class HostingSummary:
891891
Status of the Web Hosting plan.
892892
"""
893893

894-
domain: str
895-
"""
896-
Main domain associated with the Web Hosting plan (deprecated, use domain_info).
897-
"""
898-
899894
protected: bool
900895
"""
901896
Whether the hosting is protected or not.
902897
"""
903898

904-
dns_status: DnsRecordsStatus
905-
"""
906-
DNS status of the Web Hosting plan.
907-
"""
908-
909899
offer_name: str
910900
"""
911901
Name of the active offer for the Web Hosting plan.
912902
"""
913903

914-
domain_status: DomainStatus
915-
"""
916-
Main domain status of the Web Hosting plan.
917-
"""
918-
919904
region: ScwRegion
920905
"""
921906
Region where the Web Hosting plan is hosted.
@@ -931,6 +916,21 @@ class HostingSummary:
931916
Date on which the Web Hosting plan was last updated.
932917
"""
933918

919+
domain: Optional[str] = None
920+
"""
921+
Main domain associated with the Web Hosting plan (deprecated, use domain_info).
922+
"""
923+
924+
dns_status: Optional[DnsRecordsStatus] = None
925+
"""
926+
DNS status of the Web Hosting plan.
927+
"""
928+
929+
domain_status: Optional[DomainStatus] = None
930+
"""
931+
Main domain status of the Web Hosting plan.
932+
"""
933+
934934
domain_info: Optional[HostingDomain] = None
935935
"""
936936
Domain configuration block (subdomain, optional custom domain, and DNS settings).
@@ -1523,31 +1523,31 @@ class DnsApiSyncDomainDnsRecordsRequest:
15231523
Domain for which the DNS records will be synchronized.
15241524
"""
15251525

1526-
update_web_records: bool
1526+
region: Optional[ScwRegion] = None
1527+
"""
1528+
Region to target. If none is passed will use default region from the config.
1529+
"""
1530+
1531+
update_web_records: Optional[bool] = None
15271532
"""
15281533
Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns).
15291534
"""
15301535

1531-
update_mail_records: bool
1536+
update_mail_records: Optional[bool] = None
15321537
"""
15331538
Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns).
15341539
"""
15351540

1536-
update_all_records: bool
1541+
update_all_records: Optional[bool] = None
15371542
"""
15381543
Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns).
15391544
"""
15401545

1541-
update_nameservers: bool
1546+
update_nameservers: Optional[bool] = None
15421547
"""
15431548
Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns).
15441549
"""
15451550

1546-
region: Optional[ScwRegion] = None
1547-
"""
1548-
Region to target. If none is passed will use default region from the config.
1549-
"""
1550-
15511551
custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = field(
15521552
default_factory=list
15531553
)
@@ -1578,7 +1578,7 @@ class DnsRecords:
15781578
Status of the records.
15791579
"""
15801580

1581-
dns_config: list[DomainDnsAction]
1581+
dns_config: Optional[list[DomainDnsAction]] = field(default_factory=list)
15821582
"""
15831583
Records dns auto configuration settings (deprecated, use auto_config_domain_dns).
15841584
"""
@@ -1616,7 +1616,7 @@ class Domain:
16161616
A list of actions that can be performed on the domain.
16171617
"""
16181618

1619-
available_dns_actions: list[DomainDnsAction]
1619+
available_dns_actions: Optional[list[DomainDnsAction]] = field(default_factory=list)
16201620
"""
16211621
A list of DNS-related actions that can be auto configured for the domain (deprecated, use auto_config_domain_dns instead).
16221622
"""
@@ -1784,21 +1784,11 @@ class Hosting:
17841784
Status of the Web Hosting plan.
17851785
"""
17861786

1787-
domain: str
1788-
"""
1789-
Main domain associated with the Web Hosting plan (deprecated, use domain_info).
1790-
"""
1791-
17921787
tags: list[str]
17931788
"""
17941789
List of tags associated with the Web Hosting plan.
17951790
"""
17961791

1797-
dns_status: DnsRecordsStatus
1798-
"""
1799-
DNS status of the Web Hosting plan (deprecated, use domain_info).
1800-
"""
1801-
18021792
ipv4: str
18031793
"""
18041794
Current IPv4 address of the hosting.
@@ -1809,11 +1799,6 @@ class Hosting:
18091799
Whether the hosting is protected or not.
18101800
"""
18111801

1812-
domain_status: DomainStatus
1813-
"""
1814-
Main domain status of the Web Hosting plan (deprecated, use domain_info).
1815-
"""
1816-
18171802
region: ScwRegion
18181803
"""
18191804
Region where the Web Hosting plan is hosted.
@@ -1829,6 +1814,11 @@ class Hosting:
18291814
Date on which the Web Hosting plan was created.
18301815
"""
18311816

1817+
domain: Optional[str] = None
1818+
"""
1819+
Main domain associated with the Web Hosting plan (deprecated, use domain_info).
1820+
"""
1821+
18321822
offer: Optional[Offer] = None
18331823
"""
18341824
Details of the Web Hosting plan offer and options.
@@ -1839,11 +1829,21 @@ class Hosting:
18391829
Details of the hosting platform.
18401830
"""
18411831

1832+
dns_status: Optional[DnsRecordsStatus] = None
1833+
"""
1834+
DNS status of the Web Hosting plan (deprecated, use domain_info).
1835+
"""
1836+
18421837
user: Optional[HostingUser] = None
18431838
"""
18441839
Details of the hosting user.
18451840
"""
18461841

1842+
domain_status: Optional[DomainStatus] = None
1843+
"""
1844+
Main domain status of the Web Hosting plan (deprecated, use domain_info).
1845+
"""
1846+
18471847
domain_info: Optional[HostingDomain] = None
18481848
"""
18491849
Domain configuration block (subdomain, optional custom domain, and DNS settings).
@@ -2517,14 +2517,14 @@ class Progress:
25172517

25182518
@dataclass
25192519
class ResetHostingPasswordResponse:
2520-
one_time_password: str
2520+
one_time_password_b64: str
25212521
"""
2522-
New temporary password (deprecated, use password_b64 instead).
2522+
New temporary password, encoded in base64.
25232523
"""
25242524

2525-
one_time_password_b64: str
2525+
one_time_password: Optional[str] = None
25262526
"""
2527-
New temporary password, encoded in base64.
2527+
New temporary password (deprecated, use password_b64 instead).
25282528
"""
25292529

25302530

0 commit comments

Comments
 (0)