@@ -19,7 +19,6 @@ import type {
19
19
Reference ,
20
20
Snapshot ,
21
21
SnapshotParentVolume ,
22
- SnapshotSummary ,
23
22
UpdateSnapshotRequest ,
24
23
UpdateVolumeRequest ,
25
24
Volume ,
@@ -44,81 +43,82 @@ export const unmarshalReference = (data: unknown): Reference => {
44
43
} as Reference
45
44
}
46
45
47
- const unmarshalVolumeSpecifications = ( data : unknown ) : VolumeSpecifications => {
46
+ const unmarshalSnapshotParentVolume = ( data : unknown ) : SnapshotParentVolume => {
48
47
if ( ! isJSONObject ( data ) ) {
49
48
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.` ,
51
50
)
52
51
}
53
52
54
53
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
58
59
}
59
60
60
- export const unmarshalVolume = ( data : unknown ) : Volume => {
61
+ export const unmarshalSnapshot = ( data : unknown ) : Snapshot => {
61
62
if ( ! isJSONObject ( data ) ) {
62
63
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.` ,
64
65
)
65
66
}
66
67
67
68
return {
69
+ class : data . class ,
68
70
createdAt : unmarshalDate ( data . created_at ) ,
69
71
id : data . id ,
70
- lastDetachedAt : unmarshalDate ( data . last_detached_at ) ,
71
72
name : data . name ,
72
- parentSnapshotId : data . parent_snapshot_id ,
73
+ parentVolume : data . parent_volume
74
+ ? unmarshalSnapshotParentVolume ( data . parent_volume )
75
+ : undefined ,
73
76
projectId : data . project_id ,
74
77
references : unmarshalArrayOfObject ( data . references , unmarshalReference ) ,
75
78
size : data . size ,
76
- specs : data . specs ? unmarshalVolumeSpecifications ( data . specs ) : undefined ,
77
79
status : data . status ,
78
80
tags : data . tags ,
79
- type : data . type ,
80
81
updatedAt : unmarshalDate ( data . updated_at ) ,
81
82
zone : data . zone ,
82
- } as Volume
83
+ } as Snapshot
83
84
}
84
85
85
- const unmarshalSnapshotParentVolume = ( data : unknown ) : SnapshotParentVolume => {
86
+ const unmarshalVolumeSpecifications = ( data : unknown ) : VolumeSpecifications => {
86
87
if ( ! isJSONObject ( data ) ) {
87
88
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.` ,
89
90
)
90
91
}
91
92
92
93
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
98
97
}
99
98
100
- const unmarshalSnapshotSummary = ( data : unknown ) : SnapshotSummary => {
99
+ export const unmarshalVolume = ( data : unknown ) : Volume => {
101
100
if ( ! isJSONObject ( data ) ) {
102
101
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.` ,
104
103
)
105
104
}
106
105
107
106
return {
108
- class : data . class ,
109
107
createdAt : unmarshalDate ( data . created_at ) ,
110
108
id : data . id ,
109
+ lastDetachedAt : unmarshalDate ( data . last_detached_at ) ,
111
110
name : data . name ,
112
- parentVolume : data . parent_volume
113
- ? unmarshalSnapshotParentVolume ( data . parent_volume )
114
- : undefined ,
111
+ parentSnapshotId : data . parent_snapshot_id ,
115
112
projectId : data . project_id ,
113
+ references : unmarshalArrayOfObject ( data . references , unmarshalReference ) ,
116
114
size : data . size ,
115
+ specs : data . specs ? unmarshalVolumeSpecifications ( data . specs ) : undefined ,
117
116
status : data . status ,
118
117
tags : data . tags ,
118
+ type : data . type ,
119
119
updatedAt : unmarshalDate ( data . updated_at ) ,
120
120
zone : data . zone ,
121
- } as SnapshotSummary
121
+ } as Volume
122
122
}
123
123
124
124
export const unmarshalListSnapshotsResponse = (
@@ -131,7 +131,7 @@ export const unmarshalListSnapshotsResponse = (
131
131
}
132
132
133
133
return {
134
- snapshots : unmarshalArrayOfObject ( data . snapshots , unmarshalSnapshotSummary ) ,
134
+ snapshots : unmarshalArrayOfObject ( data . snapshots , unmarshalSnapshot ) ,
135
135
totalCount : data . total_count ,
136
136
} as ListSnapshotsResponse
137
137
}
@@ -183,31 +183,6 @@ export const unmarshalListVolumesResponse = (
183
183
} as ListVolumesResponse
184
184
}
185
185
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
-
211
186
export const marshalCreateSnapshotRequest = (
212
187
request : CreateSnapshotRequest ,
213
188
defaults : DefaultValues ,
0 commit comments