3636 DnsApiCheckUserOwnsDomainRequest ,
3737 DnsApiSyncDomainDnsRecordsRequest ,
3838 DnsRecords ,
39+ Domain ,
3940 FtpAccount ,
4041 FtpAccountApiChangeFtpAccountPasswordRequest ,
4142 FtpAccountApiCreateFtpAccountRequest ,
5960 OfferOptionRequest ,
6061 ResetHostingPasswordResponse ,
6162 ResourceSummary ,
63+ SearchDomainsResponse ,
6264 Session ,
6365 SyncDomainDnsRecordsRequestRecord ,
6466 Website ,
6567)
6668from .content import (
69+ DOMAIN_TRANSIENT_STATUSES ,
6770 HOSTING_TRANSIENT_STATUSES ,
6871)
6972from .marshalling import (
7376 unmarshal_MailAccount ,
7477 unmarshal_CheckUserOwnsDomainResponse ,
7578 unmarshal_DnsRecords ,
79+ unmarshal_Domain ,
7680 unmarshal_Hosting ,
7781 unmarshal_ListControlPanelsResponse ,
7882 unmarshal_ListDatabaseUsersResponse ,
8488 unmarshal_ListWebsitesResponse ,
8589 unmarshal_ResetHostingPasswordResponse ,
8690 unmarshal_ResourceSummary ,
91+ unmarshal_SearchDomainsResponse ,
8792 unmarshal_Session ,
8893 marshal_DatabaseApiAssignDatabaseUserRequest ,
8994 marshal_DatabaseApiChangeDatabaseUserPasswordRequest ,
@@ -792,7 +797,7 @@ async def check_user_owns_domain(
792797 project_id : Optional [str ] = None ,
793798 ) -> CheckUserOwnsDomainResponse :
794799 """
795- " Check whether you own this domain or not." .
800+ Check whether you own this domain or not.
796801 :param domain: Domain for which ownership is to be verified.
797802 :param region: Region to target. If none is passed will use default region from the config.
798803 :param project_id: ID of the project currently in use.
@@ -834,15 +839,17 @@ async def sync_domain_dns_records(
834839 update_web_records : bool ,
835840 update_mail_records : bool ,
836841 update_all_records : bool ,
842+ update_nameservers : bool ,
837843 region : Optional [ScwRegion ] = None ,
838844 custom_records : Optional [List [SyncDomainDnsRecordsRequestRecord ]] = None ,
839845 ) -> DnsRecords :
840846 """
841- " Synchronize your DNS records on the Elements Console and on cPanel." .
847+ Synchronize your DNS records on the Elements Console and on cPanel.
842848 :param domain: Domain for which the DNS records will be synchronized.
843849 :param update_web_records: Whether or not to synchronize the web records.
844850 :param update_mail_records: Whether or not to synchronize the mail records.
845851 :param update_all_records: Whether or not to synchronize all types of records. This one has priority.
852+ :param update_nameservers: Whether or not to synchronize domain nameservers.
846853 :param region: Region to target. If none is passed will use default region from the config.
847854 :param custom_records: Custom records to synchronize.
848855 :return: :class:`DnsRecords <DnsRecords>`
@@ -855,6 +862,7 @@ async def sync_domain_dns_records(
855862 update_web_records=False,
856863 update_mail_records=False,
857864 update_all_records=False,
865+ update_nameservers=False,
858866 )
859867 """
860868
@@ -872,6 +880,7 @@ async def sync_domain_dns_records(
872880 update_web_records = update_web_records ,
873881 update_mail_records = update_mail_records ,
874882 update_all_records = update_all_records ,
883+ update_nameservers = update_nameservers ,
875884 region = region ,
876885 custom_records = custom_records ,
877886 ),
@@ -882,6 +891,121 @@ async def sync_domain_dns_records(
882891 self ._throw_on_error (res )
883892 return unmarshal_DnsRecords (res .json ())
884893
894+ async def search_domains (
895+ self ,
896+ * ,
897+ domain_name : str ,
898+ region : Optional [ScwRegion ] = None ,
899+ project_id : Optional [str ] = None ,
900+ ) -> SearchDomainsResponse :
901+ """
902+ Search for available domains based on domain name.
903+ :param domain_name: Domain name to search.
904+ :param region: Region to target. If none is passed will use default region from the config.
905+ :param project_id: ID of the Scaleway Project in which to search the domain to create the Web Hosting plan.
906+ :return: :class:`SearchDomainsResponse <SearchDomainsResponse>`
907+
908+ Usage:
909+ ::
910+
911+ result = await api.search_domains(
912+ domain_name="example",
913+ )
914+ """
915+
916+ param_region = validate_path_param (
917+ "region" , region or self .client .default_region
918+ )
919+
920+ res = self ._request (
921+ "GET" ,
922+ f"/webhosting/v1/regions/{ param_region } /search-domains" ,
923+ params = {
924+ "domain_name" : domain_name ,
925+ "project_id" : project_id or self .client .default_project_id ,
926+ },
927+ )
928+
929+ self ._throw_on_error (res )
930+ return unmarshal_SearchDomainsResponse (res .json ())
931+
932+ async def get_domain (
933+ self ,
934+ * ,
935+ domain_name : str ,
936+ region : Optional [ScwRegion ] = None ,
937+ project_id : Optional [str ] = None ,
938+ ) -> Domain :
939+ """
940+ Retrieve detailed information about a specific domain, including its status, DNS configuration, and ownership.
941+ :param domain_name: Domain name to get.
942+ :param region: Region to target. If none is passed will use default region from the config.
943+ :param project_id: ID of the Scaleway Project in which to get the domain to create the Web Hosting plan.
944+ :return: :class:`Domain <Domain>`
945+
946+ Usage:
947+ ::
948+
949+ result = await api.get_domain(
950+ domain_name="example",
951+ )
952+ """
953+
954+ param_region = validate_path_param (
955+ "region" , region or self .client .default_region
956+ )
957+ param_domain_name = validate_path_param ("domain_name" , domain_name )
958+
959+ res = self ._request (
960+ "GET" ,
961+ f"/webhosting/v1/regions/{ param_region } /domains/{ param_domain_name } " ,
962+ params = {
963+ "project_id" : project_id or self .client .default_project_id ,
964+ },
965+ )
966+
967+ self ._throw_on_error (res )
968+ return unmarshal_Domain (res .json ())
969+
970+ async def wait_for_domain (
971+ self ,
972+ * ,
973+ domain_name : str ,
974+ region : Optional [ScwRegion ] = None ,
975+ project_id : Optional [str ] = None ,
976+ options : Optional [WaitForOptions [Domain , Union [bool , Awaitable [bool ]]]] = None ,
977+ ) -> Domain :
978+ """
979+ Retrieve detailed information about a specific domain, including its status, DNS configuration, and ownership.
980+ :param domain_name: Domain name to get.
981+ :param region: Region to target. If none is passed will use default region from the config.
982+ :param project_id: ID of the Scaleway Project in which to get the domain to create the Web Hosting plan.
983+ :return: :class:`Domain <Domain>`
984+
985+ Usage:
986+ ::
987+
988+ result = await api.get_domain(
989+ domain_name="example",
990+ )
991+ """
992+
993+ if not options :
994+ options = WaitForOptions ()
995+
996+ if not options .stop :
997+ options .stop = lambda res : res .status not in DOMAIN_TRANSIENT_STATUSES
998+
999+ return await wait_for_resource_async (
1000+ fetcher = self .get_domain ,
1001+ options = options ,
1002+ args = {
1003+ "domain_name" : domain_name ,
1004+ "region" : region ,
1005+ "project_id" : project_id ,
1006+ },
1007+ )
1008+
8851009
8861010class WebhostingV1OfferAPI (API ):
8871011 """
0 commit comments