Skip to content

Commit 6ccc59f

Browse files
authored
fix(webhosting): add dns autoconfig none option (#1940)
1 parent 05ce479 commit 6ccc59f

File tree

2 files changed

+34
-19
lines changed

2 files changed

+34
-19
lines changed

packages/clients/src/api/webhosting/v1/marshalling.gen.ts

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,22 @@ export const unmarshalCheckUserOwnsDomainResponse = (
128128
} as CheckUserOwnsDomainResponse
129129
}
130130

131+
const unmarshalAutoConfigDomainDns = (data: unknown): AutoConfigDomainDns => {
132+
if (!isJSONObject(data)) {
133+
throw new TypeError(
134+
`Unmarshalling the type 'AutoConfigDomainDns' failed as data isn't a dictionary.`,
135+
)
136+
}
137+
138+
return {
139+
allRecords: data.all_records,
140+
mailRecords: data.mail_records,
141+
nameservers: data.nameservers,
142+
none: data.none,
143+
webRecords: data.web_records,
144+
} as AutoConfigDomainDns
145+
}
146+
131147
const unmarshalDnsRecord = (data: unknown): DnsRecord => {
132148
if (!isJSONObject(data)) {
133149
throw new TypeError(
@@ -168,28 +184,16 @@ export const unmarshalDnsRecords = (data: unknown): DnsRecords => {
168184
}
169185

170186
return {
171-
dnsConfig: data.dns_config,
187+
autoConfigDomainDns: data.auto_config_domain_dns
188+
? unmarshalAutoConfigDomainDns(data.auto_config_domain_dns)
189+
: undefined,
190+
dnsConfig: data.dns_config ? data.dns_config : undefined,
172191
nameServers: unmarshalArrayOfObject(data.name_servers, unmarshalNameserver),
173192
records: unmarshalArrayOfObject(data.records, unmarshalDnsRecord),
174193
status: data.status,
175194
} as DnsRecords
176195
}
177196

178-
const unmarshalAutoConfigDomainDns = (data: unknown): AutoConfigDomainDns => {
179-
if (!isJSONObject(data)) {
180-
throw new TypeError(
181-
`Unmarshalling the type 'AutoConfigDomainDns' failed as data isn't a dictionary.`,
182-
)
183-
}
184-
185-
return {
186-
allRecords: data.all_records,
187-
mailRecords: data.mail_records,
188-
nameservers: data.nameservers,
189-
webRecords: data.web_records,
190-
} as AutoConfigDomainDns
191-
}
192-
193197
export const unmarshalDomain = (data: unknown): Domain => {
194198
if (!isJSONObject(data)) {
195199
throw new TypeError(
@@ -657,6 +661,7 @@ const marshalAutoConfigDomainDns = (
657661
all_records: request.allRecords,
658662
mail_records: request.mailRecords,
659663
nameservers: request.nameservers,
664+
none: request.none,
660665
web_records: request.webRecords,
661666
})
662667

packages/clients/src/api/webhosting/v1/types.gen.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ export interface AutoConfigDomainDns {
162162
* other fields.
163163
*/
164164
allRecords: boolean
165+
/**
166+
* No automatic domain configuration. Users must configure their domain for
167+
* the Web Hosting to work.
168+
*/
169+
none: boolean
165170
}
166171

167172
export interface CreateHostingRequestDomainConfiguration {
@@ -620,7 +625,7 @@ export type DnsApiSyncDomainDnsRecordsRequest = {
620625
* use auto_config_domain_dns).
621626
*/
622627
updateNameservers?: boolean
623-
/** Custom records to synchronize. */
628+
/** @deprecated Custom records to synchronize. */
624629
customRecords?: SyncDomainDnsRecordsRequestRecord[]
625630
/** Whether or not to synchronize each types of records. */
626631
autoConfigDomainDns?: AutoConfigDomainDns
@@ -633,8 +638,13 @@ export interface DnsRecords {
633638
nameServers: Nameserver[]
634639
/** Status of the records. */
635640
status: DnsRecordsStatus
636-
/** Records dns auto configuration settings. */
637-
dnsConfig: DomainDnsAction[]
641+
/**
642+
* @deprecated Records dns auto configuration settings (deprecated, use
643+
* auto_config_domain_dns).
644+
*/
645+
dnsConfig?: DomainDnsAction[]
646+
/** Whether or not to synchronize each types of records. */
647+
autoConfigDomainDns?: AutoConfigDomainDns
638648
}
639649

640650
export interface Domain {

0 commit comments

Comments
 (0)