@scaleway/sdk 2.66.0 → 2.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/api/audit_trail/v1alpha1/api.gen.cjs +5 -1
  2. package/dist/api/audit_trail/v1alpha1/api.gen.js +5 -1
  3. package/dist/api/audit_trail/v1alpha1/marshalling.gen.cjs +1 -0
  4. package/dist/api/audit_trail/v1alpha1/marshalling.gen.js +1 -0
  5. package/dist/api/audit_trail/v1alpha1/types.gen.d.ts +6 -2
  6. package/dist/api/baremetal/v1/api.gen.cjs +13 -0
  7. package/dist/api/baremetal/v1/api.gen.d.ts +8 -1
  8. package/dist/api/baremetal/v1/api.gen.js +13 -0
  9. package/dist/api/baremetal/v1/content.gen.cjs +2 -1
  10. package/dist/api/baremetal/v1/content.gen.js +2 -1
  11. package/dist/api/baremetal/v1/index.gen.d.ts +1 -1
  12. package/dist/api/baremetal/v1/marshalling.gen.cjs +1 -0
  13. package/dist/api/baremetal/v1/marshalling.gen.js +1 -0
  14. package/dist/api/baremetal/v1/types.gen.d.ts +9 -1
  15. package/dist/api/block/index.gen.cjs +4 -2
  16. package/dist/api/block/index.gen.d.ts +1 -0
  17. package/dist/api/block/index.gen.js +4 -2
  18. package/dist/api/block/v1/api.gen.cjs +303 -0
  19. package/dist/api/block/v1/api.gen.d.ts +152 -0
  20. package/dist/api/block/v1/api.gen.js +303 -0
  21. package/dist/api/block/v1/content.gen.cjs +22 -0
  22. package/dist/api/block/v1/content.gen.d.ts +7 -0
  23. package/dist/api/block/v1/content.gen.js +22 -0
  24. package/dist/api/block/v1/index.gen.cjs +10 -0
  25. package/dist/api/block/v1/index.gen.d.ts +4 -0
  26. package/dist/api/block/v1/index.gen.js +10 -0
  27. package/dist/api/block/v1/marshalling.gen.cjs +200 -0
  28. package/dist/api/block/v1/marshalling.gen.d.ts +14 -0
  29. package/dist/api/block/v1/marshalling.gen.js +200 -0
  30. package/dist/api/block/v1/types.gen.d.ts +335 -0
  31. package/dist/api/block/v1/validation-rules.gen.cjs +56 -0
  32. package/dist/api/block/v1/validation-rules.gen.d.ts +47 -0
  33. package/dist/api/block/v1/validation-rules.gen.js +56 -0
  34. package/dist/api/block/v1alpha1/api.gen.cjs +1 -0
  35. package/dist/api/block/v1alpha1/api.gen.js +1 -0
  36. package/dist/api/block/v1alpha1/types.gen.d.ts +5 -0
  37. package/dist/api/cockpit/v1/api.gen.cjs +14 -17
  38. package/dist/api/cockpit/v1/api.gen.d.ts +6 -9
  39. package/dist/api/cockpit/v1/api.gen.js +15 -18
  40. package/dist/api/cockpit/v1/index.gen.d.ts +1 -1
  41. package/dist/api/cockpit/v1/marshalling.gen.cjs +29 -26
  42. package/dist/api/cockpit/v1/marshalling.gen.d.ts +2 -2
  43. package/dist/api/cockpit/v1/marshalling.gen.js +29 -26
  44. package/dist/api/cockpit/v1/types.gen.d.ts +49 -34
  45. package/dist/api/cockpit/v1/validation-rules.gen.cjs +0 -10
  46. package/dist/api/cockpit/v1/validation-rules.gen.d.ts +0 -9
  47. package/dist/api/cockpit/v1/validation-rules.gen.js +0 -10
  48. package/dist/api/edge_services/index.gen.cjs +2 -0
  49. package/dist/api/edge_services/index.gen.d.ts +1 -0
  50. package/dist/api/edge_services/index.gen.js +3 -1
  51. package/dist/api/edge_services/v1beta1/api.gen.cjs +941 -0
  52. package/dist/api/edge_services/v1beta1/api.gen.d.ts +454 -0
  53. package/dist/api/edge_services/v1beta1/api.gen.js +941 -0
  54. package/dist/api/edge_services/v1beta1/content.gen.cjs +8 -0
  55. package/dist/api/edge_services/v1beta1/content.gen.d.ts +5 -0
  56. package/dist/api/edge_services/v1beta1/content.gen.js +8 -0
  57. package/dist/api/{webhosting/v1alpha1 → edge_services/v1beta1}/index.gen.cjs +2 -2
  58. package/dist/api/edge_services/v1beta1/index.gen.d.ts +4 -0
  59. package/dist/api/edge_services/v1beta1/index.gen.js +9 -0
  60. package/dist/api/edge_services/v1beta1/marshalling.gen.cjs +808 -0
  61. package/dist/api/edge_services/v1beta1/marshalling.gen.d.ts +53 -0
  62. package/dist/api/edge_services/v1beta1/marshalling.gen.js +808 -0
  63. package/dist/api/edge_services/v1beta1/types.gen.d.ts +1218 -0
  64. package/dist/api/edge_services/v1beta1/validation-rules.gen.cjs +23 -0
  65. package/dist/api/edge_services/v1beta1/validation-rules.gen.d.ts +18 -0
  66. package/dist/api/edge_services/v1beta1/validation-rules.gen.js +23 -0
  67. package/dist/api/instance/v1/api.gen.cjs +18 -0
  68. package/dist/api/instance/v1/api.gen.d.ts +13 -1
  69. package/dist/api/instance/v1/api.gen.js +19 -1
  70. package/dist/api/instance/v1/index.gen.d.ts +1 -1
  71. package/dist/api/instance/v1/marshalling.gen.cjs +12 -0
  72. package/dist/api/instance/v1/marshalling.gen.d.ts +2 -1
  73. package/dist/api/instance/v1/marshalling.gen.js +12 -0
  74. package/dist/api/instance/v1/types.gen.d.ts +12 -0
  75. package/dist/api/lb/v1/marshalling.gen.cjs +7 -0
  76. package/dist/api/lb/v1/marshalling.gen.js +7 -0
  77. package/dist/api/lb/v1/types.gen.d.ts +27 -0
  78. package/dist/api/mongodb/v1alpha1/api.gen.cjs +11 -0
  79. package/dist/api/mongodb/v1alpha1/api.gen.d.ts +2 -1
  80. package/dist/api/mongodb/v1alpha1/api.gen.js +12 -1
  81. package/dist/api/mongodb/v1alpha1/index.gen.d.ts +1 -1
  82. package/dist/api/mongodb/v1alpha1/marshalling.gen.cjs +26 -1
  83. package/dist/api/mongodb/v1alpha1/marshalling.gen.d.ts +2 -1
  84. package/dist/api/mongodb/v1alpha1/marshalling.gen.js +26 -1
  85. package/dist/api/mongodb/v1alpha1/types.gen.d.ts +29 -0
  86. package/dist/api/mongodb/v1alpha1/validation-rules.gen.cjs +8 -0
  87. package/dist/api/mongodb/v1alpha1/validation-rules.gen.d.ts +7 -0
  88. package/dist/api/mongodb/v1alpha1/validation-rules.gen.js +8 -0
  89. package/dist/api/secret/v1beta1/api.gen.cjs +33 -0
  90. package/dist/api/secret/v1beta1/api.gen.d.ts +17 -1
  91. package/dist/api/secret/v1beta1/api.gen.js +33 -0
  92. package/dist/api/secret/v1beta1/index.gen.d.ts +1 -1
  93. package/dist/api/secret/v1beta1/marshalling.gen.cjs +2 -0
  94. package/dist/api/secret/v1beta1/marshalling.gen.js +2 -0
  95. package/dist/api/secret/v1beta1/types.gen.d.ts +30 -3
  96. package/dist/api/vpcgw/v1/api.gen.cjs +6 -0
  97. package/dist/api/vpcgw/v1/api.gen.d.ts +2 -1
  98. package/dist/api/vpcgw/v1/api.gen.js +6 -0
  99. package/dist/api/vpcgw/v1/index.gen.d.ts +1 -1
  100. package/dist/api/vpcgw/v1/types.gen.d.ts +5 -0
  101. package/dist/api/webhosting/index.gen.cjs +0 -2
  102. package/dist/api/webhosting/index.gen.d.ts +0 -1
  103. package/dist/api/webhosting/index.gen.js +1 -3
  104. package/dist/api/webhosting/v1/content.gen.cjs +0 -6
  105. package/dist/api/webhosting/v1/content.gen.d.ts +1 -3
  106. package/dist/api/webhosting/v1/content.gen.js +0 -6
  107. package/dist/api/webhosting/v1/index.gen.cjs +0 -1
  108. package/dist/api/webhosting/v1/index.gen.d.ts +1 -1
  109. package/dist/api/webhosting/v1/index.gen.js +1 -2
  110. package/dist/api/webhosting/v1/marshalling.gen.cjs +5 -2
  111. package/dist/api/webhosting/v1/marshalling.gen.js +5 -2
  112. package/dist/api/webhosting/v1/types.gen.d.ts +12 -7
  113. package/dist/scw/constants.cjs +1 -1
  114. package/dist/scw/constants.d.ts +2 -2
  115. package/dist/scw/constants.js +1 -1
  116. package/package.json +2 -2
  117. package/dist/api/webhosting/v1alpha1/api.gen.cjs +0 -339
  118. package/dist/api/webhosting/v1alpha1/api.gen.d.ts +0 -168
  119. package/dist/api/webhosting/v1alpha1/api.gen.js +0 -339
  120. package/dist/api/webhosting/v1alpha1/content.gen.cjs +0 -8
  121. package/dist/api/webhosting/v1alpha1/content.gen.d.ts +0 -3
  122. package/dist/api/webhosting/v1alpha1/content.gen.js +0 -8
  123. package/dist/api/webhosting/v1alpha1/index.gen.d.ts +0 -4
  124. package/dist/api/webhosting/v1alpha1/index.gen.js +0 -9
  125. package/dist/api/webhosting/v1alpha1/marshalling.gen.cjs +0 -300
  126. package/dist/api/webhosting/v1alpha1/marshalling.gen.d.ts +0 -17
  127. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +0 -300
  128. package/dist/api/webhosting/v1alpha1/types.gen.d.ts +0 -480
  129. package/dist/api/webhosting/v1alpha1/validation-rules.gen.cjs +0 -32
  130. package/dist/api/webhosting/v1alpha1/validation-rules.gen.d.ts +0 -27
  131. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +0 -32
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const randomName = require("@scaleway/random-name");
4
+ const json = require("../../../helpers/json.cjs");
5
+ const customMarshalling = require("../../../scw/custom-marshalling.cjs");
6
+ const marshalling = require("../../../helpers/marshalling.cjs");
7
+ const unmarshalReference = (data) => {
8
+ if (!json.isJSONObject(data)) {
9
+ throw new TypeError(
10
+ `Unmarshalling the type 'Reference' failed as data isn't a dictionary.`
11
+ );
12
+ }
13
+ return {
14
+ createdAt: marshalling.unmarshalDate(data.created_at),
15
+ id: data.id,
16
+ productResourceId: data.product_resource_id,
17
+ productResourceType: data.product_resource_type,
18
+ status: data.status,
19
+ type: data.type
20
+ };
21
+ };
22
+ const unmarshalSnapshotParentVolume = (data) => {
23
+ if (!json.isJSONObject(data)) {
24
+ throw new TypeError(
25
+ `Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`
26
+ );
27
+ }
28
+ return {
29
+ id: data.id,
30
+ name: data.name,
31
+ status: data.status,
32
+ type: data.type
33
+ };
34
+ };
35
+ const unmarshalSnapshot = (data) => {
36
+ if (!json.isJSONObject(data)) {
37
+ throw new TypeError(
38
+ `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`
39
+ );
40
+ }
41
+ return {
42
+ class: data.class,
43
+ createdAt: marshalling.unmarshalDate(data.created_at),
44
+ id: data.id,
45
+ name: data.name,
46
+ parentVolume: data.parent_volume ? unmarshalSnapshotParentVolume(data.parent_volume) : void 0,
47
+ projectId: data.project_id,
48
+ references: marshalling.unmarshalArrayOfObject(data.references, unmarshalReference),
49
+ size: data.size,
50
+ status: data.status,
51
+ tags: data.tags,
52
+ updatedAt: marshalling.unmarshalDate(data.updated_at),
53
+ zone: data.zone
54
+ };
55
+ };
56
+ const unmarshalVolumeSpecifications = (data) => {
57
+ if (!json.isJSONObject(data)) {
58
+ throw new TypeError(
59
+ `Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`
60
+ );
61
+ }
62
+ return {
63
+ class: data.class,
64
+ perfIops: data.perf_iops
65
+ };
66
+ };
67
+ const unmarshalVolume = (data) => {
68
+ if (!json.isJSONObject(data)) {
69
+ throw new TypeError(
70
+ `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`
71
+ );
72
+ }
73
+ return {
74
+ createdAt: marshalling.unmarshalDate(data.created_at),
75
+ id: data.id,
76
+ lastDetachedAt: marshalling.unmarshalDate(data.last_detached_at),
77
+ name: data.name,
78
+ parentSnapshotId: data.parent_snapshot_id,
79
+ projectId: data.project_id,
80
+ references: marshalling.unmarshalArrayOfObject(data.references, unmarshalReference),
81
+ size: data.size,
82
+ specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
83
+ status: data.status,
84
+ tags: data.tags,
85
+ type: data.type,
86
+ updatedAt: marshalling.unmarshalDate(data.updated_at),
87
+ zone: data.zone
88
+ };
89
+ };
90
+ const unmarshalListSnapshotsResponse = (data) => {
91
+ if (!json.isJSONObject(data)) {
92
+ throw new TypeError(
93
+ `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`
94
+ );
95
+ }
96
+ return {
97
+ snapshots: marshalling.unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
98
+ totalCount: data.total_count
99
+ };
100
+ };
101
+ const unmarshalVolumeType = (data) => {
102
+ if (!json.isJSONObject(data)) {
103
+ throw new TypeError(
104
+ `Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`
105
+ );
106
+ }
107
+ return {
108
+ pricing: data.pricing ? customMarshalling.unmarshalMoney(data.pricing) : void 0,
109
+ snapshotPricing: data.snapshot_pricing ? customMarshalling.unmarshalMoney(data.snapshot_pricing) : void 0,
110
+ specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
111
+ type: data.type
112
+ };
113
+ };
114
+ const unmarshalListVolumeTypesResponse = (data) => {
115
+ if (!json.isJSONObject(data)) {
116
+ throw new TypeError(
117
+ `Unmarshalling the type 'ListVolumeTypesResponse' failed as data isn't a dictionary.`
118
+ );
119
+ }
120
+ return {
121
+ totalCount: data.total_count,
122
+ volumeTypes: marshalling.unmarshalArrayOfObject(data.volume_types, unmarshalVolumeType)
123
+ };
124
+ };
125
+ const unmarshalListVolumesResponse = (data) => {
126
+ if (!json.isJSONObject(data)) {
127
+ throw new TypeError(
128
+ `Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`
129
+ );
130
+ }
131
+ return {
132
+ totalCount: data.total_count,
133
+ volumes: marshalling.unmarshalArrayOfObject(data.volumes, unmarshalVolume)
134
+ };
135
+ };
136
+ const marshalCreateSnapshotRequest = (request, defaults) => ({
137
+ name: request.name || randomName("snp"),
138
+ project_id: request.projectId ?? defaults.defaultProjectId,
139
+ tags: request.tags,
140
+ volume_id: request.volumeId
141
+ });
142
+ const marshalCreateVolumeRequestFromEmpty = (request, defaults) => ({
143
+ size: request.size
144
+ });
145
+ const marshalCreateVolumeRequestFromSnapshot = (request, defaults) => ({
146
+ size: request.size,
147
+ snapshot_id: request.snapshotId
148
+ });
149
+ const marshalCreateVolumeRequest = (request, defaults) => ({
150
+ name: request.name || randomName("vol"),
151
+ project_id: request.projectId ?? defaults.defaultProjectId,
152
+ tags: request.tags,
153
+ ...marshalling.resolveOneOf([
154
+ {
155
+ param: "from_empty",
156
+ value: request.fromEmpty !== void 0 ? marshalCreateVolumeRequestFromEmpty(request.fromEmpty) : void 0
157
+ },
158
+ {
159
+ param: "from_snapshot",
160
+ value: request.fromSnapshot !== void 0 ? marshalCreateVolumeRequestFromSnapshot(
161
+ request.fromSnapshot
162
+ ) : void 0
163
+ }
164
+ ]),
165
+ ...marshalling.resolveOneOf([{ param: "perf_iops", value: request.perfIops }])
166
+ });
167
+ const marshalExportSnapshotToObjectStorageRequest = (request, defaults) => ({
168
+ bucket: request.bucket,
169
+ key: request.key
170
+ });
171
+ const marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
172
+ bucket: request.bucket,
173
+ key: request.key,
174
+ name: request.name,
175
+ project_id: request.projectId ?? defaults.defaultProjectId,
176
+ size: request.size,
177
+ tags: request.tags
178
+ });
179
+ const marshalUpdateSnapshotRequest = (request, defaults) => ({
180
+ name: request.name,
181
+ tags: request.tags
182
+ });
183
+ const marshalUpdateVolumeRequest = (request, defaults) => ({
184
+ name: request.name,
185
+ perf_iops: request.perfIops,
186
+ size: request.size,
187
+ tags: request.tags
188
+ });
189
+ exports.marshalCreateSnapshotRequest = marshalCreateSnapshotRequest;
190
+ exports.marshalCreateVolumeRequest = marshalCreateVolumeRequest;
191
+ exports.marshalExportSnapshotToObjectStorageRequest = marshalExportSnapshotToObjectStorageRequest;
192
+ exports.marshalImportSnapshotFromObjectStorageRequest = marshalImportSnapshotFromObjectStorageRequest;
193
+ exports.marshalUpdateSnapshotRequest = marshalUpdateSnapshotRequest;
194
+ exports.marshalUpdateVolumeRequest = marshalUpdateVolumeRequest;
195
+ exports.unmarshalListSnapshotsResponse = unmarshalListSnapshotsResponse;
196
+ exports.unmarshalListVolumeTypesResponse = unmarshalListVolumeTypesResponse;
197
+ exports.unmarshalListVolumesResponse = unmarshalListVolumesResponse;
198
+ exports.unmarshalReference = unmarshalReference;
199
+ exports.unmarshalSnapshot = unmarshalSnapshot;
200
+ exports.unmarshalVolume = unmarshalVolume;
@@ -0,0 +1,14 @@
1
+ import type { DefaultValues } from '../../../bridge';
2
+ import type { CreateSnapshotRequest, CreateVolumeRequest, ExportSnapshotToObjectStorageRequest, ImportSnapshotFromObjectStorageRequest, ListSnapshotsResponse, ListVolumeTypesResponse, ListVolumesResponse, Reference, Snapshot, UpdateSnapshotRequest, UpdateVolumeRequest, Volume } from './types.gen';
3
+ export declare const unmarshalReference: (data: unknown) => Reference;
4
+ export declare const unmarshalSnapshot: (data: unknown) => Snapshot;
5
+ export declare const unmarshalVolume: (data: unknown) => Volume;
6
+ export declare const unmarshalListSnapshotsResponse: (data: unknown) => ListSnapshotsResponse;
7
+ export declare const unmarshalListVolumeTypesResponse: (data: unknown) => ListVolumeTypesResponse;
8
+ export declare const unmarshalListVolumesResponse: (data: unknown) => ListVolumesResponse;
9
+ export declare const marshalCreateSnapshotRequest: (request: CreateSnapshotRequest, defaults: DefaultValues) => Record<string, unknown>;
10
+ export declare const marshalCreateVolumeRequest: (request: CreateVolumeRequest, defaults: DefaultValues) => Record<string, unknown>;
11
+ export declare const marshalExportSnapshotToObjectStorageRequest: (request: ExportSnapshotToObjectStorageRequest, defaults: DefaultValues) => Record<string, unknown>;
12
+ export declare const marshalImportSnapshotFromObjectStorageRequest: (request: ImportSnapshotFromObjectStorageRequest, defaults: DefaultValues) => Record<string, unknown>;
13
+ export declare const marshalUpdateSnapshotRequest: (request: UpdateSnapshotRequest, defaults: DefaultValues) => Record<string, unknown>;
14
+ export declare const marshalUpdateVolumeRequest: (request: UpdateVolumeRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -0,0 +1,200 @@
1
+ import randomName from "@scaleway/random-name";
2
+ import { isJSONObject } from "../../../helpers/json.js";
3
+ import { unmarshalMoney } from "../../../scw/custom-marshalling.js";
4
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from "../../../helpers/marshalling.js";
5
+ const unmarshalReference = (data) => {
6
+ if (!isJSONObject(data)) {
7
+ throw new TypeError(
8
+ `Unmarshalling the type 'Reference' failed as data isn't a dictionary.`
9
+ );
10
+ }
11
+ return {
12
+ createdAt: unmarshalDate(data.created_at),
13
+ id: data.id,
14
+ productResourceId: data.product_resource_id,
15
+ productResourceType: data.product_resource_type,
16
+ status: data.status,
17
+ type: data.type
18
+ };
19
+ };
20
+ const unmarshalSnapshotParentVolume = (data) => {
21
+ if (!isJSONObject(data)) {
22
+ throw new TypeError(
23
+ `Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`
24
+ );
25
+ }
26
+ return {
27
+ id: data.id,
28
+ name: data.name,
29
+ status: data.status,
30
+ type: data.type
31
+ };
32
+ };
33
+ const unmarshalSnapshot = (data) => {
34
+ if (!isJSONObject(data)) {
35
+ throw new TypeError(
36
+ `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`
37
+ );
38
+ }
39
+ return {
40
+ class: data.class,
41
+ createdAt: unmarshalDate(data.created_at),
42
+ id: data.id,
43
+ name: data.name,
44
+ parentVolume: data.parent_volume ? unmarshalSnapshotParentVolume(data.parent_volume) : void 0,
45
+ projectId: data.project_id,
46
+ references: unmarshalArrayOfObject(data.references, unmarshalReference),
47
+ size: data.size,
48
+ status: data.status,
49
+ tags: data.tags,
50
+ updatedAt: unmarshalDate(data.updated_at),
51
+ zone: data.zone
52
+ };
53
+ };
54
+ const unmarshalVolumeSpecifications = (data) => {
55
+ if (!isJSONObject(data)) {
56
+ throw new TypeError(
57
+ `Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`
58
+ );
59
+ }
60
+ return {
61
+ class: data.class,
62
+ perfIops: data.perf_iops
63
+ };
64
+ };
65
+ const unmarshalVolume = (data) => {
66
+ if (!isJSONObject(data)) {
67
+ throw new TypeError(
68
+ `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`
69
+ );
70
+ }
71
+ return {
72
+ createdAt: unmarshalDate(data.created_at),
73
+ id: data.id,
74
+ lastDetachedAt: unmarshalDate(data.last_detached_at),
75
+ name: data.name,
76
+ parentSnapshotId: data.parent_snapshot_id,
77
+ projectId: data.project_id,
78
+ references: unmarshalArrayOfObject(data.references, unmarshalReference),
79
+ size: data.size,
80
+ specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
81
+ status: data.status,
82
+ tags: data.tags,
83
+ type: data.type,
84
+ updatedAt: unmarshalDate(data.updated_at),
85
+ zone: data.zone
86
+ };
87
+ };
88
+ const unmarshalListSnapshotsResponse = (data) => {
89
+ if (!isJSONObject(data)) {
90
+ throw new TypeError(
91
+ `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`
92
+ );
93
+ }
94
+ return {
95
+ snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
96
+ totalCount: data.total_count
97
+ };
98
+ };
99
+ const unmarshalVolumeType = (data) => {
100
+ if (!isJSONObject(data)) {
101
+ throw new TypeError(
102
+ `Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`
103
+ );
104
+ }
105
+ return {
106
+ pricing: data.pricing ? unmarshalMoney(data.pricing) : void 0,
107
+ snapshotPricing: data.snapshot_pricing ? unmarshalMoney(data.snapshot_pricing) : void 0,
108
+ specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
109
+ type: data.type
110
+ };
111
+ };
112
+ const unmarshalListVolumeTypesResponse = (data) => {
113
+ if (!isJSONObject(data)) {
114
+ throw new TypeError(
115
+ `Unmarshalling the type 'ListVolumeTypesResponse' failed as data isn't a dictionary.`
116
+ );
117
+ }
118
+ return {
119
+ totalCount: data.total_count,
120
+ volumeTypes: unmarshalArrayOfObject(data.volume_types, unmarshalVolumeType)
121
+ };
122
+ };
123
+ const unmarshalListVolumesResponse = (data) => {
124
+ if (!isJSONObject(data)) {
125
+ throw new TypeError(
126
+ `Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`
127
+ );
128
+ }
129
+ return {
130
+ totalCount: data.total_count,
131
+ volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
132
+ };
133
+ };
134
+ const marshalCreateSnapshotRequest = (request, defaults) => ({
135
+ name: request.name || randomName("snp"),
136
+ project_id: request.projectId ?? defaults.defaultProjectId,
137
+ tags: request.tags,
138
+ volume_id: request.volumeId
139
+ });
140
+ const marshalCreateVolumeRequestFromEmpty = (request, defaults) => ({
141
+ size: request.size
142
+ });
143
+ const marshalCreateVolumeRequestFromSnapshot = (request, defaults) => ({
144
+ size: request.size,
145
+ snapshot_id: request.snapshotId
146
+ });
147
+ const marshalCreateVolumeRequest = (request, defaults) => ({
148
+ name: request.name || randomName("vol"),
149
+ project_id: request.projectId ?? defaults.defaultProjectId,
150
+ tags: request.tags,
151
+ ...resolveOneOf([
152
+ {
153
+ param: "from_empty",
154
+ value: request.fromEmpty !== void 0 ? marshalCreateVolumeRequestFromEmpty(request.fromEmpty) : void 0
155
+ },
156
+ {
157
+ param: "from_snapshot",
158
+ value: request.fromSnapshot !== void 0 ? marshalCreateVolumeRequestFromSnapshot(
159
+ request.fromSnapshot
160
+ ) : void 0
161
+ }
162
+ ]),
163
+ ...resolveOneOf([{ param: "perf_iops", value: request.perfIops }])
164
+ });
165
+ const marshalExportSnapshotToObjectStorageRequest = (request, defaults) => ({
166
+ bucket: request.bucket,
167
+ key: request.key
168
+ });
169
+ const marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
170
+ bucket: request.bucket,
171
+ key: request.key,
172
+ name: request.name,
173
+ project_id: request.projectId ?? defaults.defaultProjectId,
174
+ size: request.size,
175
+ tags: request.tags
176
+ });
177
+ const marshalUpdateSnapshotRequest = (request, defaults) => ({
178
+ name: request.name,
179
+ tags: request.tags
180
+ });
181
+ const marshalUpdateVolumeRequest = (request, defaults) => ({
182
+ name: request.name,
183
+ perf_iops: request.perfIops,
184
+ size: request.size,
185
+ tags: request.tags
186
+ });
187
+ export {
188
+ marshalCreateSnapshotRequest,
189
+ marshalCreateVolumeRequest,
190
+ marshalExportSnapshotToObjectStorageRequest,
191
+ marshalImportSnapshotFromObjectStorageRequest,
192
+ marshalUpdateSnapshotRequest,
193
+ marshalUpdateVolumeRequest,
194
+ unmarshalListSnapshotsResponse,
195
+ unmarshalListVolumeTypesResponse,
196
+ unmarshalListVolumesResponse,
197
+ unmarshalReference,
198
+ unmarshalSnapshot,
199
+ unmarshalVolume
200
+ };