Skip to content

Commit 664c1d2

Browse files
authored
feat(baremetal): add gpu in offer (#1523)
1 parent 8972ecf commit 664c1d2

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

packages/clients/src/api/baremetal/v1/index.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type {
1212
DeleteOptionServerRequest,
1313
DeleteServerRequest,
1414
Disk,
15+
GPU,
1516
GetBMCAccessRequest,
1617
GetDefaultPartitioningSchemaRequest,
1718
GetOSRequest,

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type {
1717
CreateServerRequest,
1818
CreateServerRequestInstall,
1919
Disk,
20+
GPU,
2021
GetServerMetricsResponse,
2122
IP,
2223
InstallServerRequest,
@@ -315,6 +316,19 @@ const unmarshalDisk = (data: unknown): Disk => {
315316
} as Disk
316317
}
317318

319+
const unmarshalGPU = (data: unknown): GPU => {
320+
if (!isJSONObject(data)) {
321+
throw new TypeError(
322+
`Unmarshalling the type 'GPU' failed as data isn't a dictionary.`,
323+
)
324+
}
325+
326+
return {
327+
name: data.name,
328+
vram: data.vram,
329+
} as GPU
330+
}
331+
318332
const unmarshalMemory = (data: unknown): Memory => {
319333
if (!isJSONObject(data)) {
320334
throw new TypeError(
@@ -402,6 +416,7 @@ export const unmarshalOffer = (data: unknown): Offer => {
402416
disks: unmarshalArrayOfObject(data.disks, unmarshalDisk),
403417
enable: data.enable,
404418
fee: data.fee ? unmarshalMoney(data.fee) : undefined,
419+
gpus: unmarshalArrayOfObject(data.gpus, unmarshalGPU),
405420
id: data.id,
406421
incompatibleOsIds: data.incompatible_os_ids,
407422
maxBandwidth: data.max_bandwidth,

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ export interface Disk {
191191
type: string
192192
}
193193

194+
export interface GPU {
195+
/** Name of the GPU. */
196+
name: string
197+
/** Capacity of the vram in bytes. */
198+
vram: number
199+
}
200+
194201
export interface Memory {
195202
/** Capacity of the memory in bytes. */
196203
capacity: number
@@ -470,6 +477,8 @@ export interface Offer {
470477
sharedBandwidth: boolean
471478
/** Array of tags attached to the offer. */
472479
tags: string[]
480+
/** GPU specifications of the offer. */
481+
gpus: GPU[]
473482
}
474483

475484
export interface Option {

0 commit comments

Comments
 (0)