36
36
DnsApiCheckUserOwnsDomainRequest ,
37
37
DnsApiSyncDomainDnsRecordsRequest ,
38
38
DnsRecords ,
39
+ Domain ,
39
40
FtpAccount ,
40
41
FtpAccountApiChangeFtpAccountPasswordRequest ,
41
42
FtpAccountApiCreateFtpAccountRequest ,
59
60
OfferOptionRequest ,
60
61
ResetHostingPasswordResponse ,
61
62
ResourceSummary ,
63
+ SearchDomainsResponse ,
62
64
Session ,
63
65
SyncDomainDnsRecordsRequestRecord ,
64
66
Website ,
65
67
)
66
68
from .content import (
69
+ DOMAIN_TRANSIENT_STATUSES ,
67
70
HOSTING_TRANSIENT_STATUSES ,
68
71
)
69
72
from .marshalling import (
73
76
unmarshal_MailAccount ,
74
77
unmarshal_CheckUserOwnsDomainResponse ,
75
78
unmarshal_DnsRecords ,
79
+ unmarshal_Domain ,
76
80
unmarshal_Hosting ,
77
81
unmarshal_ListControlPanelsResponse ,
78
82
unmarshal_ListDatabaseUsersResponse ,
84
88
unmarshal_ListWebsitesResponse ,
85
89
unmarshal_ResetHostingPasswordResponse ,
86
90
unmarshal_ResourceSummary ,
91
+ unmarshal_SearchDomainsResponse ,
87
92
unmarshal_Session ,
88
93
marshal_DatabaseApiAssignDatabaseUserRequest ,
89
94
marshal_DatabaseApiChangeDatabaseUserPasswordRequest ,
@@ -792,7 +797,7 @@ async def check_user_owns_domain(
792
797
project_id : Optional [str ] = None ,
793
798
) -> CheckUserOwnsDomainResponse :
794
799
"""
795
- " Check whether you own this domain or not." .
800
+ Check whether you own this domain or not.
796
801
:param domain: Domain for which ownership is to be verified.
797
802
:param region: Region to target. If none is passed will use default region from the config.
798
803
:param project_id: ID of the project currently in use.
@@ -834,15 +839,17 @@ async def sync_domain_dns_records(
834
839
update_web_records : bool ,
835
840
update_mail_records : bool ,
836
841
update_all_records : bool ,
842
+ update_nameservers : bool ,
837
843
region : Optional [ScwRegion ] = None ,
838
844
custom_records : Optional [List [SyncDomainDnsRecordsRequestRecord ]] = None ,
839
845
) -> DnsRecords :
840
846
"""
841
- " Synchronize your DNS records on the Elements Console and on cPanel." .
847
+ Synchronize your DNS records on the Elements Console and on cPanel.
842
848
:param domain: Domain for which the DNS records will be synchronized.
843
849
:param update_web_records: Whether or not to synchronize the web records.
844
850
:param update_mail_records: Whether or not to synchronize the mail records.
845
851
: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.
846
853
:param region: Region to target. If none is passed will use default region from the config.
847
854
:param custom_records: Custom records to synchronize.
848
855
:return: :class:`DnsRecords <DnsRecords>`
@@ -855,6 +862,7 @@ async def sync_domain_dns_records(
855
862
update_web_records=False,
856
863
update_mail_records=False,
857
864
update_all_records=False,
865
+ update_nameservers=False,
858
866
)
859
867
"""
860
868
@@ -872,6 +880,7 @@ async def sync_domain_dns_records(
872
880
update_web_records = update_web_records ,
873
881
update_mail_records = update_mail_records ,
874
882
update_all_records = update_all_records ,
883
+ update_nameservers = update_nameservers ,
875
884
region = region ,
876
885
custom_records = custom_records ,
877
886
),
@@ -882,6 +891,121 @@ async def sync_domain_dns_records(
882
891
self ._throw_on_error (res )
883
892
return unmarshal_DnsRecords (res .json ())
884
893
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
+
885
1009
886
1010
class WebhostingV1OfferAPI (API ):
887
1011
"""
0 commit comments