Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/clients/src/api/webhosting/v1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export {
} from './api.gen'
export * from './content.gen'
export type {
AutoConfigDomainDns,
CheckUserOwnsDomainResponse,
ControlPanel,
ControlPanelApiListControlPanelsRequest,
Expand Down
41 changes: 40 additions & 1 deletion packages/clients/src/api/webhosting/v1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '../../../bridge'
import type { DefaultValues } from '../../../bridge'
import type {
AutoConfigDomainDns,
CheckUserOwnsDomainResponse,
ControlPanel,
CreateDatabaseRequestUser,
Expand Down Expand Up @@ -174,6 +175,21 @@ export const unmarshalDnsRecords = (data: unknown): DnsRecords => {
} as DnsRecords
}

const unmarshalAutoConfigDomainDns = (data: unknown): AutoConfigDomainDns => {
if (!isJSONObject(data)) {
throw new TypeError(
`Unmarshalling the type 'AutoConfigDomainDns' failed as data isn't a dictionary.`,
)
}

return {
allRecords: data.all_records,
mailRecords: data.mail_records,
nameservers: data.nameservers,
webRecords: data.web_records,
} as AutoConfigDomainDns
}

export const unmarshalDomain = (data: unknown): Domain => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand All @@ -182,8 +198,13 @@ export const unmarshalDomain = (data: unknown): Domain => {
}

return {
autoConfigDomainDns: data.auto_config_domain_dns
? unmarshalAutoConfigDomainDns(data.auto_config_domain_dns)
: undefined,
availableActions: data.available_actions,
availableDnsActions: data.available_dns_actions,
availableDnsActions: data.available_dns_actions
? data.available_dns_actions
: undefined,
name: data.name,
owner: data.owner,
status: data.status,
Expand Down Expand Up @@ -629,6 +650,16 @@ export const marshalDnsApiCheckUserOwnsDomainRequest = (
project_id: request.projectId ?? defaults.defaultProjectId,
})

const marshalAutoConfigDomainDns = (
request: AutoConfigDomainDns,
defaults: DefaultValues,
): Record<string, unknown> => ({
all_records: request.allRecords,
mail_records: request.mailRecords,
nameservers: request.nameservers,
web_records: request.webRecords,
})

const marshalSyncDomainDnsRecordsRequestRecord = (
request: SyncDomainDnsRecordsRequestRecord,
defaults: DefaultValues,
Expand All @@ -641,6 +672,10 @@ export const marshalDnsApiSyncDomainDnsRecordsRequest = (
request: DnsApiSyncDomainDnsRecordsRequest,
defaults: DefaultValues,
): Record<string, unknown> => ({
auto_config_domain_dns:
request.autoConfigDomainDns !== undefined
? marshalAutoConfigDomainDns(request.autoConfigDomainDns, defaults)
: undefined,
custom_records:
request.customRecords !== undefined
? request.customRecords.map(elt =>
Expand Down Expand Up @@ -691,6 +726,10 @@ export const marshalHostingApiCreateHostingRequest = (
request: HostingApiCreateHostingRequest,
defaults: DefaultValues,
): Record<string, unknown> => ({
auto_config_domain_dns:
request.autoConfigDomainDns !== undefined
? marshalAutoConfigDomainDns(request.autoConfigDomainDns, defaults)
: undefined,
domain: request.domain,
domain_configuration:
request.domainConfiguration !== undefined
Expand Down
64 changes: 52 additions & 12 deletions packages/clients/src/api/webhosting/v1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@ export interface CreateDatabaseRequestUser {
password: string
}

export interface AutoConfigDomainDns {
/** Whether or not to synchronize domain nameservers. */
nameservers: boolean
/** Whether or not to synchronize web records. */
webRecords: boolean
/** Whether or not to synchronize mail records. */
mailRecords: boolean
/**
* Whether or not to synchronize all types of records. Takes priority over the
* other fields.
*/
allRecords: boolean
}

export interface CreateHostingRequestDomainConfiguration {
updateNameservers: boolean
updateWebRecord: boolean
Expand Down Expand Up @@ -586,16 +600,30 @@ export type DnsApiSyncDomainDnsRecordsRequest = {
region?: ScwRegion
/** Domain for which the DNS records will be synchronized. */
domain: string
/** Whether or not to synchronize the web records. */
updateWebRecords: boolean
/** Whether or not to synchronize the mail records. */
updateMailRecords: boolean
/** Whether or not to synchronize all types of records. This one has priority. */
updateAllRecords: boolean
/** Whether or not to synchronize domain nameservers. */
updateNameservers: boolean
/**
* @deprecated Whether or not to synchronize the web records (deprecated, use
* auto_config_domain_dns).
*/
updateWebRecords?: boolean
/**
* @deprecated Whether or not to synchronize the mail records (deprecated, use
* auto_config_domain_dns).
*/
updateMailRecords?: boolean
/**
* @deprecated Whether or not to synchronize all types of records. This one
* has priority (deprecated, use auto_config_domain_dns).
*/
updateAllRecords?: boolean
/**
* @deprecated Whether or not to synchronize domain nameservers (deprecated,
* use auto_config_domain_dns).
*/
updateNameservers?: boolean
/** Custom records to synchronize. */
customRecords?: SyncDomainDnsRecordsRequestRecord[]
/** Whether or not to synchronize each types of records. */
autoConfigDomainDns?: AutoConfigDomainDns
}

export interface DnsRecords {
Expand All @@ -618,8 +646,13 @@ export interface Domain {
owner: DomainZoneOwner
/** A list of actions that can be performed on the domain. */
availableActions: DomainAction[]
/** A list of DNS-related actions that can be auto configured for the domain. */
availableDnsActions: DomainDnsAction[]
/**
* @deprecated A list of DNS-related actions that can be auto configured for
* the domain (deprecated, use auto_config_domain_dns instead).
*/
availableDnsActions?: DomainDnsAction[]
/** Whether or not to synchronize each type of record. */
autoConfigDomainDns?: AutoConfigDomainDns
}

export type FtpAccountApiChangeFtpAccountPasswordRequest = {
Expand Down Expand Up @@ -742,15 +775,22 @@ export type HostingApiCreateHostingRequest = {
/** Default language for the control panel interface. */
language?: StdLanguageCode
/**
* Indicates whether to update hosting domain name servers and DNS records for
* domains managed by Scaleway Elements.
* @deprecated Indicates whether to update hosting domain name servers and DNS
* records for domains managed by Scaleway Elements (deprecated, use
* auto_config_domain_dns instead).
*/
domainConfiguration?: CreateHostingRequestDomainConfiguration
/**
* Indicates whether to skip a welcome email to the contact email containing
* hosting info.
*/
skipWelcomeEmail?: boolean
/**
* Indicates whether to update hosting domain name servers and DNS records for
* domains managed by Scaleway Elements (deprecated, use auto_update_* fields
* instead).
*/
autoConfigDomainDns?: AutoConfigDomainDns
}

export type HostingApiCreateSessionRequest = {
Expand Down
Loading