diff --git a/scaleway-async/scaleway_async/webhosting/v1/__init__.py b/scaleway-async/scaleway_async/webhosting/v1/__init__.py index f3faa9b01..820010080 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/__init__.py +++ b/scaleway-async/scaleway_async/webhosting/v1/__init__.py @@ -1,6 +1,6 @@ # This file was automatically generated. DO NOT EDIT. # If you have any remark or suggestion do not hesitate to open an issue. -from .types import HostingDnsStatus +from .types import DnsRecordsStatus from .types import HostingStatus from .content import HOSTING_TRANSIENT_STATUSES from .types import HostingSummaryStatus @@ -14,18 +14,21 @@ from .types import ListWebsitesRequestOrderBy from .types import OfferOptionName from .types import OfferOptionWarning +from .types import PlatformPlatformGroup +from .types import PlatformControlPanelUrls from .types import OfferOption +from .types import PlatformControlPanel from .types import CreateHostingRequestDomainConfiguration from .types import OfferOptionRequest -from .types import HostingCpanelUrls -from .types import HostingOption +from .types import HostingUser +from .types import Offer +from .types import Platform from .types import ControlPanel from .types import DatabaseUser from .types import Database from .types import FtpAccount from .types import HostingSummary from .types import MailAccount -from .types import Offer from .types import Website from .types import ControlPanelApiListControlPanelsRequest from .types import DatabaseApiAssignDatabaseUserRequest @@ -78,7 +81,7 @@ from .api import WebhostingV1WebsiteAPI __all__ = [ - "HostingDnsStatus", + "DnsRecordsStatus", "HostingStatus", "HOSTING_TRANSIENT_STATUSES", "HostingSummaryStatus", @@ -92,18 +95,21 @@ "ListWebsitesRequestOrderBy", "OfferOptionName", "OfferOptionWarning", + "PlatformPlatformGroup", + "PlatformControlPanelUrls", "OfferOption", + "PlatformControlPanel", "CreateHostingRequestDomainConfiguration", "OfferOptionRequest", - "HostingCpanelUrls", - "HostingOption", + "HostingUser", + "Offer", + "Platform", "ControlPanel", "DatabaseUser", "Database", "FtpAccount", "HostingSummary", "MailAccount", - "Offer", "Website", "ControlPanelApiListControlPanelsRequest", "DatabaseApiAssignDatabaseUserRequest", diff --git a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py index 13ea36a39..586bee2b4 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py +++ b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py @@ -13,8 +13,12 @@ Database, FtpAccount, MailAccount, - HostingCpanelUrls, - HostingOption, + PlatformControlPanelUrls, + OfferOption, + PlatformControlPanel, + HostingUser, + Offer, + Platform, Hosting, ControlPanel, ListControlPanelsResponse, @@ -24,8 +28,6 @@ HostingSummary, ListHostingsResponse, ListMailAccountsResponse, - OfferOption, - Offer, ListOffersResponse, Website, ListWebsitesResponse, @@ -128,10 +130,10 @@ def unmarshal_MailAccount(data: Any) -> MailAccount: return MailAccount(**args) -def unmarshal_HostingCpanelUrls(data: Any) -> HostingCpanelUrls: +def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls: if not isinstance(data, dict): raise TypeError( - "Unmarshalling the type 'HostingCpanelUrls' failed as data isn't a dictionary." + "Unmarshalling the type 'PlatformControlPanelUrls' failed as data isn't a dictionary." ) args: Dict[str, Any] = {} @@ -144,13 +146,13 @@ def unmarshal_HostingCpanelUrls(data: Any) -> HostingCpanelUrls: if field is not None: args["webmail"] = field - return HostingCpanelUrls(**args) + return PlatformControlPanelUrls(**args) -def unmarshal_HostingOption(data: Any) -> HostingOption: +def unmarshal_OfferOption(data: Any) -> OfferOption: if not isinstance(data, dict): raise TypeError( - "Unmarshalling the type 'HostingOption' failed as data isn't a dictionary." + "Unmarshalling the type 'OfferOption' failed as data isn't a dictionary." ) args: Dict[str, Any] = {} @@ -163,94 +165,137 @@ def unmarshal_HostingOption(data: Any) -> HostingOption: if field is not None: args["name"] = field - field = data.get("quantity", None) + field = data.get("billing_operation_path", None) if field is not None: - args["quantity"] = field + args["billing_operation_path"] = field - return HostingOption(**args) + field = data.get("min_value", None) + if field is not None: + args["min_value"] = field + field = data.get("current_value", None) + if field is not None: + args["current_value"] = field -def unmarshal_Hosting(data: Any) -> Hosting: + field = data.get("max_value", None) + if field is not None: + args["max_value"] = field + + field = data.get("quota_warning", None) + if field is not None: + args["quota_warning"] = field + + return OfferOption(**args) + + +def unmarshal_PlatformControlPanel(data: Any) -> PlatformControlPanel: if not isinstance(data, dict): raise TypeError( - "Unmarshalling the type 'Hosting' failed as data isn't a dictionary." + "Unmarshalling the type 'PlatformControlPanel' failed as data isn't a dictionary." ) args: Dict[str, Any] = {} - field = data.get("id", None) + field = data.get("name", None) if field is not None: - args["id"] = field + args["name"] = field - field = data.get("project_id", None) + field = data.get("urls", None) if field is not None: - args["project_id"] = field + args["urls"] = unmarshal_PlatformControlPanelUrls(field) + else: + args["urls"] = None - field = data.get("status", None) - if field is not None: - args["status"] = field + return PlatformControlPanel(**args) - field = data.get("platform_hostname", None) - if field is not None: - args["platform_hostname"] = field - field = data.get("platform_number", None) +def unmarshal_HostingUser(data: Any) -> HostingUser: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'HostingUser' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("username", None) if field is not None: - args["platform_number"] = field + args["username"] = field - field = data.get("offer_id", None) + field = data.get("contact_email", None) if field is not None: - args["offer_id"] = field + args["contact_email"] = field - field = data.get("offer_name", None) + field = data.get("one_time_password", None) if field is not None: - args["offer_name"] = field + args["one_time_password"] = field + else: + args["one_time_password"] = None - field = data.get("domain", None) + return HostingUser(**args) + + +def unmarshal_Offer(data: Any) -> Offer: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Offer' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("id", None) if field is not None: - args["domain"] = field + args["id"] = field - field = data.get("tags", None) + field = data.get("billing_operation_path", None) if field is not None: - args["tags"] = field + args["billing_operation_path"] = field field = data.get("options", None) if field is not None: args["options"] = ( - [unmarshal_HostingOption(v) for v in field] if field is not None else None + [unmarshal_OfferOption(v) for v in field] if field is not None else None ) - field = data.get("updated_at", None) + field = data.get("available", None) if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None + args["available"] = field - field = data.get("created_at", None) + field = data.get("control_panel_name", None) if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None + args["control_panel_name"] = field - field = data.get("dns_status", None) + field = data.get("end_of_life", None) if field is not None: - args["dns_status"] = field + args["end_of_life"] = field - field = data.get("username", None) + field = data.get("price", None) if field is not None: - args["username"] = field + args["price"] = unmarshal_Money(field) + else: + args["price"] = None + + return Offer(**args) + + +def unmarshal_Platform(data: Any) -> Platform: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Platform' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} - field = data.get("offer_end_of_life", None) + field = data.get("hostname", None) if field is not None: - args["offer_end_of_life"] = field + args["hostname"] = field - field = data.get("control_panel_name", None) + field = data.get("number", None) if field is not None: - args["control_panel_name"] = field + args["number"] = field - field = data.get("platform_group", None) + field = data.get("group_name", None) if field is not None: - args["platform_group"] = field + args["group_name"] = field field = data.get("ipv4", None) if field is not None: @@ -260,27 +305,88 @@ def unmarshal_Hosting(data: Any) -> Hosting: if field is not None: args["ipv6"] = field - field = data.get("protected", None) + field = data.get("control_panel", None) if field is not None: - args["protected"] = field + args["control_panel"] = unmarshal_PlatformControlPanel(field) + else: + args["control_panel"] = None - field = data.get("one_time_password", None) + return Platform(**args) + + +def unmarshal_Hosting(data: Any) -> Hosting: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Hosting' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("id", None) if field is not None: - args["one_time_password"] = field + args["id"] = field - field = data.get("contact_email", None) + field = data.get("project_id", None) if field is not None: - args["contact_email"] = field + args["project_id"] = field + + field = data.get("status", None) + 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("dns_status", None) + if field is not None: + args["dns_status"] = field + + field = data.get("updated_at", None) + if field is not None: + args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["updated_at"] = None + + 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("cpanel_urls", None) + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("offer", None) + if field is not None: + args["offer"] = unmarshal_Offer(field) + else: + args["offer"] = None + + field = data.get("platform", None) if field is not None: - args["cpanel_urls"] = unmarshal_HostingCpanelUrls(field) + args["platform"] = unmarshal_Platform(field) else: - args["cpanel_urls"] = None + args["platform"] = None + + field = data.get("user", None) + if field is not None: + args["user"] = unmarshal_HostingUser(field) + else: + args["user"] = None return Hosting(**args) @@ -487,88 +593,6 @@ def unmarshal_ListMailAccountsResponse(data: Any) -> ListMailAccountsResponse: return ListMailAccountsResponse(**args) -def unmarshal_OfferOption(data: Any) -> OfferOption: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'OfferOption' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("billing_operation_path", None) - if field is not None: - args["billing_operation_path"] = field - - field = data.get("min_value", None) - if field is not None: - args["min_value"] = field - - field = data.get("current_value", None) - if field is not None: - args["current_value"] = field - - field = data.get("max_value", None) - if field is not None: - args["max_value"] = field - - field = data.get("quota_warning", None) - if field is not None: - args["quota_warning"] = field - - return OfferOption(**args) - - -def unmarshal_Offer(data: Any) -> Offer: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Offer' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("billing_operation_path", None) - if field is not None: - args["billing_operation_path"] = field - - field = data.get("options", None) - if field is not None: - args["options"] = ( - [unmarshal_OfferOption(v) for v in field] if field is not None else None - ) - - field = data.get("available", None) - if field is not None: - args["available"] = field - - field = data.get("control_panel_name", None) - if field is not None: - args["control_panel_name"] = field - - field = data.get("end_of_life", None) - if field is not None: - args["end_of_life"] = field - - field = data.get("price", None) - if field is not None: - args["price"] = unmarshal_Money(field) - else: - args["price"] = None - - return Offer(**args) - - def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway-async/scaleway_async/webhosting/v1/types.py b/scaleway-async/scaleway_async/webhosting/v1/types.py index baddf70c7..0bdcc8a3e 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/types.py +++ b/scaleway-async/scaleway_async/webhosting/v1/types.py @@ -20,8 +20,8 @@ ) -class HostingDnsStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_DNS_STATUS = "unknown_dns_status" +class DnsRecordsStatus(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_STATUS = "unknown_status" VALID = "valid" INVALID = "invalid" @@ -134,6 +134,28 @@ def __str__(self) -> str: return str(self.value) +class PlatformPlatformGroup(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_GROUP = "unknown_group" + DEFAULT = "default" + PREMIUM = "premium" + + def __str__(self) -> str: + return str(self.value) + + +@dataclass +class PlatformControlPanelUrls: + dashboard: str + """ + URL to connect to the hosting control panel dashboard. + """ + + webmail: str + """ + URL to connect to the hosting Webmail interface. + """ + + @dataclass class OfferOption: id: str @@ -172,6 +194,19 @@ class OfferOption: """ +@dataclass +class PlatformControlPanel: + name: str + """ + Name of the control panel. + """ + + urls: Optional[PlatformControlPanelUrls] + """ + URL to connect to cPanel dashboard and to Webmail interface. + """ + + @dataclass class CreateHostingRequestDomainConfiguration: update_nameservers: bool @@ -197,27 +232,91 @@ class OfferOptionRequest: @dataclass -class HostingCpanelUrls: - dashboard: str +class HostingUser: + username: str + """ + Main Web Hosting cPanel username. + """ - webmail: str + contact_email: str + """ + Contact email used for the hosting. + """ + + one_time_password: Optional[str] + """ + One-time-password used for the first login or reset password, empty after first use. + """ @dataclass -class HostingOption: +class Offer: id: str """ - Option ID. + Offer ID. """ - name: OfferOptionName + billing_operation_path: str """ - Option name. + Unique identifier used for billing. """ - quantity: int + options: List[OfferOption] + """ + Options available for the offer. + """ + + available: bool + """ + If a hosting_id was specified in the call, defines whether the offer is available for a specified hosting plan to migrate (update) to. + """ + + control_panel_name: str + """ + Name of the control panel. + """ + + end_of_life: bool + """ + Indicates if the offer has reached its end of life. """ - Option quantity. + + price: Optional[Money] + """ + Price of the offer. + """ + + +@dataclass +class Platform: + hostname: str + """ + Hostname of the host platform. + """ + + number: int + """ + Number of the host platform. + """ + + group_name: PlatformPlatformGroup + """ + Group name of the hosting's host platform. + """ + + ipv4: str + """ + IPv4 address of the hosting's host platform. + """ + + ipv6: str + """ + IPv6 address of the hosting's host platform. + """ + + control_panel: Optional[PlatformControlPanel] + """ + Details of the platform control panel. """ @@ -339,44 +438,6 @@ class MailAccount: """ -@dataclass -class Offer: - id: str - """ - Offer ID. - """ - - billing_operation_path: str - """ - Unique identifier used for billing. - """ - - options: List[OfferOption] - """ - Options available for the offer. - """ - - available: bool - """ - If a hosting_id was specified in the call, defines whether the offer is available for a specified hosting plan to migrate (update) to. - """ - - control_panel_name: str - """ - Name of the control panel. - """ - - end_of_life: bool - """ - Indicates if the offer has reached its end of life. - """ - - price: Optional[Money] - """ - Price of the offer. - """ - - @dataclass class Website: domain: str @@ -770,26 +831,6 @@ class Hosting: Status of the Web Hosting plan. """ - platform_hostname: str - """ - Hostname of the host platform. - """ - - platform_number: int - """ - Number of the host platform. - """ - - offer_id: str - """ - ID of the active offer for the Web Hosting plan. - """ - - offer_name: str - """ - Name of the active offer for the Web Hosting plan. - """ - domain: str """ Main domain associated with the Web Hosting plan. @@ -800,9 +841,9 @@ class Hosting: List of tags associated with the Web Hosting plan. """ - options: List[HostingOption] + dns_status: DnsRecordsStatus """ - List of the Web Hosting plan options. + DNS status of the Web Hosting plan. """ updated_at: Optional[datetime] @@ -810,69 +851,39 @@ class Hosting: Date on which the Web Hosting plan was last updated. """ - created_at: Optional[datetime] - """ - Date on which the Web Hosting plan was created. - """ - - dns_status: HostingDnsStatus - """ - DNS status of the Web Hosting plan. - """ - - username: str - """ - Main Web Hosting cPanel username. - """ - - offer_end_of_life: bool - """ - Indicates if the hosting offer has reached its end of life. - """ - - control_panel_name: str - """ - Name of the control panel. - """ - - platform_group: str - """ - Group of the hosting's host server/platform. - """ - ipv4: str """ - IPv4 address of the hosting's host server. + Current IPv4 address of the hosting. """ - ipv6: str + protected: bool """ - IPv6 address of the hosting's host server. + Whether the hosting is protected or not. """ - protected: bool + region: Region """ - Whether the hosting is protected or not. + Region where the Web Hosting plan is hosted. """ - one_time_password: str + created_at: Optional[datetime] """ - One-time-password used for the first login or reset password, empty after first use. + Date on which the Web Hosting plan was created. """ - contact_email: str + offer: Optional[Offer] """ - Contact email used for the hosting. + Details of the Web Hosting plan offer and options. """ - region: Region + platform: Optional[Platform] """ - Region where the Web Hosting plan is hosted. + Details of the hosting platform. """ - cpanel_urls: Optional[HostingCpanelUrls] + user: Optional[HostingUser] """ - URL to connect to cPanel dashboard and to Webmail interface. + Details of the hosting user. """ diff --git a/scaleway/scaleway/webhosting/v1/__init__.py b/scaleway/scaleway/webhosting/v1/__init__.py index f3faa9b01..820010080 100644 --- a/scaleway/scaleway/webhosting/v1/__init__.py +++ b/scaleway/scaleway/webhosting/v1/__init__.py @@ -1,6 +1,6 @@ # This file was automatically generated. DO NOT EDIT. # If you have any remark or suggestion do not hesitate to open an issue. -from .types import HostingDnsStatus +from .types import DnsRecordsStatus from .types import HostingStatus from .content import HOSTING_TRANSIENT_STATUSES from .types import HostingSummaryStatus @@ -14,18 +14,21 @@ from .types import ListWebsitesRequestOrderBy from .types import OfferOptionName from .types import OfferOptionWarning +from .types import PlatformPlatformGroup +from .types import PlatformControlPanelUrls from .types import OfferOption +from .types import PlatformControlPanel from .types import CreateHostingRequestDomainConfiguration from .types import OfferOptionRequest -from .types import HostingCpanelUrls -from .types import HostingOption +from .types import HostingUser +from .types import Offer +from .types import Platform from .types import ControlPanel from .types import DatabaseUser from .types import Database from .types import FtpAccount from .types import HostingSummary from .types import MailAccount -from .types import Offer from .types import Website from .types import ControlPanelApiListControlPanelsRequest from .types import DatabaseApiAssignDatabaseUserRequest @@ -78,7 +81,7 @@ from .api import WebhostingV1WebsiteAPI __all__ = [ - "HostingDnsStatus", + "DnsRecordsStatus", "HostingStatus", "HOSTING_TRANSIENT_STATUSES", "HostingSummaryStatus", @@ -92,18 +95,21 @@ "ListWebsitesRequestOrderBy", "OfferOptionName", "OfferOptionWarning", + "PlatformPlatformGroup", + "PlatformControlPanelUrls", "OfferOption", + "PlatformControlPanel", "CreateHostingRequestDomainConfiguration", "OfferOptionRequest", - "HostingCpanelUrls", - "HostingOption", + "HostingUser", + "Offer", + "Platform", "ControlPanel", "DatabaseUser", "Database", "FtpAccount", "HostingSummary", "MailAccount", - "Offer", "Website", "ControlPanelApiListControlPanelsRequest", "DatabaseApiAssignDatabaseUserRequest", diff --git a/scaleway/scaleway/webhosting/v1/marshalling.py b/scaleway/scaleway/webhosting/v1/marshalling.py index 13ea36a39..586bee2b4 100644 --- a/scaleway/scaleway/webhosting/v1/marshalling.py +++ b/scaleway/scaleway/webhosting/v1/marshalling.py @@ -13,8 +13,12 @@ Database, FtpAccount, MailAccount, - HostingCpanelUrls, - HostingOption, + PlatformControlPanelUrls, + OfferOption, + PlatformControlPanel, + HostingUser, + Offer, + Platform, Hosting, ControlPanel, ListControlPanelsResponse, @@ -24,8 +28,6 @@ HostingSummary, ListHostingsResponse, ListMailAccountsResponse, - OfferOption, - Offer, ListOffersResponse, Website, ListWebsitesResponse, @@ -128,10 +130,10 @@ def unmarshal_MailAccount(data: Any) -> MailAccount: return MailAccount(**args) -def unmarshal_HostingCpanelUrls(data: Any) -> HostingCpanelUrls: +def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls: if not isinstance(data, dict): raise TypeError( - "Unmarshalling the type 'HostingCpanelUrls' failed as data isn't a dictionary." + "Unmarshalling the type 'PlatformControlPanelUrls' failed as data isn't a dictionary." ) args: Dict[str, Any] = {} @@ -144,13 +146,13 @@ def unmarshal_HostingCpanelUrls(data: Any) -> HostingCpanelUrls: if field is not None: args["webmail"] = field - return HostingCpanelUrls(**args) + return PlatformControlPanelUrls(**args) -def unmarshal_HostingOption(data: Any) -> HostingOption: +def unmarshal_OfferOption(data: Any) -> OfferOption: if not isinstance(data, dict): raise TypeError( - "Unmarshalling the type 'HostingOption' failed as data isn't a dictionary." + "Unmarshalling the type 'OfferOption' failed as data isn't a dictionary." ) args: Dict[str, Any] = {} @@ -163,94 +165,137 @@ def unmarshal_HostingOption(data: Any) -> HostingOption: if field is not None: args["name"] = field - field = data.get("quantity", None) + field = data.get("billing_operation_path", None) if field is not None: - args["quantity"] = field + args["billing_operation_path"] = field - return HostingOption(**args) + field = data.get("min_value", None) + if field is not None: + args["min_value"] = field + field = data.get("current_value", None) + if field is not None: + args["current_value"] = field -def unmarshal_Hosting(data: Any) -> Hosting: + field = data.get("max_value", None) + if field is not None: + args["max_value"] = field + + field = data.get("quota_warning", None) + if field is not None: + args["quota_warning"] = field + + return OfferOption(**args) + + +def unmarshal_PlatformControlPanel(data: Any) -> PlatformControlPanel: if not isinstance(data, dict): raise TypeError( - "Unmarshalling the type 'Hosting' failed as data isn't a dictionary." + "Unmarshalling the type 'PlatformControlPanel' failed as data isn't a dictionary." ) args: Dict[str, Any] = {} - field = data.get("id", None) + field = data.get("name", None) if field is not None: - args["id"] = field + args["name"] = field - field = data.get("project_id", None) + field = data.get("urls", None) if field is not None: - args["project_id"] = field + args["urls"] = unmarshal_PlatformControlPanelUrls(field) + else: + args["urls"] = None - field = data.get("status", None) - if field is not None: - args["status"] = field + return PlatformControlPanel(**args) - field = data.get("platform_hostname", None) - if field is not None: - args["platform_hostname"] = field - field = data.get("platform_number", None) +def unmarshal_HostingUser(data: Any) -> HostingUser: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'HostingUser' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("username", None) if field is not None: - args["platform_number"] = field + args["username"] = field - field = data.get("offer_id", None) + field = data.get("contact_email", None) if field is not None: - args["offer_id"] = field + args["contact_email"] = field - field = data.get("offer_name", None) + field = data.get("one_time_password", None) if field is not None: - args["offer_name"] = field + args["one_time_password"] = field + else: + args["one_time_password"] = None - field = data.get("domain", None) + return HostingUser(**args) + + +def unmarshal_Offer(data: Any) -> Offer: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Offer' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("id", None) if field is not None: - args["domain"] = field + args["id"] = field - field = data.get("tags", None) + field = data.get("billing_operation_path", None) if field is not None: - args["tags"] = field + args["billing_operation_path"] = field field = data.get("options", None) if field is not None: args["options"] = ( - [unmarshal_HostingOption(v) for v in field] if field is not None else None + [unmarshal_OfferOption(v) for v in field] if field is not None else None ) - field = data.get("updated_at", None) + field = data.get("available", None) if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None + args["available"] = field - field = data.get("created_at", None) + field = data.get("control_panel_name", None) if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None + args["control_panel_name"] = field - field = data.get("dns_status", None) + field = data.get("end_of_life", None) if field is not None: - args["dns_status"] = field + args["end_of_life"] = field - field = data.get("username", None) + field = data.get("price", None) if field is not None: - args["username"] = field + args["price"] = unmarshal_Money(field) + else: + args["price"] = None + + return Offer(**args) + + +def unmarshal_Platform(data: Any) -> Platform: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Platform' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} - field = data.get("offer_end_of_life", None) + field = data.get("hostname", None) if field is not None: - args["offer_end_of_life"] = field + args["hostname"] = field - field = data.get("control_panel_name", None) + field = data.get("number", None) if field is not None: - args["control_panel_name"] = field + args["number"] = field - field = data.get("platform_group", None) + field = data.get("group_name", None) if field is not None: - args["platform_group"] = field + args["group_name"] = field field = data.get("ipv4", None) if field is not None: @@ -260,27 +305,88 @@ def unmarshal_Hosting(data: Any) -> Hosting: if field is not None: args["ipv6"] = field - field = data.get("protected", None) + field = data.get("control_panel", None) if field is not None: - args["protected"] = field + args["control_panel"] = unmarshal_PlatformControlPanel(field) + else: + args["control_panel"] = None - field = data.get("one_time_password", None) + return Platform(**args) + + +def unmarshal_Hosting(data: Any) -> Hosting: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Hosting' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("id", None) if field is not None: - args["one_time_password"] = field + args["id"] = field - field = data.get("contact_email", None) + field = data.get("project_id", None) if field is not None: - args["contact_email"] = field + args["project_id"] = field + + field = data.get("status", None) + 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("dns_status", None) + if field is not None: + args["dns_status"] = field + + field = data.get("updated_at", None) + if field is not None: + args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["updated_at"] = None + + 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("cpanel_urls", None) + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("offer", None) + if field is not None: + args["offer"] = unmarshal_Offer(field) + else: + args["offer"] = None + + field = data.get("platform", None) if field is not None: - args["cpanel_urls"] = unmarshal_HostingCpanelUrls(field) + args["platform"] = unmarshal_Platform(field) else: - args["cpanel_urls"] = None + args["platform"] = None + + field = data.get("user", None) + if field is not None: + args["user"] = unmarshal_HostingUser(field) + else: + args["user"] = None return Hosting(**args) @@ -487,88 +593,6 @@ def unmarshal_ListMailAccountsResponse(data: Any) -> ListMailAccountsResponse: return ListMailAccountsResponse(**args) -def unmarshal_OfferOption(data: Any) -> OfferOption: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'OfferOption' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("billing_operation_path", None) - if field is not None: - args["billing_operation_path"] = field - - field = data.get("min_value", None) - if field is not None: - args["min_value"] = field - - field = data.get("current_value", None) - if field is not None: - args["current_value"] = field - - field = data.get("max_value", None) - if field is not None: - args["max_value"] = field - - field = data.get("quota_warning", None) - if field is not None: - args["quota_warning"] = field - - return OfferOption(**args) - - -def unmarshal_Offer(data: Any) -> Offer: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Offer' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("billing_operation_path", None) - if field is not None: - args["billing_operation_path"] = field - - field = data.get("options", None) - if field is not None: - args["options"] = ( - [unmarshal_OfferOption(v) for v in field] if field is not None else None - ) - - field = data.get("available", None) - if field is not None: - args["available"] = field - - field = data.get("control_panel_name", None) - if field is not None: - args["control_panel_name"] = field - - field = data.get("end_of_life", None) - if field is not None: - args["end_of_life"] = field - - field = data.get("price", None) - if field is not None: - args["price"] = unmarshal_Money(field) - else: - args["price"] = None - - return Offer(**args) - - def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway/scaleway/webhosting/v1/types.py b/scaleway/scaleway/webhosting/v1/types.py index baddf70c7..0bdcc8a3e 100644 --- a/scaleway/scaleway/webhosting/v1/types.py +++ b/scaleway/scaleway/webhosting/v1/types.py @@ -20,8 +20,8 @@ ) -class HostingDnsStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_DNS_STATUS = "unknown_dns_status" +class DnsRecordsStatus(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_STATUS = "unknown_status" VALID = "valid" INVALID = "invalid" @@ -134,6 +134,28 @@ def __str__(self) -> str: return str(self.value) +class PlatformPlatformGroup(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_GROUP = "unknown_group" + DEFAULT = "default" + PREMIUM = "premium" + + def __str__(self) -> str: + return str(self.value) + + +@dataclass +class PlatformControlPanelUrls: + dashboard: str + """ + URL to connect to the hosting control panel dashboard. + """ + + webmail: str + """ + URL to connect to the hosting Webmail interface. + """ + + @dataclass class OfferOption: id: str @@ -172,6 +194,19 @@ class OfferOption: """ +@dataclass +class PlatformControlPanel: + name: str + """ + Name of the control panel. + """ + + urls: Optional[PlatformControlPanelUrls] + """ + URL to connect to cPanel dashboard and to Webmail interface. + """ + + @dataclass class CreateHostingRequestDomainConfiguration: update_nameservers: bool @@ -197,27 +232,91 @@ class OfferOptionRequest: @dataclass -class HostingCpanelUrls: - dashboard: str +class HostingUser: + username: str + """ + Main Web Hosting cPanel username. + """ - webmail: str + contact_email: str + """ + Contact email used for the hosting. + """ + + one_time_password: Optional[str] + """ + One-time-password used for the first login or reset password, empty after first use. + """ @dataclass -class HostingOption: +class Offer: id: str """ - Option ID. + Offer ID. """ - name: OfferOptionName + billing_operation_path: str """ - Option name. + Unique identifier used for billing. """ - quantity: int + options: List[OfferOption] + """ + Options available for the offer. + """ + + available: bool + """ + If a hosting_id was specified in the call, defines whether the offer is available for a specified hosting plan to migrate (update) to. + """ + + control_panel_name: str + """ + Name of the control panel. + """ + + end_of_life: bool + """ + Indicates if the offer has reached its end of life. """ - Option quantity. + + price: Optional[Money] + """ + Price of the offer. + """ + + +@dataclass +class Platform: + hostname: str + """ + Hostname of the host platform. + """ + + number: int + """ + Number of the host platform. + """ + + group_name: PlatformPlatformGroup + """ + Group name of the hosting's host platform. + """ + + ipv4: str + """ + IPv4 address of the hosting's host platform. + """ + + ipv6: str + """ + IPv6 address of the hosting's host platform. + """ + + control_panel: Optional[PlatformControlPanel] + """ + Details of the platform control panel. """ @@ -339,44 +438,6 @@ class MailAccount: """ -@dataclass -class Offer: - id: str - """ - Offer ID. - """ - - billing_operation_path: str - """ - Unique identifier used for billing. - """ - - options: List[OfferOption] - """ - Options available for the offer. - """ - - available: bool - """ - If a hosting_id was specified in the call, defines whether the offer is available for a specified hosting plan to migrate (update) to. - """ - - control_panel_name: str - """ - Name of the control panel. - """ - - end_of_life: bool - """ - Indicates if the offer has reached its end of life. - """ - - price: Optional[Money] - """ - Price of the offer. - """ - - @dataclass class Website: domain: str @@ -770,26 +831,6 @@ class Hosting: Status of the Web Hosting plan. """ - platform_hostname: str - """ - Hostname of the host platform. - """ - - platform_number: int - """ - Number of the host platform. - """ - - offer_id: str - """ - ID of the active offer for the Web Hosting plan. - """ - - offer_name: str - """ - Name of the active offer for the Web Hosting plan. - """ - domain: str """ Main domain associated with the Web Hosting plan. @@ -800,9 +841,9 @@ class Hosting: List of tags associated with the Web Hosting plan. """ - options: List[HostingOption] + dns_status: DnsRecordsStatus """ - List of the Web Hosting plan options. + DNS status of the Web Hosting plan. """ updated_at: Optional[datetime] @@ -810,69 +851,39 @@ class Hosting: Date on which the Web Hosting plan was last updated. """ - created_at: Optional[datetime] - """ - Date on which the Web Hosting plan was created. - """ - - dns_status: HostingDnsStatus - """ - DNS status of the Web Hosting plan. - """ - - username: str - """ - Main Web Hosting cPanel username. - """ - - offer_end_of_life: bool - """ - Indicates if the hosting offer has reached its end of life. - """ - - control_panel_name: str - """ - Name of the control panel. - """ - - platform_group: str - """ - Group of the hosting's host server/platform. - """ - ipv4: str """ - IPv4 address of the hosting's host server. + Current IPv4 address of the hosting. """ - ipv6: str + protected: bool """ - IPv6 address of the hosting's host server. + Whether the hosting is protected or not. """ - protected: bool + region: Region """ - Whether the hosting is protected or not. + Region where the Web Hosting plan is hosted. """ - one_time_password: str + created_at: Optional[datetime] """ - One-time-password used for the first login or reset password, empty after first use. + Date on which the Web Hosting plan was created. """ - contact_email: str + offer: Optional[Offer] """ - Contact email used for the hosting. + Details of the Web Hosting plan offer and options. """ - region: Region + platform: Optional[Platform] """ - Region where the Web Hosting plan is hosted. + Details of the hosting platform. """ - cpanel_urls: Optional[HostingCpanelUrls] + user: Optional[HostingUser] """ - URL to connect to cPanel dashboard and to Webmail interface. + Details of the hosting user. """