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
5 changes: 5 additions & 0 deletions packages/clients/src/api/baremetal/v1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type {
AddOptionServerRequest,
BMCAccess,
CPU,
CertificationOption,
CreateServerRequest,
CreateServerRequestInstall,
DeleteOptionServerRequest,
Expand All @@ -22,6 +23,7 @@ export type {
IPReverseStatus,
IPVersion,
InstallServerRequest,
LicenseOption,
ListOSRequest,
ListOSResponse,
ListOffersRequest,
Expand Down Expand Up @@ -52,8 +54,11 @@ export type {
PrivateNetworkApiDeleteServerPrivateNetworkRequest,
PrivateNetworkApiListServerPrivateNetworksRequest,
PrivateNetworkApiSetServerPrivateNetworksRequest,
PrivateNetworkOption,
PublicBandwidthOption,
RaidController,
RebootServerRequest,
RemoteAccessOption,
Server,
ServerBootType,
ServerEvent,
Expand Down
101 changes: 101 additions & 0 deletions packages/clients/src/api/baremetal/v1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import type {
AddOptionServerRequest,
BMCAccess,
CPU,
CertificationOption,
CreateServerRequest,
CreateServerRequestInstall,
Disk,
GetServerMetricsResponse,
IP,
InstallServerRequest,
LicenseOption,
ListOSResponse,
ListOffersResponse,
ListOptionsResponse,
Expand All @@ -35,8 +37,11 @@ import type {
PersistentMemory,
PrivateNetworkApiAddServerPrivateNetworkRequest,
PrivateNetworkApiSetServerPrivateNetworksRequest,
PrivateNetworkOption,
PublicBandwidthOption,
RaidController,
RebootServerRequest,
RemoteAccessOption,
Server,
ServerEvent,
ServerInstall,
Expand Down Expand Up @@ -92,6 +97,7 @@ export const unmarshalOS = (data: unknown): OS => {

return {
allowed: data.allowed,
customPartitioningSupported: data.custom_partitioning_supported,
enabled: data.enabled,
id: data.id,
licenseRequired: data.license_required,
Expand All @@ -110,6 +116,62 @@ export const unmarshalOS = (data: unknown): OS => {
} as OS
}

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

return {} as CertificationOption
}

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

return {
osId: data.os_id,
} as LicenseOption
}

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

return {} as PrivateNetworkOption
}

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

return {
bandwidthInBps: data.bandwidth_in_bps,
} as PublicBandwidthOption
}

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

return {} as RemoteAccessOption
}

const unmarshalCPU = (data: unknown): CPU => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand Down Expand Up @@ -162,12 +224,25 @@ const unmarshalOfferOptionOffer = (data: unknown): OfferOptionOffer => {
}

return {
certification: data.certification
? unmarshalCertificationOption(data.certification)
: undefined,
enabled: data.enabled,
id: data.id,
license: data.license ? unmarshalLicenseOption(data.license) : undefined,
manageable: data.manageable,
name: data.name,
osId: data.os_id,
price: data.price ? unmarshalMoney(data.price) : undefined,
privateNetwork: data.private_network
? unmarshalPrivateNetworkOption(data.private_network)
: undefined,
publicBandwidth: data.public_bandwidth
? unmarshalPublicBandwidthOption(data.public_bandwidth)
: undefined,
remoteAccess: data.remote_access
? unmarshalRemoteAccessOption(data.remote_access)
: undefined,
subscriptionPeriod: data.subscription_period,
} as OfferOptionOffer
}
Expand Down Expand Up @@ -251,9 +326,22 @@ export const unmarshalOption = (data: unknown): Option => {
}

return {
certification: data.certification
? unmarshalCertificationOption(data.certification)
: undefined,
id: data.id,
license: data.license ? unmarshalLicenseOption(data.license) : undefined,
manageable: data.manageable,
name: data.name,
privateNetwork: data.private_network
? unmarshalPrivateNetworkOption(data.private_network)
: undefined,
publicBandwidth: data.public_bandwidth
? unmarshalPublicBandwidthOption(data.public_bandwidth)
: undefined,
remoteAccess: data.remote_access
? unmarshalRemoteAccessOption(data.remote_access)
: undefined,
} as Option
}

Expand Down Expand Up @@ -304,10 +392,23 @@ const unmarshalServerOption = (data: unknown): ServerOption => {
}

return {
certification: data.certification
? unmarshalCertificationOption(data.certification)
: undefined,
expiresAt: unmarshalDate(data.expires_at),
id: data.id,
license: data.license ? unmarshalLicenseOption(data.license) : undefined,
manageable: data.manageable,
name: data.name,
privateNetwork: data.private_network
? unmarshalPrivateNetworkOption(data.private_network)
: undefined,
publicBandwidth: data.public_bandwidth
? unmarshalPublicBandwidthOption(data.public_bandwidth)
: undefined,
remoteAccess: data.remote_access
? unmarshalRemoteAccessOption(data.remote_access)
: undefined,
status: data.status,
} as ServerOption
}
Expand Down
123 changes: 122 additions & 1 deletion packages/clients/src/api/baremetal/v1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ export type ServerStatus =

export type SettingType = 'unknown' | 'smtp'

export interface CertificationOption {}

export interface LicenseOption {
osId: string
}

export interface PrivateNetworkOption {}

export interface PublicBandwidthOption {
bandwidthInBps: number
}

export interface RemoteAccessOption {}

export interface OSOSField {
editable: boolean
required: boolean
Expand Down Expand Up @@ -125,8 +139,43 @@ export interface OfferOptionOffer {
price?: Money
/** Boolean to know if option could be managed. */
manageable: boolean
/** ID of the OS linked to the option. */
/** @deprecated Deprecated, use LicenseOptionVars.os_id instead. */
osId?: string
/**
* License option, contains the ID of the OS linked to the option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
license?: LicenseOption
/**
* Public_bandwidth option, contains the bandwidth_in_bps.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
publicBandwidth?: PublicBandwidthOption
/**
* Private_network option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
privateNetwork?: PrivateNetworkOption
/**
* Remote_access option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
remoteAccess?: RemoteAccessOption
/**
* Certification option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
certification?: CertificationOption
}

export interface PersistentMemory {
Expand Down Expand Up @@ -192,6 +241,41 @@ export interface ServerOption {
manageable: boolean
/** Auto expiration date for compatible options. */
expiresAt?: Date
/**
* License option, contains the ID of the OS linked to the option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
license?: LicenseOption
/**
* Public_bandwidth option, contains the bandwidth_in_bps.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
publicBandwidth?: PublicBandwidthOption
/**
* Private_network option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
privateNetwork?: PrivateNetworkOption
/**
* Remote_access option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
remoteAccess?: RemoteAccessOption
/**
* Certification option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
certification?: CertificationOption
}

export interface ServerRescueServer {
Expand Down Expand Up @@ -243,6 +327,8 @@ export interface OS {
licenseRequired: boolean
/** Defines if a specific Organization is allowed to install this OS type. */
allowed: boolean
/** Defines if custom partitioning is supported by this OS. */
customPartitioningSupported: boolean
}

export interface Offer {
Expand Down Expand Up @@ -310,6 +396,41 @@ export interface Option {
name: string
/** Defines whether the option is manageable (could be added or removed). */
manageable: boolean
/**
* License option, contains the ID of the OS linked to the option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
license?: LicenseOption
/**
* Public_bandwidth option, contains the bandwidth_in_bps.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
publicBandwidth?: PublicBandwidthOption
/**
* Private_network option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
privateNetwork?: PrivateNetworkOption
/**
* Remote_access option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
remoteAccess?: RemoteAccessOption
/**
* Certification option.
*
* One-of ('option'): at most one of 'license', 'publicBandwidth',
* 'privateNetwork', 'remoteAccess', 'certification' could be set.
*/
certification?: CertificationOption
}

export interface ServerEvent {
Expand Down