Skip to content

Commit df2382a

Browse files
authored
feat(tem): add support for UpdateDomain (#631)
1 parent ec8420a commit df2382a

File tree

8 files changed

+158
-0
lines changed

8 files changed

+158
-0
lines changed

scaleway-async/scaleway_async/tem/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from .types import ListWebhooksResponse
5252
from .types import RevokeDomainRequest
5353
from .types import Statistics
54+
from .types import UpdateDomainRequest
5455
from .types import UpdateWebhookRequest
5556
from .api import TemV1Alpha1API
5657

@@ -106,6 +107,7 @@
106107
"ListWebhooksResponse",
107108
"RevokeDomainRequest",
108109
"Statistics",
110+
"UpdateDomainRequest",
109111
"UpdateWebhookRequest",
110112
"TemV1Alpha1API",
111113
]

scaleway-async/scaleway_async/tem/v1alpha1/api.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
ListWebhookEventsResponse,
3939
ListWebhooksResponse,
4040
Statistics,
41+
UpdateDomainRequest,
4142
UpdateWebhookRequest,
4243
Webhook,
4344
WebhookEvent,
@@ -60,6 +61,7 @@
6061
marshal_CreateDomainRequest,
6162
marshal_CreateEmailRequest,
6263
marshal_CreateWebhookRequest,
64+
marshal_UpdateDomainRequest,
6365
marshal_UpdateWebhookRequest,
6466
)
6567

@@ -761,6 +763,50 @@ async def get_domain_last_status(
761763
self._throw_on_error(res)
762764
return unmarshal_DomainLastStatus(res.json())
763765

766+
async def update_domain(
767+
self,
768+
*,
769+
domain_id: str,
770+
region: Optional[Region] = None,
771+
autoconfig: Optional[bool] = None,
772+
) -> Domain:
773+
"""
774+
Update a domain.
775+
Update a domain auto-configuration.
776+
:param domain_id: ID of the domain to update.
777+
:param region: Region to target. If none is passed will use default region from the config.
778+
:param autoconfig: (Optional) If set to true, activate auto-configuration of the domain's DNS zone.
779+
:return: :class:`Domain <Domain>`
780+
781+
Usage:
782+
::
783+
784+
result = await api.update_domain(
785+
domain_id="example",
786+
)
787+
"""
788+
789+
param_region = validate_path_param(
790+
"region", region or self.client.default_region
791+
)
792+
param_domain_id = validate_path_param("domain_id", domain_id)
793+
794+
res = self._request(
795+
"PATCH",
796+
f"/transactional-email/v1alpha1/regions/{param_region}/domains/{param_domain_id}",
797+
body=marshal_UpdateDomainRequest(
798+
UpdateDomainRequest(
799+
domain_id=domain_id,
800+
region=region,
801+
autoconfig=autoconfig,
802+
),
803+
self.client,
804+
),
805+
)
806+
807+
self._throw_on_error(res)
808+
return unmarshal_Domain(res.json())
809+
764810
async def create_webhook(
765811
self,
766812
*,

scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
CreateEmailRequestHeader,
3434
CreateEmailRequest,
3535
CreateWebhookRequest,
36+
UpdateDomainRequest,
3637
UpdateWebhookRequest,
3738
)
3839

@@ -869,6 +870,18 @@ def marshal_CreateWebhookRequest(
869870
return output
870871

871872

873+
def marshal_UpdateDomainRequest(
874+
request: UpdateDomainRequest,
875+
defaults: ProfileDefaults,
876+
) -> Dict[str, Any]:
877+
output: Dict[str, Any] = {}
878+
879+
if request.autoconfig is not None:
880+
output["autoconfig"] = request.autoconfig
881+
882+
return output
883+
884+
872885
def marshal_UpdateWebhookRequest(
873886
request: UpdateWebhookRequest,
874887
defaults: ProfileDefaults,

scaleway-async/scaleway_async/tem/v1alpha1/types.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,24 @@ class Statistics:
11881188
"""
11891189

11901190

1191+
@dataclass
1192+
class UpdateDomainRequest:
1193+
domain_id: str
1194+
"""
1195+
ID of the domain to update.
1196+
"""
1197+
1198+
region: Optional[Region]
1199+
"""
1200+
Region to target. If none is passed will use default region from the config.
1201+
"""
1202+
1203+
autoconfig: Optional[bool]
1204+
"""
1205+
(Optional) If set to true, activate auto-configuration of the domain's DNS zone.
1206+
"""
1207+
1208+
11911209
@dataclass
11921210
class UpdateWebhookRequest:
11931211
webhook_id: str

scaleway/scaleway/tem/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from .types import ListWebhooksResponse
5252
from .types import RevokeDomainRequest
5353
from .types import Statistics
54+
from .types import UpdateDomainRequest
5455
from .types import UpdateWebhookRequest
5556
from .api import TemV1Alpha1API
5657

@@ -106,6 +107,7 @@
106107
"ListWebhooksResponse",
107108
"RevokeDomainRequest",
108109
"Statistics",
110+
"UpdateDomainRequest",
109111
"UpdateWebhookRequest",
110112
"TemV1Alpha1API",
111113
]

scaleway/scaleway/tem/v1alpha1/api.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
ListWebhookEventsResponse,
3939
ListWebhooksResponse,
4040
Statistics,
41+
UpdateDomainRequest,
4142
UpdateWebhookRequest,
4243
Webhook,
4344
WebhookEvent,
@@ -60,6 +61,7 @@
6061
marshal_CreateDomainRequest,
6162
marshal_CreateEmailRequest,
6263
marshal_CreateWebhookRequest,
64+
marshal_UpdateDomainRequest,
6365
marshal_UpdateWebhookRequest,
6466
)
6567

@@ -761,6 +763,50 @@ def get_domain_last_status(
761763
self._throw_on_error(res)
762764
return unmarshal_DomainLastStatus(res.json())
763765

766+
def update_domain(
767+
self,
768+
*,
769+
domain_id: str,
770+
region: Optional[Region] = None,
771+
autoconfig: Optional[bool] = None,
772+
) -> Domain:
773+
"""
774+
Update a domain.
775+
Update a domain auto-configuration.
776+
:param domain_id: ID of the domain to update.
777+
:param region: Region to target. If none is passed will use default region from the config.
778+
:param autoconfig: (Optional) If set to true, activate auto-configuration of the domain's DNS zone.
779+
:return: :class:`Domain <Domain>`
780+
781+
Usage:
782+
::
783+
784+
result = api.update_domain(
785+
domain_id="example",
786+
)
787+
"""
788+
789+
param_region = validate_path_param(
790+
"region", region or self.client.default_region
791+
)
792+
param_domain_id = validate_path_param("domain_id", domain_id)
793+
794+
res = self._request(
795+
"PATCH",
796+
f"/transactional-email/v1alpha1/regions/{param_region}/domains/{param_domain_id}",
797+
body=marshal_UpdateDomainRequest(
798+
UpdateDomainRequest(
799+
domain_id=domain_id,
800+
region=region,
801+
autoconfig=autoconfig,
802+
),
803+
self.client,
804+
),
805+
)
806+
807+
self._throw_on_error(res)
808+
return unmarshal_Domain(res.json())
809+
764810
def create_webhook(
765811
self,
766812
*,

scaleway/scaleway/tem/v1alpha1/marshalling.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
CreateEmailRequestHeader,
3434
CreateEmailRequest,
3535
CreateWebhookRequest,
36+
UpdateDomainRequest,
3637
UpdateWebhookRequest,
3738
)
3839

@@ -869,6 +870,18 @@ def marshal_CreateWebhookRequest(
869870
return output
870871

871872

873+
def marshal_UpdateDomainRequest(
874+
request: UpdateDomainRequest,
875+
defaults: ProfileDefaults,
876+
) -> Dict[str, Any]:
877+
output: Dict[str, Any] = {}
878+
879+
if request.autoconfig is not None:
880+
output["autoconfig"] = request.autoconfig
881+
882+
return output
883+
884+
872885
def marshal_UpdateWebhookRequest(
873886
request: UpdateWebhookRequest,
874887
defaults: ProfileDefaults,

scaleway/scaleway/tem/v1alpha1/types.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,24 @@ class Statistics:
11881188
"""
11891189

11901190

1191+
@dataclass
1192+
class UpdateDomainRequest:
1193+
domain_id: str
1194+
"""
1195+
ID of the domain to update.
1196+
"""
1197+
1198+
region: Optional[Region]
1199+
"""
1200+
Region to target. If none is passed will use default region from the config.
1201+
"""
1202+
1203+
autoconfig: Optional[bool]
1204+
"""
1205+
(Optional) If set to true, activate auto-configuration of the domain's DNS zone.
1206+
"""
1207+
1208+
11911209
@dataclass
11921210
class UpdateWebhookRequest:
11931211
webhook_id: str

0 commit comments

Comments
 (0)