From 68dcd6889b70d4cfbea79fcddf8bf1b7e80640fc Mon Sep 17 00:00:00 2001 From: Scaleway Bot Date: Thu, 28 Nov 2024 11:43:39 +0100 Subject: [PATCH] feat(instance): set some fields of VolumeServer as optional (#1606) Co-authored-by: Yacine FODIL --- packages/clients/src/api/instance/v1/api.utils.ts | 4 ++-- .../clients/src/api/instance/v1/marshalling.gen.ts | 2 +- packages/clients/src/api/instance/v1/types.gen.ts | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/clients/src/api/instance/v1/api.utils.ts b/packages/clients/src/api/instance/v1/api.utils.ts index d7653f468..d52f0beb4 100644 --- a/packages/clients/src/api/instance/v1/api.utils.ts +++ b/packages/clients/src/api/instance/v1/api.utils.ts @@ -266,7 +266,7 @@ export class InstanceV1UtilsAPI extends API { zone: request.zone, }).then(res => validateNotUndefined(res.server?.volumes)) - const newVolumes: Record = {} + const newVolumes: Record = {} for (const [key, server] of Object.entries(volumes)) { newVolumes[key] = { id: server.id, name: server.name } } @@ -322,7 +322,7 @@ export class InstanceV1UtilsAPI extends API { .then(res => validateNotUndefined(res.server)) // Remove volume. - const newVolumes: Record = {} + const newVolumes: Record = {} for (const [key, volume] of Object.entries(server.volumes)) { if (volume.id !== request.volumeId) { newVolumes[key] = { id: volume.id, name: volume.name } diff --git a/packages/clients/src/api/instance/v1/marshalling.gen.ts b/packages/clients/src/api/instance/v1/marshalling.gen.ts index 8b47dc8bb..aa963ef4d 100644 --- a/packages/clients/src/api/instance/v1/marshalling.gen.ts +++ b/packages/clients/src/api/instance/v1/marshalling.gen.ts @@ -378,7 +378,7 @@ const unmarshalVolumeServer = (data: unknown): VolumeServer => { project: data.project, server: data.server ? unmarshalServerSummary(data.server) : undefined, size: data.size, - state: data.state, + state: data.state ? data.state : undefined, volumeType: data.volume_type, zone: data.zone, } as VolumeServer diff --git a/packages/clients/src/api/instance/v1/types.gen.ts b/packages/clients/src/api/instance/v1/types.gen.ts index 251f8daba..53b9e23de 100644 --- a/packages/clients/src/api/instance/v1/types.gen.ts +++ b/packages/clients/src/api/instance/v1/types.gen.ts @@ -316,17 +316,17 @@ export interface ServerMaintenance { export interface VolumeServer { id: string - name: string + name?: string /** @deprecated */ exportUri?: string - organization: string + organization?: string server?: ServerSummary - size: number + size?: number volumeType: VolumeServerVolumeType creationDate?: Date modificationDate?: Date - state: VolumeServerState - project: string + state?: VolumeServerState + project?: string boot: boolean /** Zone to target. If none is passed will use default zone from the config. */ zone: Zone