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
20 changes: 20 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 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 DnsRecordStatus
from .types import DnsRecordType
from .types import DnsRecordsStatus
from .types import HostingStatus
from .content import HOSTING_TRANSIENT_STATUSES
Expand All @@ -12,6 +14,7 @@
from .types import ListMailAccountsRequestOrderBy
from .types import ListOffersRequestOrderBy
from .types import ListWebsitesRequestOrderBy
from .types import NameserverStatus
from .types import OfferOptionName
from .types import OfferOptionWarning
from .types import PlatformPlatformGroup
Expand All @@ -20,6 +23,8 @@
from .types import PlatformControlPanel
from .types import CreateHostingRequestDomainConfiguration
from .types import OfferOptionRequest
from .types import DnsRecord
from .types import Nameserver
from .types import HostingUser
from .types import Offer
from .types import Platform
Expand All @@ -30,6 +35,7 @@
from .types import HostingSummary
from .types import MailAccount
from .types import Website
from .types import CheckUserOwnsDomainResponse
from .types import ControlPanelApiListControlPanelsRequest
from .types import DatabaseApiAssignDatabaseUserRequest
from .types import DatabaseApiChangeDatabaseUserPasswordRequest
Expand All @@ -42,6 +48,9 @@
from .types import DatabaseApiListDatabaseUsersRequest
from .types import DatabaseApiListDatabasesRequest
from .types import DatabaseApiUnassignDatabaseUserRequest
from .types import DnsApiCheckUserOwnsDomainRequest
from .types import DnsApiGetDomainDnsRecordsRequest
from .types import DnsRecords
from .types import FtpAccountApiChangeFtpAccountPasswordRequest
from .types import FtpAccountApiCreateFtpAccountRequest
from .types import FtpAccountApiListFtpAccountsRequest
Expand Down Expand Up @@ -74,13 +83,16 @@
from .types import WebsiteApiListWebsitesRequest
from .api import WebhostingV1ControlPanelAPI
from .api import WebhostingV1DatabaseAPI
from .api import WebhostingV1DnsAPI
from .api import WebhostingV1OfferAPI
from .api import WebhostingV1HostingAPI
from .api import WebhostingV1FtpAccountAPI
from .api import WebhostingV1MailAccountAPI
from .api import WebhostingV1WebsiteAPI

__all__ = [
"DnsRecordStatus",
"DnsRecordType",
"DnsRecordsStatus",
"HostingStatus",
"HOSTING_TRANSIENT_STATUSES",
Expand All @@ -93,6 +105,7 @@
"ListMailAccountsRequestOrderBy",
"ListOffersRequestOrderBy",
"ListWebsitesRequestOrderBy",
"NameserverStatus",
"OfferOptionName",
"OfferOptionWarning",
"PlatformPlatformGroup",
Expand All @@ -101,6 +114,8 @@
"PlatformControlPanel",
"CreateHostingRequestDomainConfiguration",
"OfferOptionRequest",
"DnsRecord",
"Nameserver",
"HostingUser",
"Offer",
"Platform",
Expand All @@ -111,6 +126,7 @@
"HostingSummary",
"MailAccount",
"Website",
"CheckUserOwnsDomainResponse",
"ControlPanelApiListControlPanelsRequest",
"DatabaseApiAssignDatabaseUserRequest",
"DatabaseApiChangeDatabaseUserPasswordRequest",
Expand All @@ -123,6 +139,9 @@
"DatabaseApiListDatabaseUsersRequest",
"DatabaseApiListDatabasesRequest",
"DatabaseApiUnassignDatabaseUserRequest",
"DnsApiCheckUserOwnsDomainRequest",
"DnsApiGetDomainDnsRecordsRequest",
"DnsRecords",
"FtpAccountApiChangeFtpAccountPasswordRequest",
"FtpAccountApiCreateFtpAccountRequest",
"FtpAccountApiListFtpAccountsRequest",
Expand Down Expand Up @@ -155,6 +174,7 @@
"WebsiteApiListWebsitesRequest",
"WebhostingV1ControlPanelAPI",
"WebhostingV1DatabaseAPI",
"WebhostingV1DnsAPI",
"WebhostingV1OfferAPI",
"WebhostingV1HostingAPI",
"WebhostingV1FtpAccountAPI",
Expand Down
89 changes: 89 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
ListMailAccountsRequestOrderBy,
ListOffersRequestOrderBy,
ListWebsitesRequestOrderBy,
CheckUserOwnsDomainResponse,
ControlPanel,
CreateHostingRequestDomainConfiguration,
Database,
Expand All @@ -31,6 +32,8 @@
DatabaseApiCreateDatabaseUserRequest,
DatabaseApiUnassignDatabaseUserRequest,
DatabaseUser,
DnsApiCheckUserOwnsDomainRequest,
DnsRecords,
FtpAccount,
FtpAccountApiChangeFtpAccountPasswordRequest,
FtpAccountApiCreateFtpAccountRequest,
Expand Down Expand Up @@ -65,6 +68,8 @@
unmarshal_Database,
unmarshal_FtpAccount,
unmarshal_MailAccount,
unmarshal_CheckUserOwnsDomainResponse,
unmarshal_DnsRecords,
unmarshal_Hosting,
unmarshal_ListControlPanelsResponse,
unmarshal_ListDatabaseUsersResponse,
Expand All @@ -82,6 +87,7 @@
marshal_DatabaseApiCreateDatabaseRequest,
marshal_DatabaseApiCreateDatabaseUserRequest,
marshal_DatabaseApiUnassignDatabaseUserRequest,
marshal_DnsApiCheckUserOwnsDomainRequest,
marshal_FtpAccountApiChangeFtpAccountPasswordRequest,
marshal_FtpAccountApiCreateFtpAccountRequest,
marshal_HostingApiCreateHostingRequest,
Expand Down Expand Up @@ -727,6 +733,89 @@ async def unassign_database_user(
return unmarshal_DatabaseUser(res.json())


class WebhostingV1DnsAPI(API):
"""
This API allows you to manage your Web Hosting services.
"""

async def get_domain_dns_records(
self,
*,
domain: str,
region: Optional[Region] = None,
) -> DnsRecords:
"""
Get DNS records.
Get the set of DNS records of a specified domain associated with a Web Hosting plan's domain.
:param domain: Domain associated with the DNS records.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`DnsRecords <DnsRecords>`

Usage:
::

result = await api.get_domain_dns_records(
domain="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_domain = validate_path_param("domain", domain)

res = self._request(
"GET",
f"/webhosting/v1/regions/{param_region}/domains/{param_domain}/dns-records",
)

self._throw_on_error(res)
return unmarshal_DnsRecords(res.json())

async def check_user_owns_domain(
self,
*,
domain: str,
region: Optional[Region] = None,
project_id: Optional[str] = None,
) -> CheckUserOwnsDomainResponse:
"""
"Check whether you own this domain or not.".
:param domain: Domain for which ownership is to be verified.
:param region: Region to target. If none is passed will use default region from the config.
:param project_id: ID of the project currently in use.
:return: :class:`CheckUserOwnsDomainResponse <CheckUserOwnsDomainResponse>`

Usage:
::

result = await api.check_user_owns_domain(
domain="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_domain = validate_path_param("domain", domain)

res = self._request(
"POST",
f"/webhosting/v1/regions/{param_region}/domains/{param_domain}/check-ownership",
body=marshal_DnsApiCheckUserOwnsDomainRequest(
DnsApiCheckUserOwnsDomainRequest(
domain=domain,
region=region,
project_id=project_id,
),
self.client,
),
)

self._throw_on_error(res)
return unmarshal_CheckUserOwnsDomainResponse(res.json())


class WebhostingV1OfferAPI(API):
"""
This API allows you to manage your offer for your Web Hosting services.
Expand Down
125 changes: 125 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
Database,
FtpAccount,
MailAccount,
CheckUserOwnsDomainResponse,
DnsRecord,
Nameserver,
DnsRecords,
PlatformControlPanelUrls,
OfferOption,
PlatformControlPanel,
Expand All @@ -39,6 +43,7 @@
DatabaseApiCreateDatabaseRequest,
DatabaseApiCreateDatabaseUserRequest,
DatabaseApiUnassignDatabaseUserRequest,
DnsApiCheckUserOwnsDomainRequest,
FtpAccountApiChangeFtpAccountPasswordRequest,
FtpAccountApiCreateFtpAccountRequest,
CreateHostingRequestDomainConfiguration,
Expand Down Expand Up @@ -130,6 +135,108 @@ def unmarshal_MailAccount(data: Any) -> MailAccount:
return MailAccount(**args)


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

args: Dict[str, Any] = {}

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

return CheckUserOwnsDomainResponse(**args)


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

args: Dict[str, Any] = {}

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

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

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

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

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

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

return DnsRecord(**args)


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

args: Dict[str, Any] = {}

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

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

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

return Nameserver(**args)


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

args: Dict[str, Any] = {}

field = data.get("records", None)
if field is not None:
args["records"] = (
[unmarshal_DnsRecord(v) for v in field] if field is not None else None
)

field = data.get("name_servers", None)
if field is not None:
args["name_servers"] = (
[unmarshal_Nameserver(v) for v in field] if field is not None else None
)

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

return DnsRecords(**args)


def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -185,6 +292,12 @@ def unmarshal_OfferOption(data: Any) -> OfferOption:
if field is not None:
args["quota_warning"] = field

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

return OfferOption(**args)


Expand Down Expand Up @@ -778,6 +891,18 @@ def marshal_DatabaseApiUnassignDatabaseUserRequest(
return output


def marshal_DnsApiCheckUserOwnsDomainRequest(
request: DnsApiCheckUserOwnsDomainRequest,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.project_id is not None:
output["project_id"] = request.project_id or defaults.default_project_id

return output


def marshal_FtpAccountApiChangeFtpAccountPasswordRequest(
request: FtpAccountApiChangeFtpAccountPasswordRequest,
defaults: ProfileDefaults,
Expand Down
Loading
Loading