Skip to content

Commit

Permalink
feat: update generated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot committed Feb 4, 2025
1 parent 461ac37 commit a9290e9
Show file tree
Hide file tree
Showing 12 changed files with 888 additions and 6 deletions.
26 changes: 26 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
from .types import DnsRecordStatus
from .types import DnsRecordType
from .types import DnsRecordsStatus
from .types import DomainAction
from .types import DomainAvailabilityAction
from .types import DomainAvailabilityStatus
from .content import DOMAIN_AVAILABILITY_TRANSIENT_STATUSES
from .types import DomainDnsAction
from .types import DomainStatus
from .content import DOMAIN_TRANSIENT_STATUSES
from .types import DomainZoneOwner
from .types import HostingStatus
from .content import HOSTING_TRANSIENT_STATUSES
from .types import HostingSummaryStatus
Expand Down Expand Up @@ -37,6 +45,7 @@
from .types import HostingSummary
from .types import MailAccount
from .types import Website
from .types import DomainAvailability
from .types import CheckUserOwnsDomainResponse
from .types import ControlPanelApiListControlPanelsRequest
from .types import DatabaseApiAssignDatabaseUserRequest
Expand All @@ -52,8 +61,11 @@
from .types import DatabaseApiUnassignDatabaseUserRequest
from .types import DnsApiCheckUserOwnsDomainRequest
from .types import DnsApiGetDomainDnsRecordsRequest
from .types import DnsApiGetDomainRequest
from .types import DnsApiSearchDomainsRequest
from .types import DnsApiSyncDomainDnsRecordsRequest
from .types import DnsRecords
from .types import Domain
from .types import FtpAccountApiChangeFtpAccountPasswordRequest
from .types import FtpAccountApiCreateFtpAccountRequest
from .types import FtpAccountApiListFtpAccountsRequest
Expand Down Expand Up @@ -82,6 +94,7 @@
from .types import OfferApiListOffersRequest
from .types import ResetHostingPasswordResponse
from .types import ResourceSummary
from .types import SearchDomainsResponse
from .types import Session
from .types import WebsiteApiListWebsitesRequest
from .api import WebhostingV1ControlPanelAPI
Expand All @@ -97,6 +110,14 @@
"DnsRecordStatus",
"DnsRecordType",
"DnsRecordsStatus",
"DomainAction",
"DomainAvailabilityAction",
"DomainAvailabilityStatus",
"DOMAIN_AVAILABILITY_TRANSIENT_STATUSES",
"DomainDnsAction",
"DomainStatus",
"DOMAIN_TRANSIENT_STATUSES",
"DomainZoneOwner",
"HostingStatus",
"HOSTING_TRANSIENT_STATUSES",
"HostingSummaryStatus",
Expand Down Expand Up @@ -131,6 +152,7 @@
"HostingSummary",
"MailAccount",
"Website",
"DomainAvailability",
"CheckUserOwnsDomainResponse",
"ControlPanelApiListControlPanelsRequest",
"DatabaseApiAssignDatabaseUserRequest",
Expand All @@ -146,8 +168,11 @@
"DatabaseApiUnassignDatabaseUserRequest",
"DnsApiCheckUserOwnsDomainRequest",
"DnsApiGetDomainDnsRecordsRequest",
"DnsApiGetDomainRequest",
"DnsApiSearchDomainsRequest",
"DnsApiSyncDomainDnsRecordsRequest",
"DnsRecords",
"Domain",
"FtpAccountApiChangeFtpAccountPasswordRequest",
"FtpAccountApiCreateFtpAccountRequest",
"FtpAccountApiListFtpAccountsRequest",
Expand Down Expand Up @@ -176,6 +201,7 @@
"OfferApiListOffersRequest",
"ResetHostingPasswordResponse",
"ResourceSummary",
"SearchDomainsResponse",
"Session",
"WebsiteApiListWebsitesRequest",
"WebhostingV1ControlPanelAPI",
Expand Down
128 changes: 126 additions & 2 deletions scaleway-async/scaleway_async/webhosting/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
DnsApiCheckUserOwnsDomainRequest,
DnsApiSyncDomainDnsRecordsRequest,
DnsRecords,
Domain,
FtpAccount,
FtpAccountApiChangeFtpAccountPasswordRequest,
FtpAccountApiCreateFtpAccountRequest,
Expand All @@ -59,11 +60,13 @@
OfferOptionRequest,
ResetHostingPasswordResponse,
ResourceSummary,
SearchDomainsResponse,
Session,
SyncDomainDnsRecordsRequestRecord,
Website,
)
from .content import (
DOMAIN_TRANSIENT_STATUSES,
HOSTING_TRANSIENT_STATUSES,
)
from .marshalling import (
Expand All @@ -73,6 +76,7 @@
unmarshal_MailAccount,
unmarshal_CheckUserOwnsDomainResponse,
unmarshal_DnsRecords,
unmarshal_Domain,
unmarshal_Hosting,
unmarshal_ListControlPanelsResponse,
unmarshal_ListDatabaseUsersResponse,
Expand All @@ -84,6 +88,7 @@
unmarshal_ListWebsitesResponse,
unmarshal_ResetHostingPasswordResponse,
unmarshal_ResourceSummary,
unmarshal_SearchDomainsResponse,
unmarshal_Session,
marshal_DatabaseApiAssignDatabaseUserRequest,
marshal_DatabaseApiChangeDatabaseUserPasswordRequest,
Expand Down Expand Up @@ -792,7 +797,7 @@ async def check_user_owns_domain(
project_id: Optional[str] = None,
) -> CheckUserOwnsDomainResponse:
"""
"Check whether you own this domain or not.".
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.
Expand Down Expand Up @@ -834,15 +839,17 @@ async def sync_domain_dns_records(
update_web_records: bool,
update_mail_records: bool,
update_all_records: bool,
update_nameservers: bool,
region: Optional[ScwRegion] = None,
custom_records: Optional[List[SyncDomainDnsRecordsRequestRecord]] = None,
) -> DnsRecords:
"""
"Synchronize your DNS records on the Elements Console and on cPanel.".
Synchronize your DNS records on the Elements Console and on cPanel.
:param domain: Domain for which the DNS records will be synchronized.
:param update_web_records: Whether or not to synchronize the web records.
:param update_mail_records: Whether or not to synchronize the mail records.
:param update_all_records: Whether or not to synchronize all types of records. This one has priority.
:param update_nameservers: Whether or not to synchronize domain nameservers.
:param region: Region to target. If none is passed will use default region from the config.
:param custom_records: Custom records to synchronize.
:return: :class:`DnsRecords <DnsRecords>`
Expand All @@ -855,6 +862,7 @@ async def sync_domain_dns_records(
update_web_records=False,
update_mail_records=False,
update_all_records=False,
update_nameservers=False,
)
"""

Expand All @@ -872,6 +880,7 @@ async def sync_domain_dns_records(
update_web_records=update_web_records,
update_mail_records=update_mail_records,
update_all_records=update_all_records,
update_nameservers=update_nameservers,
region=region,
custom_records=custom_records,
),
Expand All @@ -882,6 +891,121 @@ async def sync_domain_dns_records(
self._throw_on_error(res)
return unmarshal_DnsRecords(res.json())

async def search_domains(
self,
*,
domain_name: str,
region: Optional[ScwRegion] = None,
project_id: Optional[str] = None,
) -> SearchDomainsResponse:
"""
Search for available domains based on domain name.
:param domain_name: Domain name to search.
: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 search the domain to create the Web Hosting plan.
:return: :class:`SearchDomainsResponse <SearchDomainsResponse>`
Usage:
::
result = await api.search_domains(
domain_name="example",
)
"""

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

res = self._request(
"GET",
f"/webhosting/v1/regions/{param_region}/search-domains",
params={
"domain_name": domain_name,
"project_id": project_id or self.client.default_project_id,
},
)

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

async def get_domain(
self,
*,
domain_name: str,
region: Optional[ScwRegion] = None,
project_id: Optional[str] = None,
) -> Domain:
"""
Retrieve detailed information about a specific domain, including its status, DNS configuration, and ownership.
:param domain_name: Domain name to get.
: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 get the domain to create the Web Hosting plan.
:return: :class:`Domain <Domain>`
Usage:
::
result = await api.get_domain(
domain_name="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_domain_name = validate_path_param("domain_name", domain_name)

res = self._request(
"GET",
f"/webhosting/v1/regions/{param_region}/domains/{param_domain_name}",
params={
"project_id": project_id or self.client.default_project_id,
},
)

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

async def wait_for_domain(
self,
*,
domain_name: str,
region: Optional[ScwRegion] = None,
project_id: Optional[str] = None,
options: Optional[WaitForOptions[Domain, Union[bool, Awaitable[bool]]]] = None,
) -> Domain:
"""
Retrieve detailed information about a specific domain, including its status, DNS configuration, and ownership.
:param domain_name: Domain name to get.
: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 get the domain to create the Web Hosting plan.
:return: :class:`Domain <Domain>`
Usage:
::
result = await api.get_domain(
domain_name="example",
)
"""

if not options:
options = WaitForOptions()

if not options.stop:
options.stop = lambda res: res.status not in DOMAIN_TRANSIENT_STATUSES

return await wait_for_resource_async(
fetcher=self.get_domain,
options=options,
args={
"domain_name": domain_name,
"region": region,
"project_id": project_id,
},
)


class WebhostingV1OfferAPI(API):
"""
Expand Down
14 changes: 14 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,24 @@
from typing import List

from .types import (
DomainAvailabilityStatus,
DomainStatus,
HostingStatus,
HostingSummaryStatus,
)

DOMAIN_AVAILABILITY_TRANSIENT_STATUSES: List[DomainAvailabilityStatus] = [
DomainAvailabilityStatus.VALIDATING,
]
"""
Lists transient statutes of the enum :class:`DomainAvailabilityStatus <DomainAvailabilityStatus>`.
"""
DOMAIN_TRANSIENT_STATUSES: List[DomainStatus] = [
DomainStatus.VALIDATING,
]
"""
Lists transient statutes of the enum :class:`DomainStatus <DomainStatus>`.
"""
HOSTING_TRANSIENT_STATUSES: List[HostingStatus] = [
HostingStatus.DELIVERING,
HostingStatus.DELETING,
Expand Down
Loading

0 comments on commit a9290e9

Please sign in to comment.