Skip to content

Commit 327ed2d

Browse files
authored
feat(webhosting): update v1 uuid and add offer option price (#786)
1 parent e7ab0ad commit 327ed2d

File tree

8 files changed

+756
-0
lines changed

8 files changed

+756
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
3+
from .types import DnsRecordStatus
4+
from .types import DnsRecordType
35
from .types import DnsRecordsStatus
46
from .types import HostingStatus
57
from .content import HOSTING_TRANSIENT_STATUSES
@@ -12,6 +14,7 @@
1214
from .types import ListMailAccountsRequestOrderBy
1315
from .types import ListOffersRequestOrderBy
1416
from .types import ListWebsitesRequestOrderBy
17+
from .types import NameserverStatus
1518
from .types import OfferOptionName
1619
from .types import OfferOptionWarning
1720
from .types import PlatformPlatformGroup
@@ -20,6 +23,8 @@
2023
from .types import PlatformControlPanel
2124
from .types import CreateHostingRequestDomainConfiguration
2225
from .types import OfferOptionRequest
26+
from .types import DnsRecord
27+
from .types import Nameserver
2328
from .types import HostingUser
2429
from .types import Offer
2530
from .types import Platform
@@ -30,6 +35,7 @@
3035
from .types import HostingSummary
3136
from .types import MailAccount
3237
from .types import Website
38+
from .types import CheckUserOwnsDomainResponse
3339
from .types import ControlPanelApiListControlPanelsRequest
3440
from .types import DatabaseApiAssignDatabaseUserRequest
3541
from .types import DatabaseApiChangeDatabaseUserPasswordRequest
@@ -42,6 +48,9 @@
4248
from .types import DatabaseApiListDatabaseUsersRequest
4349
from .types import DatabaseApiListDatabasesRequest
4450
from .types import DatabaseApiUnassignDatabaseUserRequest
51+
from .types import DnsApiCheckUserOwnsDomainRequest
52+
from .types import DnsApiGetDomainDnsRecordsRequest
53+
from .types import DnsRecords
4554
from .types import FtpAccountApiChangeFtpAccountPasswordRequest
4655
from .types import FtpAccountApiCreateFtpAccountRequest
4756
from .types import FtpAccountApiListFtpAccountsRequest
@@ -74,13 +83,16 @@
7483
from .types import WebsiteApiListWebsitesRequest
7584
from .api import WebhostingV1ControlPanelAPI
7685
from .api import WebhostingV1DatabaseAPI
86+
from .api import WebhostingV1DnsAPI
7787
from .api import WebhostingV1OfferAPI
7888
from .api import WebhostingV1HostingAPI
7989
from .api import WebhostingV1FtpAccountAPI
8090
from .api import WebhostingV1MailAccountAPI
8191
from .api import WebhostingV1WebsiteAPI
8292

8393
__all__ = [
94+
"DnsRecordStatus",
95+
"DnsRecordType",
8496
"DnsRecordsStatus",
8597
"HostingStatus",
8698
"HOSTING_TRANSIENT_STATUSES",
@@ -93,6 +105,7 @@
93105
"ListMailAccountsRequestOrderBy",
94106
"ListOffersRequestOrderBy",
95107
"ListWebsitesRequestOrderBy",
108+
"NameserverStatus",
96109
"OfferOptionName",
97110
"OfferOptionWarning",
98111
"PlatformPlatformGroup",
@@ -101,6 +114,8 @@
101114
"PlatformControlPanel",
102115
"CreateHostingRequestDomainConfiguration",
103116
"OfferOptionRequest",
117+
"DnsRecord",
118+
"Nameserver",
104119
"HostingUser",
105120
"Offer",
106121
"Platform",
@@ -111,6 +126,7 @@
111126
"HostingSummary",
112127
"MailAccount",
113128
"Website",
129+
"CheckUserOwnsDomainResponse",
114130
"ControlPanelApiListControlPanelsRequest",
115131
"DatabaseApiAssignDatabaseUserRequest",
116132
"DatabaseApiChangeDatabaseUserPasswordRequest",
@@ -123,6 +139,9 @@
123139
"DatabaseApiListDatabaseUsersRequest",
124140
"DatabaseApiListDatabasesRequest",
125141
"DatabaseApiUnassignDatabaseUserRequest",
142+
"DnsApiCheckUserOwnsDomainRequest",
143+
"DnsApiGetDomainDnsRecordsRequest",
144+
"DnsRecords",
126145
"FtpAccountApiChangeFtpAccountPasswordRequest",
127146
"FtpAccountApiCreateFtpAccountRequest",
128147
"FtpAccountApiListFtpAccountsRequest",
@@ -155,6 +174,7 @@
155174
"WebsiteApiListWebsitesRequest",
156175
"WebhostingV1ControlPanelAPI",
157176
"WebhostingV1DatabaseAPI",
177+
"WebhostingV1DnsAPI",
158178
"WebhostingV1OfferAPI",
159179
"WebhostingV1HostingAPI",
160180
"WebhostingV1FtpAccountAPI",

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

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
ListMailAccountsRequestOrderBy,
2323
ListOffersRequestOrderBy,
2424
ListWebsitesRequestOrderBy,
25+
CheckUserOwnsDomainResponse,
2526
ControlPanel,
2627
CreateHostingRequestDomainConfiguration,
2728
Database,
@@ -31,6 +32,8 @@
3132
DatabaseApiCreateDatabaseUserRequest,
3233
DatabaseApiUnassignDatabaseUserRequest,
3334
DatabaseUser,
35+
DnsApiCheckUserOwnsDomainRequest,
36+
DnsRecords,
3437
FtpAccount,
3538
FtpAccountApiChangeFtpAccountPasswordRequest,
3639
FtpAccountApiCreateFtpAccountRequest,
@@ -65,6 +68,8 @@
6568
unmarshal_Database,
6669
unmarshal_FtpAccount,
6770
unmarshal_MailAccount,
71+
unmarshal_CheckUserOwnsDomainResponse,
72+
unmarshal_DnsRecords,
6873
unmarshal_Hosting,
6974
unmarshal_ListControlPanelsResponse,
7075
unmarshal_ListDatabaseUsersResponse,
@@ -82,6 +87,7 @@
8287
marshal_DatabaseApiCreateDatabaseRequest,
8388
marshal_DatabaseApiCreateDatabaseUserRequest,
8489
marshal_DatabaseApiUnassignDatabaseUserRequest,
90+
marshal_DnsApiCheckUserOwnsDomainRequest,
8591
marshal_FtpAccountApiChangeFtpAccountPasswordRequest,
8692
marshal_FtpAccountApiCreateFtpAccountRequest,
8793
marshal_HostingApiCreateHostingRequest,
@@ -727,6 +733,89 @@ async def unassign_database_user(
727733
return unmarshal_DatabaseUser(res.json())
728734

729735

736+
class WebhostingV1DnsAPI(API):
737+
"""
738+
This API allows you to manage your Web Hosting services.
739+
"""
740+
741+
async def get_domain_dns_records(
742+
self,
743+
*,
744+
domain: str,
745+
region: Optional[Region] = None,
746+
) -> DnsRecords:
747+
"""
748+
Get DNS records.
749+
Get the set of DNS records of a specified domain associated with a Web Hosting plan's domain.
750+
:param domain: Domain associated with the DNS records.
751+
:param region: Region to target. If none is passed will use default region from the config.
752+
:return: :class:`DnsRecords <DnsRecords>`
753+
754+
Usage:
755+
::
756+
757+
result = await api.get_domain_dns_records(
758+
domain="example",
759+
)
760+
"""
761+
762+
param_region = validate_path_param(
763+
"region", region or self.client.default_region
764+
)
765+
param_domain = validate_path_param("domain", domain)
766+
767+
res = self._request(
768+
"GET",
769+
f"/webhosting/v1/regions/{param_region}/domains/{param_domain}/dns-records",
770+
)
771+
772+
self._throw_on_error(res)
773+
return unmarshal_DnsRecords(res.json())
774+
775+
async def check_user_owns_domain(
776+
self,
777+
*,
778+
domain: str,
779+
region: Optional[Region] = None,
780+
project_id: Optional[str] = None,
781+
) -> CheckUserOwnsDomainResponse:
782+
"""
783+
"Check whether you own this domain or not.".
784+
:param domain: Domain for which ownership is to be verified.
785+
:param region: Region to target. If none is passed will use default region from the config.
786+
:param project_id: ID of the project currently in use.
787+
:return: :class:`CheckUserOwnsDomainResponse <CheckUserOwnsDomainResponse>`
788+
789+
Usage:
790+
::
791+
792+
result = await api.check_user_owns_domain(
793+
domain="example",
794+
)
795+
"""
796+
797+
param_region = validate_path_param(
798+
"region", region or self.client.default_region
799+
)
800+
param_domain = validate_path_param("domain", domain)
801+
802+
res = self._request(
803+
"POST",
804+
f"/webhosting/v1/regions/{param_region}/domains/{param_domain}/check-ownership",
805+
body=marshal_DnsApiCheckUserOwnsDomainRequest(
806+
DnsApiCheckUserOwnsDomainRequest(
807+
domain=domain,
808+
region=region,
809+
project_id=project_id,
810+
),
811+
self.client,
812+
),
813+
)
814+
815+
self._throw_on_error(res)
816+
return unmarshal_CheckUserOwnsDomainResponse(res.json())
817+
818+
730819
class WebhostingV1OfferAPI(API):
731820
"""
732821
This API allows you to manage your offer for your Web Hosting services.

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

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
Database,
1414
FtpAccount,
1515
MailAccount,
16+
CheckUserOwnsDomainResponse,
17+
DnsRecord,
18+
Nameserver,
19+
DnsRecords,
1620
PlatformControlPanelUrls,
1721
OfferOption,
1822
PlatformControlPanel,
@@ -39,6 +43,7 @@
3943
DatabaseApiCreateDatabaseRequest,
4044
DatabaseApiCreateDatabaseUserRequest,
4145
DatabaseApiUnassignDatabaseUserRequest,
46+
DnsApiCheckUserOwnsDomainRequest,
4247
FtpAccountApiChangeFtpAccountPasswordRequest,
4348
FtpAccountApiCreateFtpAccountRequest,
4449
CreateHostingRequestDomainConfiguration,
@@ -130,6 +135,108 @@ def unmarshal_MailAccount(data: Any) -> MailAccount:
130135
return MailAccount(**args)
131136

132137

138+
def unmarshal_CheckUserOwnsDomainResponse(data: Any) -> CheckUserOwnsDomainResponse:
139+
if not isinstance(data, dict):
140+
raise TypeError(
141+
"Unmarshalling the type 'CheckUserOwnsDomainResponse' failed as data isn't a dictionary."
142+
)
143+
144+
args: Dict[str, Any] = {}
145+
146+
field = data.get("owns_domain", None)
147+
if field is not None:
148+
args["owns_domain"] = field
149+
150+
return CheckUserOwnsDomainResponse(**args)
151+
152+
153+
def unmarshal_DnsRecord(data: Any) -> DnsRecord:
154+
if not isinstance(data, dict):
155+
raise TypeError(
156+
"Unmarshalling the type 'DnsRecord' failed as data isn't a dictionary."
157+
)
158+
159+
args: Dict[str, Any] = {}
160+
161+
field = data.get("name", None)
162+
if field is not None:
163+
args["name"] = field
164+
165+
field = data.get("type", None)
166+
if field is not None:
167+
args["type_"] = field
168+
169+
field = data.get("ttl", None)
170+
if field is not None:
171+
args["ttl"] = field
172+
173+
field = data.get("value", None)
174+
if field is not None:
175+
args["value"] = field
176+
177+
field = data.get("status", None)
178+
if field is not None:
179+
args["status"] = field
180+
181+
field = data.get("priority", None)
182+
if field is not None:
183+
args["priority"] = field
184+
else:
185+
args["priority"] = None
186+
187+
return DnsRecord(**args)
188+
189+
190+
def unmarshal_Nameserver(data: Any) -> Nameserver:
191+
if not isinstance(data, dict):
192+
raise TypeError(
193+
"Unmarshalling the type 'Nameserver' failed as data isn't a dictionary."
194+
)
195+
196+
args: Dict[str, Any] = {}
197+
198+
field = data.get("hostname", None)
199+
if field is not None:
200+
args["hostname"] = field
201+
202+
field = data.get("status", None)
203+
if field is not None:
204+
args["status"] = field
205+
206+
field = data.get("is_default", None)
207+
if field is not None:
208+
args["is_default"] = field
209+
210+
return Nameserver(**args)
211+
212+
213+
def unmarshal_DnsRecords(data: Any) -> DnsRecords:
214+
if not isinstance(data, dict):
215+
raise TypeError(
216+
"Unmarshalling the type 'DnsRecords' failed as data isn't a dictionary."
217+
)
218+
219+
args: Dict[str, Any] = {}
220+
221+
field = data.get("records", None)
222+
if field is not None:
223+
args["records"] = (
224+
[unmarshal_DnsRecord(v) for v in field] if field is not None else None
225+
)
226+
227+
field = data.get("name_servers", None)
228+
if field is not None:
229+
args["name_servers"] = (
230+
[unmarshal_Nameserver(v) for v in field] if field is not None else None
231+
)
232+
233+
field = data.get("status", None)
234+
if field is not None:
235+
args["status"] = field
236+
237+
return DnsRecords(**args)
238+
239+
133240
def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls:
134241
if not isinstance(data, dict):
135242
raise TypeError(
@@ -185,6 +292,12 @@ def unmarshal_OfferOption(data: Any) -> OfferOption:
185292
if field is not None:
186293
args["quota_warning"] = field
187294

295+
field = data.get("price", None)
296+
if field is not None:
297+
args["price"] = unmarshal_Money(field)
298+
else:
299+
args["price"] = None
300+
188301
return OfferOption(**args)
189302

190303

@@ -778,6 +891,18 @@ def marshal_DatabaseApiUnassignDatabaseUserRequest(
778891
return output
779892

780893

894+
def marshal_DnsApiCheckUserOwnsDomainRequest(
895+
request: DnsApiCheckUserOwnsDomainRequest,
896+
defaults: ProfileDefaults,
897+
) -> Dict[str, Any]:
898+
output: Dict[str, Any] = {}
899+
900+
if request.project_id is not None:
901+
output["project_id"] = request.project_id or defaults.default_project_id
902+
903+
return output
904+
905+
781906
def marshal_FtpAccountApiChangeFtpAccountPasswordRequest(
782907
request: FtpAccountApiChangeFtpAccountPasswordRequest,
783908
defaults: ProfileDefaults,

0 commit comments

Comments
 (0)