diff --git a/scaleway-async/scaleway_async/secret/v1beta1/marshalling.py b/scaleway-async/scaleway_async/secret/v1beta1/marshalling.py index 5464afcf..699110e5 100644 --- a/scaleway-async/scaleway_async/secret/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/secret/v1beta1/marshalling.py @@ -92,6 +92,12 @@ def unmarshal_SecretVersion(data: Any) -> SecretVersion: else: args["updated_at"] = None + field = data.get("deleted_at", None) + if field is not None: + args["deleted_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["deleted_at"] = None + field = data.get("description", None) if field is not None: args["description"] = field diff --git a/scaleway-async/scaleway_async/secret/v1beta1/types.py b/scaleway-async/scaleway_async/secret/v1beta1/types.py index 8229930e..8c6b07ce 100644 --- a/scaleway-async/scaleway_async/secret/v1beta1/types.py +++ b/scaleway-async/scaleway_async/secret/v1beta1/types.py @@ -192,6 +192,11 @@ class SecretVersion: Last update of the version. """ + deleted_at: Optional[datetime] + """ + Date and time of the version's deletion. + """ + description: Optional[str] """ Description of the version. diff --git a/scaleway-async/scaleway_async/webhosting/v1/__init__.py b/scaleway-async/scaleway_async/webhosting/v1/__init__.py index 894681ee..0ae2a234 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/__init__.py +++ b/scaleway-async/scaleway_async/webhosting/v1/__init__.py @@ -24,6 +24,7 @@ from .types import CreateDatabaseRequestUser from .types import CreateHostingRequestDomainConfiguration from .types import OfferOptionRequest +from .types import SyncDomainDnsRecordsRequestRecord from .types import DnsRecord from .types import Nameserver from .types import HostingUser @@ -51,6 +52,7 @@ from .types import DatabaseApiUnassignDatabaseUserRequest from .types import DnsApiCheckUserOwnsDomainRequest from .types import DnsApiGetDomainDnsRecordsRequest +from .types import DnsApiSyncDomainDnsRecordsRequest from .types import DnsRecords from .types import FtpAccountApiChangeFtpAccountPasswordRequest from .types import FtpAccountApiCreateFtpAccountRequest @@ -116,6 +118,7 @@ "CreateDatabaseRequestUser", "CreateHostingRequestDomainConfiguration", "OfferOptionRequest", + "SyncDomainDnsRecordsRequestRecord", "DnsRecord", "Nameserver", "HostingUser", @@ -143,6 +146,7 @@ "DatabaseApiUnassignDatabaseUserRequest", "DnsApiCheckUserOwnsDomainRequest", "DnsApiGetDomainDnsRecordsRequest", + "DnsApiSyncDomainDnsRecordsRequest", "DnsRecords", "FtpAccountApiChangeFtpAccountPasswordRequest", "FtpAccountApiCreateFtpAccountRequest", diff --git a/scaleway-async/scaleway_async/webhosting/v1/api.py b/scaleway-async/scaleway_async/webhosting/v1/api.py index 3d1b374e..ae644969 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/api.py +++ b/scaleway-async/scaleway_async/webhosting/v1/api.py @@ -34,6 +34,7 @@ DatabaseApiUnassignDatabaseUserRequest, DatabaseUser, DnsApiCheckUserOwnsDomainRequest, + DnsApiSyncDomainDnsRecordsRequest, DnsRecords, FtpAccount, FtpAccountApiChangeFtpAccountPasswordRequest, @@ -59,6 +60,7 @@ ResetHostingPasswordResponse, ResourceSummary, Session, + SyncDomainDnsRecordsRequestRecord, Website, ) from .content import ( @@ -89,6 +91,7 @@ marshal_DatabaseApiCreateDatabaseUserRequest, marshal_DatabaseApiUnassignDatabaseUserRequest, marshal_DnsApiCheckUserOwnsDomainRequest, + marshal_DnsApiSyncDomainDnsRecordsRequest, marshal_FtpAccountApiChangeFtpAccountPasswordRequest, marshal_FtpAccountApiCreateFtpAccountRequest, marshal_HostingApiCreateHostingRequest, @@ -824,6 +827,61 @@ async def check_user_owns_domain( self._throw_on_error(res) return unmarshal_CheckUserOwnsDomainResponse(res.json()) + async def sync_domain_dns_records( + self, + *, + domain: str, + update_web_records: bool, + update_mail_records: bool, + update_all_records: bool, + region: Optional[Region] = None, + custom_records: Optional[List[SyncDomainDnsRecordsRequestRecord]] = None, + ) -> DnsRecords: + """ + "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 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 ` + + Usage: + :: + + result = await api.sync_domain_dns_records( + domain="example", + update_web_records=False, + update_mail_records=False, + update_all_records=False, + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_domain = validate_path_param("domain", domain) + + res = self._request( + "POST", + f"/webhosting/v1/regions/{param_region}/domains/{param_domain}/sync-domain-dns-records", + body=marshal_DnsApiSyncDomainDnsRecordsRequest( + DnsApiSyncDomainDnsRecordsRequest( + domain=domain, + update_web_records=update_web_records, + update_mail_records=update_mail_records, + update_all_records=update_all_records, + region=region, + custom_records=custom_records, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_DnsRecords(res.json()) + class WebhostingV1OfferAPI(API): """ diff --git a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py index 99221035..0ea580f6 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py +++ b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py @@ -49,6 +49,8 @@ DatabaseApiCreateDatabaseUserRequest, DatabaseApiUnassignDatabaseUserRequest, DnsApiCheckUserOwnsDomainRequest, + SyncDomainDnsRecordsRequestRecord, + DnsApiSyncDomainDnsRecordsRequest, FtpAccountApiChangeFtpAccountPasswordRequest, FtpAccountApiCreateFtpAccountRequest, CreateHostingRequestDomainConfiguration, @@ -939,6 +941,45 @@ def marshal_DnsApiCheckUserOwnsDomainRequest( return output +def marshal_SyncDomainDnsRecordsRequestRecord( + request: SyncDomainDnsRecordsRequestRecord, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.name is not None: + output["name"] = request.name + + if request.type_ is not None: + output["type"] = str(request.type_) + + return output + + +def marshal_DnsApiSyncDomainDnsRecordsRequest( + request: DnsApiSyncDomainDnsRecordsRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.update_web_records is not None: + output["update_web_records"] = request.update_web_records + + if request.update_mail_records is not None: + output["update_mail_records"] = request.update_mail_records + + if request.update_all_records is not None: + output["update_all_records"] = request.update_all_records + + if request.custom_records is not None: + output["custom_records"] = [ + marshal_SyncDomainDnsRecordsRequestRecord(item, defaults) + for item in request.custom_records + ] + + return output + + def marshal_FtpAccountApiChangeFtpAccountPasswordRequest( request: FtpAccountApiChangeFtpAccountPasswordRequest, defaults: ProfileDefaults, diff --git a/scaleway-async/scaleway_async/webhosting/v1/types.py b/scaleway-async/scaleway_async/webhosting/v1/types.py index 1202b233..e1fc50be 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/types.py +++ b/scaleway-async/scaleway_async/webhosting/v1/types.py @@ -274,6 +274,13 @@ class OfferOptionRequest: """ +@dataclass +class SyncDomainDnsRecordsRequestRecord: + name: str + + type_: DnsRecordType + + @dataclass class DnsRecord: name: str @@ -859,6 +866,39 @@ class DnsApiGetDomainDnsRecordsRequest: """ +@dataclass +class DnsApiSyncDomainDnsRecordsRequest: + domain: str + """ + Domain for which the DNS records will be synchronized. + """ + + update_web_records: bool + """ + Whether or not to synchronize the web records. + """ + + update_mail_records: bool + """ + Whether or not to synchronize the mail records. + """ + + update_all_records: bool + """ + Whether or not to synchronize all types of records. This one has priority. + """ + + region: Optional[Region] + """ + Region to target. If none is passed will use default region from the config. + """ + + custom_records: Optional[List[SyncDomainDnsRecordsRequestRecord]] + """ + Custom records to synchronize. + """ + + @dataclass class DnsRecords: records: List[DnsRecord] diff --git a/scaleway/scaleway/secret/v1beta1/marshalling.py b/scaleway/scaleway/secret/v1beta1/marshalling.py index 5464afcf..699110e5 100644 --- a/scaleway/scaleway/secret/v1beta1/marshalling.py +++ b/scaleway/scaleway/secret/v1beta1/marshalling.py @@ -92,6 +92,12 @@ def unmarshal_SecretVersion(data: Any) -> SecretVersion: else: args["updated_at"] = None + field = data.get("deleted_at", None) + if field is not None: + args["deleted_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["deleted_at"] = None + field = data.get("description", None) if field is not None: args["description"] = field diff --git a/scaleway/scaleway/secret/v1beta1/types.py b/scaleway/scaleway/secret/v1beta1/types.py index 8229930e..8c6b07ce 100644 --- a/scaleway/scaleway/secret/v1beta1/types.py +++ b/scaleway/scaleway/secret/v1beta1/types.py @@ -192,6 +192,11 @@ class SecretVersion: Last update of the version. """ + deleted_at: Optional[datetime] + """ + Date and time of the version's deletion. + """ + description: Optional[str] """ Description of the version. diff --git a/scaleway/scaleway/webhosting/v1/__init__.py b/scaleway/scaleway/webhosting/v1/__init__.py index 894681ee..0ae2a234 100644 --- a/scaleway/scaleway/webhosting/v1/__init__.py +++ b/scaleway/scaleway/webhosting/v1/__init__.py @@ -24,6 +24,7 @@ from .types import CreateDatabaseRequestUser from .types import CreateHostingRequestDomainConfiguration from .types import OfferOptionRequest +from .types import SyncDomainDnsRecordsRequestRecord from .types import DnsRecord from .types import Nameserver from .types import HostingUser @@ -51,6 +52,7 @@ from .types import DatabaseApiUnassignDatabaseUserRequest from .types import DnsApiCheckUserOwnsDomainRequest from .types import DnsApiGetDomainDnsRecordsRequest +from .types import DnsApiSyncDomainDnsRecordsRequest from .types import DnsRecords from .types import FtpAccountApiChangeFtpAccountPasswordRequest from .types import FtpAccountApiCreateFtpAccountRequest @@ -116,6 +118,7 @@ "CreateDatabaseRequestUser", "CreateHostingRequestDomainConfiguration", "OfferOptionRequest", + "SyncDomainDnsRecordsRequestRecord", "DnsRecord", "Nameserver", "HostingUser", @@ -143,6 +146,7 @@ "DatabaseApiUnassignDatabaseUserRequest", "DnsApiCheckUserOwnsDomainRequest", "DnsApiGetDomainDnsRecordsRequest", + "DnsApiSyncDomainDnsRecordsRequest", "DnsRecords", "FtpAccountApiChangeFtpAccountPasswordRequest", "FtpAccountApiCreateFtpAccountRequest", diff --git a/scaleway/scaleway/webhosting/v1/api.py b/scaleway/scaleway/webhosting/v1/api.py index 2745e230..850c0caa 100644 --- a/scaleway/scaleway/webhosting/v1/api.py +++ b/scaleway/scaleway/webhosting/v1/api.py @@ -34,6 +34,7 @@ DatabaseApiUnassignDatabaseUserRequest, DatabaseUser, DnsApiCheckUserOwnsDomainRequest, + DnsApiSyncDomainDnsRecordsRequest, DnsRecords, FtpAccount, FtpAccountApiChangeFtpAccountPasswordRequest, @@ -59,6 +60,7 @@ ResetHostingPasswordResponse, ResourceSummary, Session, + SyncDomainDnsRecordsRequestRecord, Website, ) from .content import ( @@ -89,6 +91,7 @@ marshal_DatabaseApiCreateDatabaseUserRequest, marshal_DatabaseApiUnassignDatabaseUserRequest, marshal_DnsApiCheckUserOwnsDomainRequest, + marshal_DnsApiSyncDomainDnsRecordsRequest, marshal_FtpAccountApiChangeFtpAccountPasswordRequest, marshal_FtpAccountApiCreateFtpAccountRequest, marshal_HostingApiCreateHostingRequest, @@ -824,6 +827,61 @@ def check_user_owns_domain( self._throw_on_error(res) return unmarshal_CheckUserOwnsDomainResponse(res.json()) + def sync_domain_dns_records( + self, + *, + domain: str, + update_web_records: bool, + update_mail_records: bool, + update_all_records: bool, + region: Optional[Region] = None, + custom_records: Optional[List[SyncDomainDnsRecordsRequestRecord]] = None, + ) -> DnsRecords: + """ + "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 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 ` + + Usage: + :: + + result = api.sync_domain_dns_records( + domain="example", + update_web_records=False, + update_mail_records=False, + update_all_records=False, + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_domain = validate_path_param("domain", domain) + + res = self._request( + "POST", + f"/webhosting/v1/regions/{param_region}/domains/{param_domain}/sync-domain-dns-records", + body=marshal_DnsApiSyncDomainDnsRecordsRequest( + DnsApiSyncDomainDnsRecordsRequest( + domain=domain, + update_web_records=update_web_records, + update_mail_records=update_mail_records, + update_all_records=update_all_records, + region=region, + custom_records=custom_records, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_DnsRecords(res.json()) + class WebhostingV1OfferAPI(API): """ diff --git a/scaleway/scaleway/webhosting/v1/marshalling.py b/scaleway/scaleway/webhosting/v1/marshalling.py index 99221035..0ea580f6 100644 --- a/scaleway/scaleway/webhosting/v1/marshalling.py +++ b/scaleway/scaleway/webhosting/v1/marshalling.py @@ -49,6 +49,8 @@ DatabaseApiCreateDatabaseUserRequest, DatabaseApiUnassignDatabaseUserRequest, DnsApiCheckUserOwnsDomainRequest, + SyncDomainDnsRecordsRequestRecord, + DnsApiSyncDomainDnsRecordsRequest, FtpAccountApiChangeFtpAccountPasswordRequest, FtpAccountApiCreateFtpAccountRequest, CreateHostingRequestDomainConfiguration, @@ -939,6 +941,45 @@ def marshal_DnsApiCheckUserOwnsDomainRequest( return output +def marshal_SyncDomainDnsRecordsRequestRecord( + request: SyncDomainDnsRecordsRequestRecord, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.name is not None: + output["name"] = request.name + + if request.type_ is not None: + output["type"] = str(request.type_) + + return output + + +def marshal_DnsApiSyncDomainDnsRecordsRequest( + request: DnsApiSyncDomainDnsRecordsRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.update_web_records is not None: + output["update_web_records"] = request.update_web_records + + if request.update_mail_records is not None: + output["update_mail_records"] = request.update_mail_records + + if request.update_all_records is not None: + output["update_all_records"] = request.update_all_records + + if request.custom_records is not None: + output["custom_records"] = [ + marshal_SyncDomainDnsRecordsRequestRecord(item, defaults) + for item in request.custom_records + ] + + return output + + def marshal_FtpAccountApiChangeFtpAccountPasswordRequest( request: FtpAccountApiChangeFtpAccountPasswordRequest, defaults: ProfileDefaults, diff --git a/scaleway/scaleway/webhosting/v1/types.py b/scaleway/scaleway/webhosting/v1/types.py index 1202b233..e1fc50be 100644 --- a/scaleway/scaleway/webhosting/v1/types.py +++ b/scaleway/scaleway/webhosting/v1/types.py @@ -274,6 +274,13 @@ class OfferOptionRequest: """ +@dataclass +class SyncDomainDnsRecordsRequestRecord: + name: str + + type_: DnsRecordType + + @dataclass class DnsRecord: name: str @@ -859,6 +866,39 @@ class DnsApiGetDomainDnsRecordsRequest: """ +@dataclass +class DnsApiSyncDomainDnsRecordsRequest: + domain: str + """ + Domain for which the DNS records will be synchronized. + """ + + update_web_records: bool + """ + Whether or not to synchronize the web records. + """ + + update_mail_records: bool + """ + Whether or not to synchronize the mail records. + """ + + update_all_records: bool + """ + Whether or not to synchronize all types of records. This one has priority. + """ + + region: Optional[Region] + """ + Region to target. If none is passed will use default region from the config. + """ + + custom_records: Optional[List[SyncDomainDnsRecordsRequestRecord]] + """ + Custom records to synchronize. + """ + + @dataclass class DnsRecords: records: List[DnsRecord]