Skip to content

Commit b24a74c

Browse files
authored
feat(instance): add capabilities for ServerType (#112)
1 parent 175d61c commit b24a74c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import type {
7979
ServerMaintenance,
8080
ServerSummary,
8181
ServerType,
82+
ServerTypeCapabilities,
8283
ServerTypeNetwork,
8384
ServerTypeNetworkInterface,
8485
ServerTypeVolumeConstraintSizes,
@@ -354,6 +355,19 @@ const unmarshalServerMaintenance = (data: unknown) => {
354355
return {} as ServerMaintenance
355356
}
356357

358+
const unmarshalServerTypeCapabilities = (data: unknown) => {
359+
if (!isJSONObject(data)) {
360+
throw new TypeError(
361+
`Unmarshalling the type 'ServerTypeCapabilities' failed as data isn't a dictionary.`,
362+
)
363+
}
364+
365+
return {
366+
blockStorage: data.block_storage,
367+
bootTypes: data.boot_types,
368+
} as ServerTypeCapabilities
369+
}
370+
357371
const unmarshalServerTypeNetwork = (data: unknown) => {
358372
if (!isJSONObject(data)) {
359373
throw new TypeError(
@@ -624,6 +638,9 @@ const unmarshalServerType = (data: unknown) => {
624638
altNames: data.alt_names,
625639
arch: data.arch,
626640
baremetal: data.baremetal,
641+
capabilities: data.capabilities
642+
? unmarshalServerTypeCapabilities(data.capabilities)
643+
: undefined,
627644
gpu: data.gpu,
628645
hourlyPrice: data.hourly_price,
629646
monthlyPrice: data.monthly_price,

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,16 @@ export interface ServerType {
607607
baremetal: boolean
608608
/** Network available for the instance */
609609
network?: ServerTypeNetwork
610+
/** Capabilities */
611+
capabilities?: ServerTypeCapabilities
612+
}
613+
614+
/** Server type. capabilities */
615+
export interface ServerTypeCapabilities {
616+
/** True if server supports block storage */
617+
blockStorage?: boolean
618+
/** List of supported boot types */
619+
bootTypes: Array<BootType>
610620
}
611621

612622
/** Server type. network */

0 commit comments

Comments
 (0)