Skip to content

Commit 2c6fa24

Browse files
authored
feat(webhosting): add free subdomain support (scaleway#2666)
1 parent 7ce14b2 commit 2c6fa24

File tree

1 file changed

+66
-27
lines changed

1 file changed

+66
-27
lines changed

api/webhosting/v1/webhosting_sdk.go

Lines changed: 66 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,24 @@ func (enum *PlatformPlatformGroup) UnmarshalJSON(data []byte) error {
935935
return nil
936936
}
937937

938+
// AutoConfigDomainDNS: auto config domain dns.
939+
type AutoConfigDomainDNS struct {
940+
// Nameservers: whether or not to synchronize domain nameservers.
941+
Nameservers bool `json:"nameservers"`
942+
943+
// WebRecords: whether or not to synchronize web records.
944+
WebRecords bool `json:"web_records"`
945+
946+
// MailRecords: whether or not to synchronize mail records.
947+
MailRecords bool `json:"mail_records"`
948+
949+
// AllRecords: whether or not to synchronize all types of records. Takes priority over the other fields.
950+
AllRecords bool `json:"all_records"`
951+
952+
// None: no automatic domain configuration. Users must configure their domain for the Web Hosting to work.
953+
None bool `json:"none"`
954+
}
955+
938956
// PlatformControlPanelURLs: platform control panel ur ls.
939957
type PlatformControlPanelURLs struct {
940958
// Dashboard: URL to connect to the hosting control panel dashboard.
@@ -944,6 +962,23 @@ type PlatformControlPanelURLs struct {
944962
Webmail string `json:"webmail"`
945963
}
946964

965+
// HostingDomainCustomDomain: hosting domain custom domain.
966+
type HostingDomainCustomDomain struct {
967+
// Domain: custom domain linked to the hosting plan.
968+
Domain string `json:"domain"`
969+
970+
// DomainStatus: status of the custom domain verification.
971+
// Default value: unknown_status
972+
DomainStatus DomainStatus `json:"domain_status"`
973+
974+
// DNSStatus: status of the DNS configuration for the custom domain.
975+
// Default value: unknown_status
976+
DNSStatus DNSRecordsStatus `json:"dns_status"`
977+
978+
// AutoConfigDomainDNS: indicates whether to auto-configure DNS for this domain.
979+
AutoConfigDomainDNS *AutoConfigDomainDNS `json:"auto_config_domain_dns"`
980+
}
981+
947982
// OfferOption: offer option.
948983
type OfferOption struct {
949984
// ID: option ID.
@@ -982,31 +1017,22 @@ type PlatformControlPanel struct {
9821017
URLs *PlatformControlPanelURLs `json:"urls"`
9831018
}
9841019

1020+
// HostingDomain: hosting domain.
1021+
type HostingDomain struct {
1022+
// Subdomain: optional free subdomain linked to the Web Hosting plan.
1023+
Subdomain string `json:"subdomain"`
1024+
1025+
// CustomDomain: optional custom domain linked to the Web Hosting plan.
1026+
CustomDomain *HostingDomainCustomDomain `json:"custom_domain"`
1027+
}
1028+
9851029
// CreateDatabaseRequestUser: create database request user.
9861030
type CreateDatabaseRequestUser struct {
9871031
Username string `json:"username"`
9881032

9891033
Password string `json:"password"`
9901034
}
9911035

992-
// AutoConfigDomainDNS: auto config domain dns.
993-
type AutoConfigDomainDNS struct {
994-
// Nameservers: whether or not to synchronize domain nameservers.
995-
Nameservers bool `json:"nameservers"`
996-
997-
// WebRecords: whether or not to synchronize web records.
998-
WebRecords bool `json:"web_records"`
999-
1000-
// MailRecords: whether or not to synchronize mail records.
1001-
MailRecords bool `json:"mail_records"`
1002-
1003-
// AllRecords: whether or not to synchronize all types of records. Takes priority over the other fields.
1004-
AllRecords bool `json:"all_records"`
1005-
1006-
// None: no automatic domain configuration. Users must configure their domain for the Web Hosting to work.
1007-
None bool `json:"none"`
1008-
}
1009-
10101036
// CreateHostingRequestDomainConfiguration: create hosting request domain configuration.
10111037
type CreateHostingRequestDomainConfiguration struct {
10121038
UpdateNameservers bool `json:"update_nameservers"`
@@ -1202,8 +1228,8 @@ type HostingSummary struct {
12021228
// Default value: unknown_status
12031229
Status HostingStatus `json:"status"`
12041230

1205-
// Domain: main domain associated with the Web Hosting plan.
1206-
Domain string `json:"domain"`
1231+
// Deprecated: Domain: main domain associated with the Web Hosting plan (deprecated, use domain_info).
1232+
Domain *string `json:"domain,omitempty"`
12071233

12081234
// Protected: whether the hosting is protected or not.
12091235
Protected bool `json:"protected"`
@@ -1215,12 +1241,15 @@ type HostingSummary struct {
12151241
// OfferName: name of the active offer for the Web Hosting plan.
12161242
OfferName string `json:"offer_name"`
12171243

1218-
// DomainStatus: main domain status of the Web Hosting plan.
1244+
// Deprecated: DomainStatus: main domain status of the Web Hosting plan.
12191245
// Default value: unknown_status
1220-
DomainStatus DomainStatus `json:"domain_status"`
1246+
DomainStatus *DomainStatus `json:"domain_status,omitempty"`
12211247

12221248
// Region: region where the Web Hosting plan is hosted.
12231249
Region scw.Region `json:"region"`
1250+
1251+
// DomainInfo: domain configuration block (subdomain, optional custom domain, and DNS settings).
1252+
DomainInfo *HostingDomain `json:"domain_info"`
12241253
}
12251254

12261255
// MailAccount: mail account.
@@ -1652,8 +1681,8 @@ type Hosting struct {
16521681
// Default value: unknown_status
16531682
Status HostingStatus `json:"status"`
16541683

1655-
// Domain: main domain associated with the Web Hosting plan.
1656-
Domain string `json:"domain"`
1684+
// Deprecated: Domain: main domain associated with the Web Hosting plan (deprecated, use domain_info).
1685+
Domain *string `json:"domain,omitempty"`
16571686

16581687
// Offer: details of the Web Hosting plan offer and options.
16591688
Offer *Offer `json:"offer"`
@@ -1664,7 +1693,7 @@ type Hosting struct {
16641693
// Tags: list of tags associated with the Web Hosting plan.
16651694
Tags []string `json:"tags"`
16661695

1667-
// Deprecated: DNSStatus: DNS status of the Web Hosting plan.
1696+
// Deprecated: DNSStatus: DNS status of the Web Hosting plan (deprecated, use domain_info).
16681697
// Default value: unknown_status
16691698
DNSStatus *DNSRecordsStatus `json:"dns_status,omitempty"`
16701699

@@ -1677,12 +1706,15 @@ type Hosting struct {
16771706
// User: details of the hosting user.
16781707
User *HostingUser `json:"user"`
16791708

1680-
// DomainStatus: main domain status of the Web Hosting plan.
1709+
// Deprecated: DomainStatus: main domain status of the Web Hosting plan (deprecated, use domain_info).
16811710
// Default value: unknown_status
1682-
DomainStatus DomainStatus `json:"domain_status"`
1711+
DomainStatus *DomainStatus `json:"domain_status,omitempty"`
16831712

16841713
// Region: region where the Web Hosting plan is hosted.
16851714
Region scw.Region `json:"region"`
1715+
1716+
// DomainInfo: domain configuration block (subdomain, optional custom domain, and DNS settings).
1717+
DomainInfo *HostingDomain `json:"domain_info"`
16861718
}
16871719

16881720
// HostingAPICreateHostingRequest: hosting api create hosting request.
@@ -1705,6 +1737,9 @@ type HostingAPICreateHostingRequest struct {
17051737
// Domain: domain name to link to the Web Hosting plan. You must already own this domain name, and have completed the DNS validation process beforehand.
17061738
Domain string `json:"domain"`
17071739

1740+
// Subdomain: the name prefix to use as a free subdomain (for example, `mysite`) assigned to the Web Hosting plan. The full domain will be automatically created by adding it to the fixed base domain (e.g. `mysite.scw.site`). You do not need to include the base domain yourself.
1741+
Subdomain *string `json:"subdomain,omitempty"`
1742+
17081743
// OfferOptions: list of the Web Hosting plan options IDs with their quantities.
17091744
OfferOptions []*OfferOptionRequest `json:"offer_options"`
17101745

@@ -1790,6 +1825,9 @@ type HostingAPIListHostingsRequest struct {
17901825

17911826
// ControlPanels: name of the control panel to filter for, only Web Hosting plans from this control panel will be returned.
17921827
ControlPanels []string `json:"-"`
1828+
1829+
// Subdomain: optional free subdomain linked to the Web Hosting plan.
1830+
Subdomain *string `json:"-"`
17931831
}
17941832

17951833
// HostingAPIResetHostingPasswordRequest: hosting api reset hosting password request.
@@ -3018,6 +3056,7 @@ func (s *HostingAPI) ListHostings(req *HostingAPIListHostingsRequest, opts ...sc
30183056
parameter.AddToQuery(query, "project_id", req.ProjectID)
30193057
parameter.AddToQuery(query, "organization_id", req.OrganizationID)
30203058
parameter.AddToQuery(query, "control_panels", req.ControlPanels)
3059+
parameter.AddToQuery(query, "subdomain", req.Subdomain)
30213060

30223061
if fmt.Sprint(req.Region) == "" {
30233062
return nil, errors.New("field Region cannot be empty in request")

0 commit comments

Comments
 (0)