Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 42 additions & 27 deletions scaleway-async/scaleway_async/webhosting/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
FtpAccount,
MailAccount,
CheckUserOwnsDomainResponse,
AutoConfigDomainDns,
DnsRecord,
Nameserver,
DnsRecords,
AutoConfigDomainDns,
Domain,
PlatformControlPanelUrls,
OfferOption,
Expand Down Expand Up @@ -164,6 +164,37 @@ def unmarshal_CheckUserOwnsDomainResponse(data: Any) -> CheckUserOwnsDomainRespo
return CheckUserOwnsDomainResponse(**args)


def unmarshal_AutoConfigDomainDns(data: Any) -> AutoConfigDomainDns:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'AutoConfigDomainDns' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("nameservers", None)
if field is not None:
args["nameservers"] = field

field = data.get("web_records", None)
if field is not None:
args["web_records"] = field

field = data.get("mail_records", None)
if field is not None:
args["mail_records"] = field

field = data.get("all_records", None)
if field is not None:
args["all_records"] = field

field = data.get("none", None)
if field is not None:
args["none"] = field

return AutoConfigDomainDns(**args)


def unmarshal_DnsRecord(data: Any) -> DnsRecord:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -257,35 +288,16 @@ def unmarshal_DnsRecords(data: Any) -> DnsRecords:
args["dns_config"] = (
[DomainDnsAction(v) for v in field] if field is not None else None
)
else:
args["dns_config"] = None

return DnsRecords(**args)


def unmarshal_AutoConfigDomainDns(data: Any) -> AutoConfigDomainDns:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'AutoConfigDomainDns' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("nameservers", None)
if field is not None:
args["nameservers"] = field

field = data.get("web_records", None)
if field is not None:
args["web_records"] = field

field = data.get("mail_records", None)
if field is not None:
args["mail_records"] = field

field = data.get("all_records", None)
field = data.get("auto_config_domain_dns", None)
if field is not None:
args["all_records"] = field
args["auto_config_domain_dns"] = unmarshal_AutoConfigDomainDns(field)
else:
args["auto_config_domain_dns"] = None

return AutoConfigDomainDns(**args)
return DnsRecords(**args)


def unmarshal_Domain(data: Any) -> Domain:
Expand Down Expand Up @@ -1124,6 +1136,9 @@ def marshal_AutoConfigDomainDns(
if request.all_records is not None:
output["all_records"] = request.all_records

if request.none is not None:
output["none"] = request.none

return output


Expand Down
14 changes: 12 additions & 2 deletions scaleway-async/scaleway_async/webhosting/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ class AutoConfigDomainDns:
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 CreateHostingRequestDomainConfiguration:
Expand Down Expand Up @@ -1095,9 +1100,14 @@ class DnsRecords:
Status of the records.
"""

dns_config: List[DomainDnsAction]
dns_config: Optional[List[DomainDnsAction]]
"""
Records dns auto configuration settings (deprecated, use auto_config_domain_dns).
"""

auto_config_domain_dns: Optional[AutoConfigDomainDns]
"""
Records dns auto configuration settings.
Whether or not to synchronize each types of records.
"""


Expand Down
69 changes: 42 additions & 27 deletions scaleway/scaleway/webhosting/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
FtpAccount,
MailAccount,
CheckUserOwnsDomainResponse,
AutoConfigDomainDns,
DnsRecord,
Nameserver,
DnsRecords,
AutoConfigDomainDns,
Domain,
PlatformControlPanelUrls,
OfferOption,
Expand Down Expand Up @@ -164,6 +164,37 @@ def unmarshal_CheckUserOwnsDomainResponse(data: Any) -> CheckUserOwnsDomainRespo
return CheckUserOwnsDomainResponse(**args)


def unmarshal_AutoConfigDomainDns(data: Any) -> AutoConfigDomainDns:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'AutoConfigDomainDns' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("nameservers", None)
if field is not None:
args["nameservers"] = field

field = data.get("web_records", None)
if field is not None:
args["web_records"] = field

field = data.get("mail_records", None)
if field is not None:
args["mail_records"] = field

field = data.get("all_records", None)
if field is not None:
args["all_records"] = field

field = data.get("none", None)
if field is not None:
args["none"] = field

return AutoConfigDomainDns(**args)


def unmarshal_DnsRecord(data: Any) -> DnsRecord:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -257,35 +288,16 @@ def unmarshal_DnsRecords(data: Any) -> DnsRecords:
args["dns_config"] = (
[DomainDnsAction(v) for v in field] if field is not None else None
)
else:
args["dns_config"] = None

return DnsRecords(**args)


def unmarshal_AutoConfigDomainDns(data: Any) -> AutoConfigDomainDns:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'AutoConfigDomainDns' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("nameservers", None)
if field is not None:
args["nameservers"] = field

field = data.get("web_records", None)
if field is not None:
args["web_records"] = field

field = data.get("mail_records", None)
if field is not None:
args["mail_records"] = field

field = data.get("all_records", None)
field = data.get("auto_config_domain_dns", None)
if field is not None:
args["all_records"] = field
args["auto_config_domain_dns"] = unmarshal_AutoConfigDomainDns(field)
else:
args["auto_config_domain_dns"] = None

return AutoConfigDomainDns(**args)
return DnsRecords(**args)


def unmarshal_Domain(data: Any) -> Domain:
Expand Down Expand Up @@ -1124,6 +1136,9 @@ def marshal_AutoConfigDomainDns(
if request.all_records is not None:
output["all_records"] = request.all_records

if request.none is not None:
output["none"] = request.none

return output


Expand Down
14 changes: 12 additions & 2 deletions scaleway/scaleway/webhosting/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ class AutoConfigDomainDns:
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 CreateHostingRequestDomainConfiguration:
Expand Down Expand Up @@ -1095,9 +1100,14 @@ class DnsRecords:
Status of the records.
"""

dns_config: List[DomainDnsAction]
dns_config: Optional[List[DomainDnsAction]]
"""
Records dns auto configuration settings (deprecated, use auto_config_domain_dns).
"""

auto_config_domain_dns: Optional[AutoConfigDomainDns]
"""
Records dns auto configuration settings.
Whether or not to synchronize each types of records.
"""


Expand Down