Skip to content

Commit 3167c99

Browse files
fix(webhosting): require domain_name on RemoveCustomDomainRequest (#1224)
Co-authored-by: Mia-Cross <[email protected]>
1 parent 9c2dc86 commit 3167c99

File tree

6 files changed

+62
-2
lines changed

6 files changed

+62
-2
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
Hosting,
5050
HostingApiAddCustomDomainRequest,
5151
HostingApiCreateHostingRequest,
52+
HostingApiRemoveCustomDomainRequest,
5253
HostingApiUpdateHostingRequest,
5354
HostingSummary,
5455
ListBackupItemsResponse,
@@ -124,6 +125,7 @@
124125
marshal_FtpAccountApiCreateFtpAccountRequest,
125126
marshal_HostingApiAddCustomDomainRequest,
126127
marshal_HostingApiCreateHostingRequest,
128+
marshal_HostingApiRemoveCustomDomainRequest,
127129
marshal_HostingApiUpdateHostingRequest,
128130
marshal_MailAccountApiChangeMailAccountPasswordRequest,
129131
marshal_MailAccountApiCreateMailAccountRequest,
@@ -1913,11 +1915,13 @@ async def remove_custom_domain(
19131915
self,
19141916
*,
19151917
hosting_id: str,
1918+
domain_name: str,
19161919
region: Optional[ScwRegion] = None,
19171920
) -> HostingSummary:
19181921
"""
19191922
Detach a custom domain from a webhosting.
19201923
:param hosting_id: Hosting ID to which the custom domain is detached from.
1924+
:param domain_name: The custom domain name to detach from the hosting.
19211925
:param region: Region to target. If none is passed will use default region from the config.
19221926
:return: :class:`HostingSummary <HostingSummary>`
19231927
@@ -1926,6 +1930,7 @@ async def remove_custom_domain(
19261930
19271931
result = await api.remove_custom_domain(
19281932
hosting_id="example",
1933+
domain_name="example",
19291934
)
19301935
"""
19311936

@@ -1937,7 +1942,14 @@ async def remove_custom_domain(
19371942
res = self._request(
19381943
"POST",
19391944
f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/remove-custom-domain",
1940-
body={},
1945+
body=marshal_HostingApiRemoveCustomDomainRequest(
1946+
HostingApiRemoveCustomDomainRequest(
1947+
hosting_id=hosting_id,
1948+
domain_name=domain_name,
1949+
region=region,
1950+
),
1951+
self.client,
1952+
),
19411953
)
19421954

19431955
self._throw_on_error(res)

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
CreateHostingRequestDomainConfiguration,
9393
OfferOptionRequest,
9494
HostingApiCreateHostingRequest,
95+
HostingApiRemoveCustomDomainRequest,
9596
HostingApiUpdateHostingRequest,
9697
MailAccountApiChangeMailAccountPasswordRequest,
9798
MailAccountApiCreateMailAccountRequest,
@@ -1951,6 +1952,18 @@ def marshal_HostingApiCreateHostingRequest(
19511952
return output
19521953

19531954

1955+
def marshal_HostingApiRemoveCustomDomainRequest(
1956+
request: HostingApiRemoveCustomDomainRequest,
1957+
defaults: ProfileDefaults,
1958+
) -> Dict[str, Any]:
1959+
output: Dict[str, Any] = {}
1960+
1961+
if request.domain_name is not None:
1962+
output["domain_name"] = request.domain_name
1963+
1964+
return output
1965+
1966+
19541967
def marshal_HostingApiUpdateHostingRequest(
19551968
request: HostingApiUpdateHostingRequest,
19561969
defaults: ProfileDefaults,

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,11 @@ class HostingApiRemoveCustomDomainRequest:
18851885
Hosting ID to which the custom domain is detached from.
18861886
"""
18871887

1888+
domain_name: str
1889+
"""
1890+
The custom domain name to detach from the hosting.
1891+
"""
1892+
18881893
region: Optional[ScwRegion] = None
18891894
"""
18901895
Region to target. If none is passed will use default region from the config.

scaleway/scaleway/webhosting/v1/api.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
Hosting,
5050
HostingApiAddCustomDomainRequest,
5151
HostingApiCreateHostingRequest,
52+
HostingApiRemoveCustomDomainRequest,
5253
HostingApiUpdateHostingRequest,
5354
HostingSummary,
5455
ListBackupItemsResponse,
@@ -124,6 +125,7 @@
124125
marshal_FtpAccountApiCreateFtpAccountRequest,
125126
marshal_HostingApiAddCustomDomainRequest,
126127
marshal_HostingApiCreateHostingRequest,
128+
marshal_HostingApiRemoveCustomDomainRequest,
127129
marshal_HostingApiUpdateHostingRequest,
128130
marshal_MailAccountApiChangeMailAccountPasswordRequest,
129131
marshal_MailAccountApiCreateMailAccountRequest,
@@ -1913,11 +1915,13 @@ def remove_custom_domain(
19131915
self,
19141916
*,
19151917
hosting_id: str,
1918+
domain_name: str,
19161919
region: Optional[ScwRegion] = None,
19171920
) -> HostingSummary:
19181921
"""
19191922
Detach a custom domain from a webhosting.
19201923
:param hosting_id: Hosting ID to which the custom domain is detached from.
1924+
:param domain_name: The custom domain name to detach from the hosting.
19211925
:param region: Region to target. If none is passed will use default region from the config.
19221926
:return: :class:`HostingSummary <HostingSummary>`
19231927
@@ -1926,6 +1930,7 @@ def remove_custom_domain(
19261930
19271931
result = api.remove_custom_domain(
19281932
hosting_id="example",
1933+
domain_name="example",
19291934
)
19301935
"""
19311936

@@ -1937,7 +1942,14 @@ def remove_custom_domain(
19371942
res = self._request(
19381943
"POST",
19391944
f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/remove-custom-domain",
1940-
body={},
1945+
body=marshal_HostingApiRemoveCustomDomainRequest(
1946+
HostingApiRemoveCustomDomainRequest(
1947+
hosting_id=hosting_id,
1948+
domain_name=domain_name,
1949+
region=region,
1950+
),
1951+
self.client,
1952+
),
19411953
)
19421954

19431955
self._throw_on_error(res)

scaleway/scaleway/webhosting/v1/marshalling.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
CreateHostingRequestDomainConfiguration,
9393
OfferOptionRequest,
9494
HostingApiCreateHostingRequest,
95+
HostingApiRemoveCustomDomainRequest,
9596
HostingApiUpdateHostingRequest,
9697
MailAccountApiChangeMailAccountPasswordRequest,
9798
MailAccountApiCreateMailAccountRequest,
@@ -1951,6 +1952,18 @@ def marshal_HostingApiCreateHostingRequest(
19511952
return output
19521953

19531954

1955+
def marshal_HostingApiRemoveCustomDomainRequest(
1956+
request: HostingApiRemoveCustomDomainRequest,
1957+
defaults: ProfileDefaults,
1958+
) -> Dict[str, Any]:
1959+
output: Dict[str, Any] = {}
1960+
1961+
if request.domain_name is not None:
1962+
output["domain_name"] = request.domain_name
1963+
1964+
return output
1965+
1966+
19541967
def marshal_HostingApiUpdateHostingRequest(
19551968
request: HostingApiUpdateHostingRequest,
19561969
defaults: ProfileDefaults,

scaleway/scaleway/webhosting/v1/types.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,11 @@ class HostingApiRemoveCustomDomainRequest:
18851885
Hosting ID to which the custom domain is detached from.
18861886
"""
18871887

1888+
domain_name: str
1889+
"""
1890+
The custom domain name to detach from the hosting.
1891+
"""
1892+
18881893
region: Optional[ScwRegion] = None
18891894
"""
18901895
Region to target. If none is passed will use default region from the config.

0 commit comments

Comments
 (0)