Skip to content

Commit 41f5fef

Browse files
authored
feat(block): remove SnapshotSummary (scaleway#1146)
1 parent dc885f0 commit 41f5fef

File tree

3 files changed

+53
-104
lines changed

3 files changed

+53
-104
lines changed

packages/clients/src/api/block/v1alpha1/index.gen.ts

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export type {
2525
Snapshot,
2626
SnapshotParentVolume,
2727
SnapshotStatus,
28-
SnapshotSummary,
2928
StorageClass,
3029
UpdateSnapshotRequest,
3130
UpdateVolumeRequest,

packages/clients/src/api/block/v1alpha1/marshalling.gen.ts

+28-53
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import type {
1919
Reference,
2020
Snapshot,
2121
SnapshotParentVolume,
22-
SnapshotSummary,
2322
UpdateSnapshotRequest,
2423
UpdateVolumeRequest,
2524
Volume,
@@ -44,81 +43,82 @@ export const unmarshalReference = (data: unknown): Reference => {
4443
} as Reference
4544
}
4645

47-
const unmarshalVolumeSpecifications = (data: unknown): VolumeSpecifications => {
46+
const unmarshalSnapshotParentVolume = (data: unknown): SnapshotParentVolume => {
4847
if (!isJSONObject(data)) {
4948
throw new TypeError(
50-
`Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`,
49+
`Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`,
5150
)
5251
}
5352

5453
return {
55-
class: data.class,
56-
perfIops: data.perf_iops,
57-
} as VolumeSpecifications
54+
id: data.id,
55+
name: data.name,
56+
status: data.status,
57+
type: data.type,
58+
} as SnapshotParentVolume
5859
}
5960

60-
export const unmarshalVolume = (data: unknown): Volume => {
61+
export const unmarshalSnapshot = (data: unknown): Snapshot => {
6162
if (!isJSONObject(data)) {
6263
throw new TypeError(
63-
`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`,
64+
`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`,
6465
)
6566
}
6667

6768
return {
69+
class: data.class,
6870
createdAt: unmarshalDate(data.created_at),
6971
id: data.id,
70-
lastDetachedAt: unmarshalDate(data.last_detached_at),
7172
name: data.name,
72-
parentSnapshotId: data.parent_snapshot_id,
73+
parentVolume: data.parent_volume
74+
? unmarshalSnapshotParentVolume(data.parent_volume)
75+
: undefined,
7376
projectId: data.project_id,
7477
references: unmarshalArrayOfObject(data.references, unmarshalReference),
7578
size: data.size,
76-
specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : undefined,
7779
status: data.status,
7880
tags: data.tags,
79-
type: data.type,
8081
updatedAt: unmarshalDate(data.updated_at),
8182
zone: data.zone,
82-
} as Volume
83+
} as Snapshot
8384
}
8485

85-
const unmarshalSnapshotParentVolume = (data: unknown): SnapshotParentVolume => {
86+
const unmarshalVolumeSpecifications = (data: unknown): VolumeSpecifications => {
8687
if (!isJSONObject(data)) {
8788
throw new TypeError(
88-
`Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`,
89+
`Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`,
8990
)
9091
}
9192

9293
return {
93-
id: data.id,
94-
name: data.name,
95-
status: data.status,
96-
type: data.type,
97-
} as SnapshotParentVolume
94+
class: data.class,
95+
perfIops: data.perf_iops,
96+
} as VolumeSpecifications
9897
}
9998

100-
const unmarshalSnapshotSummary = (data: unknown): SnapshotSummary => {
99+
export const unmarshalVolume = (data: unknown): Volume => {
101100
if (!isJSONObject(data)) {
102101
throw new TypeError(
103-
`Unmarshalling the type 'SnapshotSummary' failed as data isn't a dictionary.`,
102+
`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`,
104103
)
105104
}
106105

107106
return {
108-
class: data.class,
109107
createdAt: unmarshalDate(data.created_at),
110108
id: data.id,
109+
lastDetachedAt: unmarshalDate(data.last_detached_at),
111110
name: data.name,
112-
parentVolume: data.parent_volume
113-
? unmarshalSnapshotParentVolume(data.parent_volume)
114-
: undefined,
111+
parentSnapshotId: data.parent_snapshot_id,
115112
projectId: data.project_id,
113+
references: unmarshalArrayOfObject(data.references, unmarshalReference),
116114
size: data.size,
115+
specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : undefined,
117116
status: data.status,
118117
tags: data.tags,
118+
type: data.type,
119119
updatedAt: unmarshalDate(data.updated_at),
120120
zone: data.zone,
121-
} as SnapshotSummary
121+
} as Volume
122122
}
123123

124124
export const unmarshalListSnapshotsResponse = (
@@ -131,7 +131,7 @@ export const unmarshalListSnapshotsResponse = (
131131
}
132132

133133
return {
134-
snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshotSummary),
134+
snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
135135
totalCount: data.total_count,
136136
} as ListSnapshotsResponse
137137
}
@@ -183,31 +183,6 @@ export const unmarshalListVolumesResponse = (
183183
} as ListVolumesResponse
184184
}
185185

186-
export const unmarshalSnapshot = (data: unknown): Snapshot => {
187-
if (!isJSONObject(data)) {
188-
throw new TypeError(
189-
`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`,
190-
)
191-
}
192-
193-
return {
194-
class: data.class,
195-
createdAt: unmarshalDate(data.created_at),
196-
id: data.id,
197-
name: data.name,
198-
parentVolume: data.parent_volume
199-
? unmarshalSnapshotParentVolume(data.parent_volume)
200-
: undefined,
201-
projectId: data.project_id,
202-
references: unmarshalArrayOfObject(data.references, unmarshalReference),
203-
size: data.size,
204-
status: data.status,
205-
tags: data.tags,
206-
updatedAt: unmarshalDate(data.updated_at),
207-
zone: data.zone,
208-
} as Snapshot
209-
}
210-
211186
export const marshalCreateSnapshotRequest = (
212187
request: CreateSnapshotRequest,
213188
defaults: DefaultValues,

packages/clients/src/api/block/v1alpha1/types.gen.ts

+25-50
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,24 @@ export type VolumeStatus =
5353
| 'snapshotting'
5454
| 'locked'
5555

56+
export interface Reference {
57+
/** UUID of the reference. */
58+
id: string
59+
/** Type of resource to which the reference is associated. */
60+
productResourceType: string
61+
/**
62+
* UUID of the product resource it refers to (according to the
63+
* product_resource_type).
64+
*/
65+
productResourceId: string
66+
/** Creation date of the reference. */
67+
createdAt?: Date
68+
/** Type of reference (link, exclusive, read_only). */
69+
type: ReferenceType
70+
/** Status of reference (attaching, attached, detaching). */
71+
status: ReferenceStatus
72+
}
73+
5674
export interface SnapshotParentVolume {
5775
/** Parent volume UUID (volume from which the snapshot originates). */
5876
id: string
@@ -74,24 +92,6 @@ export interface VolumeSpecifications {
7492
class: StorageClass
7593
}
7694

77-
export interface Reference {
78-
/** UUID of the reference. */
79-
id: string
80-
/** Type of resource to which the reference is associated. */
81-
productResourceType: string
82-
/**
83-
* UUID of the product resource it refers to (according to the
84-
* product_resource_type).
85-
*/
86-
productResourceId: string
87-
/** Creation date of the reference. */
88-
createdAt?: Date
89-
/** Type of reference (link, exclusive, read_only). */
90-
type: ReferenceType
91-
/** Status of reference (attaching, attached, detaching). */
92-
status: ReferenceStatus
93-
}
94-
9595
export interface CreateVolumeRequestFromEmpty {
9696
/** Must be compliant with the minimum (1 GB) and maximum (10 TB) allowed size. */
9797
size: number
@@ -108,26 +108,28 @@ export interface CreateVolumeRequestFromSnapshot {
108108
snapshotId: string
109109
}
110110

111-
export interface SnapshotSummary {
111+
export interface Snapshot {
112112
/** UUID of the snapshot. */
113113
id: string
114114
/** Name of the snapshot. */
115115
name: string
116-
/** If the parent volume has been deleted, value is null. */
116+
/** If the parent volume was deleted, value is null. */
117117
parentVolume?: SnapshotParentVolume
118-
/** Size of the snapshot in bytes. */
118+
/** Size in bytes of the snapshot. */
119119
size: number
120120
/** UUID of the project the snapshot belongs to. */
121121
projectId: string
122122
/** Creation date of the snapshot. */
123123
createdAt?: Date
124124
/** Last modification date of the properties of a snapshot. */
125125
updatedAt?: Date
126+
/** List of the references to the snapshot. */
127+
references: Reference[]
126128
/** Current status of the snapshot (available, in_use, ...). */
127129
status: SnapshotStatus
128130
/** List of tags assigned to the volume. */
129131
tags: string[]
130-
/** Snapshot Availability Zone. */
132+
/** Snapshot zone. */
131133
zone: Zone
132134
/** Storage class of the snapshot. */
133135
class: StorageClass
@@ -273,7 +275,7 @@ export type ListSnapshotsRequest = {
273275

274276
export interface ListSnapshotsResponse {
275277
/** Paginated returned list of snapshots. */
276-
snapshots: SnapshotSummary[]
278+
snapshots: Snapshot[]
277279
/** Total number of snpashots in the project. */
278280
totalCount: number
279281
}
@@ -329,33 +331,6 @@ export interface ListVolumesResponse {
329331
totalCount: number
330332
}
331333

332-
export interface Snapshot {
333-
/** UUID of the snapshot. */
334-
id: string
335-
/** Name of the snapshot. */
336-
name: string
337-
/** If the parent volume was deleted, value is null. */
338-
parentVolume?: SnapshotParentVolume
339-
/** Size in bytes of the snapshot. */
340-
size: number
341-
/** UUID of the project the snapshot belongs to. */
342-
projectId: string
343-
/** Creation date of the snapshot. */
344-
createdAt?: Date
345-
/** Last modification date of the properties of a snapshot. */
346-
updatedAt?: Date
347-
/** List of the references to the snapshot. */
348-
references: Reference[]
349-
/** Current status of the snapshot (available, in_use, ...). */
350-
status: SnapshotStatus
351-
/** List of tags assigned to the volume. */
352-
tags: string[]
353-
/** Snapshot zone. */
354-
zone: Zone
355-
/** Storage class of the snapshot. */
356-
class: StorageClass
357-
}
358-
359334
export type UpdateSnapshotRequest = {
360335
/** Zone to target. If none is passed will use default zone from the config. */
361336
zone?: Zone

0 commit comments

Comments
 (0)