@@ -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
124124export 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-
211186export const marshalCreateSnapshotRequest = (
212187 request : CreateSnapshotRequest ,
213188 defaults : DefaultValues ,
0 commit comments