Skip to content

Commit 68dcd68

Browse files
scaleway-botyfodil
andauthored
feat(instance): set some fields of VolumeServer as optional (#1606)
Co-authored-by: Yacine FODIL <[email protected]>
1 parent 3d6d00f commit 68dcd68

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

packages/clients/src/api/instance/v1/api.utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export class InstanceV1UtilsAPI extends API {
266266
zone: request.zone,
267267
}).then(res => validateNotUndefined(res.server?.volumes))
268268

269-
const newVolumes: Record<string, { id: string; name: string }> = {}
269+
const newVolumes: Record<string, { id: string; name: string | undefined }> = {}
270270
for (const [key, server] of Object.entries(volumes)) {
271271
newVolumes[key] = { id: server.id, name: server.name }
272272
}
@@ -322,7 +322,7 @@ export class InstanceV1UtilsAPI extends API {
322322
.then(res => validateNotUndefined(res.server))
323323

324324
// Remove volume.
325-
const newVolumes: Record<string, { id: string; name: string }> = {}
325+
const newVolumes: Record<string, { id: string; name: string | undefined }> = {}
326326
for (const [key, volume] of Object.entries(server.volumes)) {
327327
if (volume.id !== request.volumeId) {
328328
newVolumes[key] = { id: volume.id, name: volume.name }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ const unmarshalVolumeServer = (data: unknown): VolumeServer => {
378378
project: data.project,
379379
server: data.server ? unmarshalServerSummary(data.server) : undefined,
380380
size: data.size,
381-
state: data.state,
381+
state: data.state ? data.state : undefined,
382382
volumeType: data.volume_type,
383383
zone: data.zone,
384384
} as VolumeServer

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,17 +316,17 @@ export interface ServerMaintenance {
316316

317317
export interface VolumeServer {
318318
id: string
319-
name: string
319+
name?: string
320320
/** @deprecated */
321321
exportUri?: string
322-
organization: string
322+
organization?: string
323323
server?: ServerSummary
324-
size: number
324+
size?: number
325325
volumeType: VolumeServerVolumeType
326326
creationDate?: Date
327327
modificationDate?: Date
328-
state: VolumeServerState
329-
project: string
328+
state?: VolumeServerState
329+
project?: string
330330
boot: boolean
331331
/** Zone to target. If none is passed will use default zone from the config. */
332332
zone: Zone

0 commit comments

Comments
 (0)