Skip to content

Commit 8c1dfdb

Browse files
authored
feat(webhosting): extends offer api with commitment (scaleway#1614)
1 parent 04e920f commit 8c1dfdb

8 files changed

Lines changed: 576 additions & 186 deletions

File tree

scaleway-async/scaleway_async/webhosting/v1/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from .types import BackupItemType
44
from .types import BackupStatus
55
from .content import BACKUP_TRANSIENT_STATUSES
6+
from .types import BillingMode
67
from .types import CheckFreeDomainAvailabilityResponseUnavailableReason
8+
from .types import CommitmentType
79
from .types import DnsRecordStatus
810
from .types import DnsRecordType
911
from .types import DnsRecordsStatus
@@ -34,6 +36,7 @@
3436
from .types import PlatformControlPanelUrls
3537
from .types import HostingDomainCustomDomain
3638
from .types import ControlPanel
39+
from .types import OfferCommitment
3740
from .types import OfferOption
3841
from .types import PlatformControlPanel
3942
from .types import BackupItem
@@ -134,6 +137,7 @@
134137
from .types import WebsiteApiCreateWebsiteRequest
135138
from .types import WebsiteApiDeleteWebsiteRequest
136139
from .types import WebsiteApiListWebsitesRequest
140+
from .types import WebsiteApiResetWebsiteRequest
137141
from .api import WebhostingV1BackupAPI
138142
from .api import WebhostingV1ControlPanelAPI
139143
from .api import WebhostingV1DatabaseAPI
@@ -149,7 +153,9 @@
149153
"BackupItemType",
150154
"BackupStatus",
151155
"BACKUP_TRANSIENT_STATUSES",
156+
"BillingMode",
152157
"CheckFreeDomainAvailabilityResponseUnavailableReason",
158+
"CommitmentType",
153159
"DnsRecordStatus",
154160
"DnsRecordType",
155161
"DnsRecordsStatus",
@@ -180,6 +186,7 @@
180186
"PlatformControlPanelUrls",
181187
"HostingDomainCustomDomain",
182188
"ControlPanel",
189+
"OfferCommitment",
183190
"OfferOption",
184191
"PlatformControlPanel",
185192
"BackupItem",
@@ -280,6 +287,7 @@
280287
"WebsiteApiCreateWebsiteRequest",
281288
"WebsiteApiDeleteWebsiteRequest",
282289
"WebsiteApiListWebsitesRequest",
290+
"WebsiteApiResetWebsiteRequest",
283291
"WebhostingV1BackupAPI",
284292
"WebhostingV1ControlPanelAPI",
285293
"WebhostingV1DatabaseAPI",

scaleway-async/scaleway_async/webhosting/v1/api.py

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,22 +1232,22 @@ async def sync_domain_dns_records(
12321232
self,
12331233
*,
12341234
domain: str,
1235+
update_web_records: bool,
1236+
update_mail_records: bool,
1237+
update_all_records: bool,
1238+
update_nameservers: bool,
12351239
region: Optional[ScwRegion] = None,
1236-
update_web_records: Optional[bool] = None,
1237-
update_mail_records: Optional[bool] = None,
1238-
update_all_records: Optional[bool] = None,
1239-
update_nameservers: Optional[bool] = None,
12401240
custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = None,
12411241
auto_config_domain_dns: Optional[AutoConfigDomainDns] = None,
12421242
) -> DnsRecords:
12431243
"""
12441244
Synchronize your DNS records on the Elements Console and on cPanel.
12451245
:param domain: Domain for which the DNS records will be synchronized.
1246-
:param region: Region to target. If none is passed will use default region from the config.
12471246
:param update_web_records: Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns).
12481247
:param update_mail_records: Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns).
12491248
:param update_all_records: Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns).
12501249
:param update_nameservers: Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns).
1250+
:param region: Region to target. If none is passed will use default region from the config.
12511251
:param custom_records: Custom records to synchronize.
12521252
:param auto_config_domain_dns: Whether or not to synchronize each types of records.
12531253
:return: :class:`DnsRecords <DnsRecords>`
@@ -1257,6 +1257,10 @@ async def sync_domain_dns_records(
12571257
12581258
result = await api.sync_domain_dns_records(
12591259
domain="example",
1260+
update_web_records=False,
1261+
update_mail_records=False,
1262+
update_all_records=False,
1263+
update_nameservers=False,
12601264
)
12611265
"""
12621266

@@ -1271,11 +1275,11 @@ async def sync_domain_dns_records(
12711275
body=marshal_DnsApiSyncDomainDnsRecordsRequest(
12721276
DnsApiSyncDomainDnsRecordsRequest(
12731277
domain=domain,
1274-
region=region,
12751278
update_web_records=update_web_records,
12761279
update_mail_records=update_mail_records,
12771280
update_all_records=update_all_records,
12781281
update_nameservers=update_nameservers,
1282+
region=region,
12791283
custom_records=custom_records,
12801284
auto_config_domain_dns=auto_config_domain_dns,
12811285
),
@@ -2972,3 +2976,43 @@ async def delete_website(
29722976
)
29732977

29742978
self._throw_on_error(res)
2979+
2980+
async def reset_website(
2981+
self,
2982+
*,
2983+
hosting_id: str,
2984+
domain_name: str,
2985+
region: Optional[ScwRegion] = None,
2986+
) -> Website:
2987+
"""
2988+
Delete a website's content, all files and directories. This.
2989+
Permanently deletes data including files and configurations. The
2990+
website will display the default welcome page.
2991+
:param hosting_id: Hosting ID to which the website is attached to.
2992+
:param domain_name: The domain name with which the website is associated.
2993+
:param region: Region to target. If none is passed will use default region from the config.
2994+
:return: :class:`Website <Website>`
2995+
2996+
Usage:
2997+
::
2998+
2999+
result = await api.reset_website(
3000+
hosting_id="example",
3001+
domain_name="example",
3002+
)
3003+
"""
3004+
3005+
param_region = validate_path_param(
3006+
"region", region or self.client.default_region
3007+
)
3008+
param_hosting_id = validate_path_param("hosting_id", hosting_id)
3009+
param_domain_name = validate_path_param("domain_name", domain_name)
3010+
3011+
res = self._request(
3012+
"POST",
3013+
f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/websites/{param_domain_name}/reset",
3014+
body={},
3015+
)
3016+
3017+
self._throw_on_error(res)
3018+
return unmarshal_Website(res.json())

0 commit comments

Comments
 (0)