Skip to content

Commit

Permalink
feat(baremetal): add gpu in offer (#1523)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Oct 23, 2024
1 parent 8972ecf commit 664c1d2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/clients/src/api/baremetal/v1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type {
DeleteOptionServerRequest,
DeleteServerRequest,
Disk,
GPU,
GetBMCAccessRequest,
GetDefaultPartitioningSchemaRequest,
GetOSRequest,
Expand Down
15 changes: 15 additions & 0 deletions packages/clients/src/api/baremetal/v1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
CreateServerRequest,
CreateServerRequestInstall,
Disk,
GPU,
GetServerMetricsResponse,
IP,
InstallServerRequest,
Expand Down Expand Up @@ -315,6 +316,19 @@ const unmarshalDisk = (data: unknown): Disk => {
} as Disk
}

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

return {
name: data.name,
vram: data.vram,
} as GPU
}

const unmarshalMemory = (data: unknown): Memory => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand Down Expand Up @@ -402,6 +416,7 @@ export const unmarshalOffer = (data: unknown): Offer => {
disks: unmarshalArrayOfObject(data.disks, unmarshalDisk),
enable: data.enable,
fee: data.fee ? unmarshalMoney(data.fee) : undefined,
gpus: unmarshalArrayOfObject(data.gpus, unmarshalGPU),
id: data.id,
incompatibleOsIds: data.incompatible_os_ids,
maxBandwidth: data.max_bandwidth,
Expand Down
9 changes: 9 additions & 0 deletions packages/clients/src/api/baremetal/v1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ export interface Disk {
type: string
}

export interface GPU {
/** Name of the GPU. */
name: string
/** Capacity of the vram in bytes. */
vram: number
}

export interface Memory {
/** Capacity of the memory in bytes. */
capacity: number
Expand Down Expand Up @@ -470,6 +477,8 @@ export interface Offer {
sharedBandwidth: boolean
/** Array of tags attached to the offer. */
tags: string[]
/** GPU specifications of the offer. */
gpus: GPU[]
}

export interface Option {
Expand Down

0 comments on commit 664c1d2

Please sign in to comment.