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
8 changes: 6 additions & 2 deletions scaleway-async/scaleway_async/webhosting/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
from .types import OfferOptionName
from .types import OfferOptionWarning
from .types import PlatformPlatformGroup
from .types import AutoConfigDomainDns
from .types import PlatformControlPanelUrls
from .types import HostingDomainCustomDomain
from .types import OfferOption
from .types import PlatformControlPanel
from .types import HostingDomain
from .types import CreateDatabaseRequestUser
from .types import AutoConfigDomainDns
from .types import CreateHostingRequestDomainConfiguration
from .types import OfferOptionRequest
from .types import SyncDomainDnsRecordsRequestRecord
Expand Down Expand Up @@ -130,11 +132,13 @@
"OfferOptionName",
"OfferOptionWarning",
"PlatformPlatformGroup",
"AutoConfigDomainDns",
"PlatformControlPanelUrls",
"HostingDomainCustomDomain",
"OfferOption",
"PlatformControlPanel",
"HostingDomain",
"CreateDatabaseRequestUser",
"AutoConfigDomainDns",
"CreateHostingRequestDomainConfiguration",
"OfferOptionRequest",
"SyncDomainDnsRecordsRequestRecord",
Expand Down
9 changes: 9 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@ async def create_hosting(
region: Optional[ScwRegion] = None,
project_id: Optional[str] = None,
tags: Optional[List[str]] = None,
subdomain: Optional[str] = None,
offer_options: Optional[List[OfferOptionRequest]] = None,
language: Optional[StdLanguageCode] = None,
domain_configuration: Optional[CreateHostingRequestDomainConfiguration] = None,
Expand All @@ -1127,6 +1128,7 @@ async def create_hosting(
:param region: Region to target. If none is passed will use default region from the config.
:param project_id: ID of the Scaleway Project in which to create the Web Hosting plan.
:param tags: List of tags for the Web Hosting plan.
:param subdomain: The name prefix to use as a free subdomain (for example, `mysite`) assigned to the Web Hosting plan. The full domain will be automatically created by adding it to the fixed base domain (e.g. `mysite.scw.site`). You do not need to include the base domain yourself.
:param offer_options: List of the Web Hosting plan options IDs with their quantities.
:param language: Default language for the control panel interface.
:param domain_configuration: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_config_domain_dns instead).
Expand Down Expand Up @@ -1159,6 +1161,7 @@ async def create_hosting(
region=region,
project_id=project_id,
tags=tags,
subdomain=subdomain,
offer_options=offer_options,
language=language,
domain_configuration=domain_configuration,
Expand All @@ -1185,6 +1188,7 @@ async def list_hostings(
project_id: Optional[str] = None,
organization_id: Optional[str] = None,
control_panels: Optional[List[str]] = None,
subdomain: Optional[str] = None,
) -> ListHostingsResponse:
"""
List all Web Hosting plans.
Expand All @@ -1199,6 +1203,7 @@ async def list_hostings(
:param project_id: Project ID to filter for, only Web Hosting plans from this Project will be returned.
:param organization_id: Organization ID to filter for, only Web Hosting plans from this Organization will be returned.
:param control_panels: Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned.
:param subdomain: Optional free subdomain linked to the Web Hosting plan.
:return: :class:`ListHostingsResponse <ListHostingsResponse>`

Usage:
Expand All @@ -1224,6 +1229,7 @@ async def list_hostings(
"page_size": page_size or self.client.default_page_size,
"project_id": project_id or self.client.default_project_id,
"statuses": statuses,
"subdomain": subdomain,
"tags": tags,
},
)
Expand All @@ -1244,6 +1250,7 @@ async def list_hostings_all(
project_id: Optional[str] = None,
organization_id: Optional[str] = None,
control_panels: Optional[List[str]] = None,
subdomain: Optional[str] = None,
) -> List[HostingSummary]:
"""
List all Web Hosting plans.
Expand All @@ -1258,6 +1265,7 @@ async def list_hostings_all(
:param project_id: Project ID to filter for, only Web Hosting plans from this Project will be returned.
:param organization_id: Organization ID to filter for, only Web Hosting plans from this Organization will be returned.
:param control_panels: Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned.
:param subdomain: Optional free subdomain linked to the Web Hosting plan.
:return: :class:`List[HostingSummary] <List[HostingSummary]>`

Usage:
Expand All @@ -1281,6 +1289,7 @@ async def list_hostings_all(
"project_id": project_id,
"organization_id": organization_id,
"control_panels": control_panels,
"subdomain": subdomain,
},
)

Expand Down
135 changes: 105 additions & 30 deletions scaleway-async/scaleway_async/webhosting/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
DnsRecords,
Domain,
PlatformControlPanelUrls,
HostingDomainCustomDomain,
OfferOption,
PlatformControlPanel,
HostingDomain,
HostingUser,
Offer,
Platform,
Expand Down Expand Up @@ -366,6 +368,35 @@ def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls:
return PlatformControlPanelUrls(**args)


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

args: Dict[str, Any] = {}

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

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

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

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

return HostingDomainCustomDomain(**args)


def unmarshal_OfferOption(data: Any) -> OfferOption:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -432,6 +463,27 @@ def unmarshal_PlatformControlPanel(data: Any) -> PlatformControlPanel:
return PlatformControlPanel(**args)


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

args: Dict[str, Any] = {}

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

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

return HostingDomain(**args)


def unmarshal_HostingUser(data: Any) -> HostingUser:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -571,18 +623,6 @@ def unmarshal_Hosting(data: Any) -> Hosting:
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("ipv4", None)
if field is not None:
args["ipv4"] = field

field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
Expand All @@ -595,17 +635,11 @@ def unmarshal_Hosting(data: Any) -> Hosting:
else:
args["created_at"] = None

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

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

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

field = data.get("offer", None)
if field is not None:
Expand All @@ -619,6 +653,22 @@ def unmarshal_Hosting(data: Any) -> Hosting:
else:
args["platform"] = None

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

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("dns_status", None)
if field is not None:
args["dns_status"] = field
Expand All @@ -631,6 +681,18 @@ def unmarshal_Hosting(data: Any) -> Hosting:
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)
else:
args["domain_info"] = None

return Hosting(**args)


Expand Down Expand Up @@ -767,10 +829,6 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary:
if field is not None:
args["status"] = field

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

field = data.get("protected", None)
if field is not None:
args["protected"] = field
Expand All @@ -779,10 +837,6 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary:
if field is not None:
args["offer_name"] = field

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

field = data.get("region", None)
if field is not None:
args["region"] = field
Expand All @@ -799,12 +853,30 @@ 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)
else:
args["domain_info"] = None

return HostingSummary(**args)


Expand Down Expand Up @@ -1300,6 +1372,9 @@ def marshal_HostingApiCreateHostingRequest(
if request.tags is not None:
output["tags"] = request.tags

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

if request.offer_options is not None:
output["offer_options"] = [
marshal_OfferOptionRequest(item, defaults) for item in request.offer_options
Expand Down
Loading
Loading