@scaleway/sdk-block 1.3.0 → 2.1.1
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.
- package/README.md +96 -0
- package/dist/v1/api.gen.d.ts +2 -2
- package/dist/v1/api.gen.js +21 -35
- package/dist/v1/index.gen.d.ts +2 -2
- package/dist/v1/marshalling.gen.d.ts +1 -1
- package/dist/v1/marshalling.gen.js +7 -4
- package/dist/v1/types.gen.d.ts +5 -1
- package/dist/v1alpha1/api.gen.d.ts +2 -2
- package/dist/v1alpha1/api.gen.js +19 -34
- package/dist/v1alpha1/index.gen.d.ts +2 -2
- package/dist/v1alpha1/marshalling.gen.d.ts +1 -1
- package/dist/v1alpha1/marshalling.gen.js +7 -4
- package/dist/v1alpha1/types.gen.d.ts +1 -1
- package/package.json +6 -9
- package/dist/index.gen.cjs +0 -6
- package/dist/v1/api.gen.cjs +0 -292
- package/dist/v1/content.gen.cjs +0 -22
- package/dist/v1/index.gen.cjs +0 -23
- package/dist/v1/marshalling.gen.cjs +0 -198
- package/dist/v1/validation-rules.gen.cjs +0 -56
- package/dist/v1alpha1/api.gen.cjs +0 -310
- package/dist/v1alpha1/content.gen.cjs +0 -22
- package/dist/v1alpha1/index.gen.cjs +0 -23
- package/dist/v1alpha1/marshalling.gen.cjs +0 -206
- package/dist/v1alpha1/validation-rules.gen.cjs +0 -62
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const sdkClient = require("@scaleway/sdk-client");
|
|
4
|
-
const content_gen = require("./content.gen.cjs");
|
|
5
|
-
const marshalling_gen = require("./marshalling.gen.cjs");
|
|
6
|
-
const jsonContentHeaders = {
|
|
7
|
-
"Content-Type": "application/json; charset=utf-8"
|
|
8
|
-
};
|
|
9
|
-
class API extends sdkClient.API {
|
|
10
|
-
/**
|
|
11
|
-
* Locality of this API.
|
|
12
|
-
* type ∈ {'zone','region','global','unspecified'}
|
|
13
|
-
*/
|
|
14
|
-
static LOCALITY = sdkClient.toApiLocality({
|
|
15
|
-
zones: [
|
|
16
|
-
"fr-par-1",
|
|
17
|
-
"fr-par-2",
|
|
18
|
-
"fr-par-3",
|
|
19
|
-
"nl-ams-1",
|
|
20
|
-
"nl-ams-2",
|
|
21
|
-
"nl-ams-3",
|
|
22
|
-
"pl-waw-1",
|
|
23
|
-
"pl-waw-2",
|
|
24
|
-
"pl-waw-3"
|
|
25
|
-
]
|
|
26
|
-
});
|
|
27
|
-
pageOfListVolumeTypes = (request = {}) => this.client.fetch(
|
|
28
|
-
{
|
|
29
|
-
method: "GET",
|
|
30
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volume-types`,
|
|
31
|
-
urlParams: sdkClient.urlParams(
|
|
32
|
-
["page", request.page],
|
|
33
|
-
[
|
|
34
|
-
"page_size",
|
|
35
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
36
|
-
]
|
|
37
|
-
)
|
|
38
|
-
},
|
|
39
|
-
marshalling_gen.unmarshalListVolumeTypesResponse
|
|
40
|
-
);
|
|
41
|
-
/**
|
|
42
|
-
* List volume types. List all available volume types in a specified zone. The volume types listed are ordered by name in ascending order.
|
|
43
|
-
*
|
|
44
|
-
* @param request - The request {@link ListVolumeTypesRequest}
|
|
45
|
-
* @returns A Promise of ListVolumeTypesResponse
|
|
46
|
-
*/
|
|
47
|
-
listVolumeTypes = (request = {}) => sdkClient.enrichForPagination("volumeTypes", this.pageOfListVolumeTypes, request);
|
|
48
|
-
pageOfListVolumes = (request = {}) => this.client.fetch(
|
|
49
|
-
{
|
|
50
|
-
method: "GET",
|
|
51
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`,
|
|
52
|
-
urlParams: sdkClient.urlParams(
|
|
53
|
-
["name", request.name],
|
|
54
|
-
["order_by", request.orderBy],
|
|
55
|
-
["organization_id", request.organizationId],
|
|
56
|
-
["page", request.page],
|
|
57
|
-
[
|
|
58
|
-
"page_size",
|
|
59
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
60
|
-
],
|
|
61
|
-
["product_resource_id", request.productResourceId],
|
|
62
|
-
["project_id", request.projectId],
|
|
63
|
-
["tags", request.tags]
|
|
64
|
-
)
|
|
65
|
-
},
|
|
66
|
-
marshalling_gen.unmarshalListVolumesResponse
|
|
67
|
-
);
|
|
68
|
-
/**
|
|
69
|
-
* List volumes. List all existing volumes in a specified zone. By default, the volumes listed are ordered by creation date in ascending order. This can be modified via the `order_by` field.
|
|
70
|
-
*
|
|
71
|
-
* @param request - The request {@link ListVolumesRequest}
|
|
72
|
-
* @returns A Promise of ListVolumesResponse
|
|
73
|
-
*/
|
|
74
|
-
listVolumes = (request = {}) => sdkClient.enrichForPagination("volumes", this.pageOfListVolumes, request);
|
|
75
|
-
/**
|
|
76
|
-
* Create a volume. To create a new volume from scratch, you must specify `from_empty` and the `size`.
|
|
77
|
-
To create a volume from an existing snapshot, specify `from_snapshot` and the `snapshot_id` in the request payload instead, size is optional and can be specified if you need to extend the original size. The volume will take on the same volume class and underlying IOPS limitations as the original snapshot.
|
|
78
|
-
*
|
|
79
|
-
* @param request - The request {@link CreateVolumeRequest}
|
|
80
|
-
* @returns A Promise of Volume
|
|
81
|
-
*/
|
|
82
|
-
createVolume = (request = {}) => this.client.fetch(
|
|
83
|
-
{
|
|
84
|
-
body: JSON.stringify(
|
|
85
|
-
marshalling_gen.marshalCreateVolumeRequest(request, this.client.settings)
|
|
86
|
-
),
|
|
87
|
-
headers: jsonContentHeaders,
|
|
88
|
-
method: "POST",
|
|
89
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`
|
|
90
|
-
},
|
|
91
|
-
marshalling_gen.unmarshalVolume
|
|
92
|
-
);
|
|
93
|
-
/**
|
|
94
|
-
* Get a volume. Retrieve technical information about a specific volume. Details such as size, type, and status are returned in the response.
|
|
95
|
-
*
|
|
96
|
-
* @param request - The request {@link GetVolumeRequest}
|
|
97
|
-
* @returns A Promise of Volume
|
|
98
|
-
*/
|
|
99
|
-
getVolume = (request) => this.client.fetch(
|
|
100
|
-
{
|
|
101
|
-
method: "GET",
|
|
102
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${sdkClient.validatePathParam("volumeId", request.volumeId)}`
|
|
103
|
-
},
|
|
104
|
-
marshalling_gen.unmarshalVolume
|
|
105
|
-
);
|
|
106
|
-
/**
|
|
107
|
-
* Waits for {@link Volume} to be in a final state.
|
|
108
|
-
*
|
|
109
|
-
* @param request - The request {@link GetVolumeRequest}
|
|
110
|
-
* @param options - The waiting options
|
|
111
|
-
* @returns A Promise of Volume
|
|
112
|
-
*/
|
|
113
|
-
waitForVolume = (request, options) => sdkClient.waitForResource(
|
|
114
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
115
|
-
!content_gen.VOLUME_TRANSIENT_STATUSES.includes(res.status)
|
|
116
|
-
)),
|
|
117
|
-
this.getVolume,
|
|
118
|
-
request,
|
|
119
|
-
options
|
|
120
|
-
);
|
|
121
|
-
/**
|
|
122
|
-
* Delete a detached volume. You must specify the `volume_id` of the volume you want to delete. The volume must not be in the `in_use` status.
|
|
123
|
-
*
|
|
124
|
-
* @param request - The request {@link DeleteVolumeRequest}
|
|
125
|
-
*/
|
|
126
|
-
deleteVolume = (request) => this.client.fetch({
|
|
127
|
-
method: "DELETE",
|
|
128
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${sdkClient.validatePathParam("volumeId", request.volumeId)}`
|
|
129
|
-
});
|
|
130
|
-
/**
|
|
131
|
-
* Update a volume. Update the technical details of a volume, such as its name, tags, or its new size and `volume_type` (within the same Block Storage class).
|
|
132
|
-
You can only resize a volume to a larger size. It is currently not possible to change your Block Storage Class.
|
|
133
|
-
*
|
|
134
|
-
* @param request - The request {@link UpdateVolumeRequest}
|
|
135
|
-
* @returns A Promise of Volume
|
|
136
|
-
*/
|
|
137
|
-
updateVolume = (request) => this.client.fetch(
|
|
138
|
-
{
|
|
139
|
-
body: JSON.stringify(
|
|
140
|
-
marshalling_gen.marshalUpdateVolumeRequest(request, this.client.settings)
|
|
141
|
-
),
|
|
142
|
-
headers: jsonContentHeaders,
|
|
143
|
-
method: "PATCH",
|
|
144
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${sdkClient.validatePathParam("volumeId", request.volumeId)}`
|
|
145
|
-
},
|
|
146
|
-
marshalling_gen.unmarshalVolume
|
|
147
|
-
);
|
|
148
|
-
pageOfListSnapshots = (request = {}) => this.client.fetch(
|
|
149
|
-
{
|
|
150
|
-
method: "GET",
|
|
151
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`,
|
|
152
|
-
urlParams: sdkClient.urlParams(
|
|
153
|
-
["name", request.name],
|
|
154
|
-
["order_by", request.orderBy],
|
|
155
|
-
["organization_id", request.organizationId],
|
|
156
|
-
["page", request.page],
|
|
157
|
-
[
|
|
158
|
-
"page_size",
|
|
159
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
160
|
-
],
|
|
161
|
-
["project_id", request.projectId],
|
|
162
|
-
["tags", request.tags],
|
|
163
|
-
["volume_id", request.volumeId]
|
|
164
|
-
)
|
|
165
|
-
},
|
|
166
|
-
marshalling_gen.unmarshalListSnapshotsResponse
|
|
167
|
-
);
|
|
168
|
-
/**
|
|
169
|
-
* List all snapshots. List all available snapshots in a specified zone. By default, the snapshots listed are ordered by creation date in ascending order. This can be modified via the `order_by` field.
|
|
170
|
-
*
|
|
171
|
-
* @param request - The request {@link ListSnapshotsRequest}
|
|
172
|
-
* @returns A Promise of ListSnapshotsResponse
|
|
173
|
-
*/
|
|
174
|
-
listSnapshots = (request = {}) => sdkClient.enrichForPagination("snapshots", this.pageOfListSnapshots, request);
|
|
175
|
-
/**
|
|
176
|
-
* Get a snapshot. Retrieve technical information about a specific snapshot. Details such as size, volume type, and status are returned in the response.
|
|
177
|
-
*
|
|
178
|
-
* @param request - The request {@link GetSnapshotRequest}
|
|
179
|
-
* @returns A Promise of Snapshot
|
|
180
|
-
*/
|
|
181
|
-
getSnapshot = (request) => this.client.fetch(
|
|
182
|
-
{
|
|
183
|
-
method: "GET",
|
|
184
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}`
|
|
185
|
-
},
|
|
186
|
-
marshalling_gen.unmarshalSnapshot
|
|
187
|
-
);
|
|
188
|
-
/**
|
|
189
|
-
* Waits for {@link Snapshot} to be in a final state.
|
|
190
|
-
*
|
|
191
|
-
* @param request - The request {@link GetSnapshotRequest}
|
|
192
|
-
* @param options - The waiting options
|
|
193
|
-
* @returns A Promise of Snapshot
|
|
194
|
-
*/
|
|
195
|
-
waitForSnapshot = (request, options) => sdkClient.waitForResource(
|
|
196
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
197
|
-
!content_gen.SNAPSHOT_TRANSIENT_STATUSES.includes(res.status)
|
|
198
|
-
)),
|
|
199
|
-
this.getSnapshot,
|
|
200
|
-
request,
|
|
201
|
-
options
|
|
202
|
-
);
|
|
203
|
-
/**
|
|
204
|
-
* Create a snapshot of a volume. To create a snapshot, the volume must be in the `in_use` or the `available` status.
|
|
205
|
-
If your volume is in a transient state, you need to wait until the end of the current operation.
|
|
206
|
-
*
|
|
207
|
-
* @param request - The request {@link CreateSnapshotRequest}
|
|
208
|
-
* @returns A Promise of Snapshot
|
|
209
|
-
*/
|
|
210
|
-
createSnapshot = (request) => this.client.fetch(
|
|
211
|
-
{
|
|
212
|
-
body: JSON.stringify(
|
|
213
|
-
marshalling_gen.marshalCreateSnapshotRequest(request, this.client.settings)
|
|
214
|
-
),
|
|
215
|
-
headers: jsonContentHeaders,
|
|
216
|
-
method: "POST",
|
|
217
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`
|
|
218
|
-
},
|
|
219
|
-
marshalling_gen.unmarshalSnapshot
|
|
220
|
-
);
|
|
221
|
-
/**
|
|
222
|
-
* (Deprecated in favor of `ImportSnapshotFromObjectStorage`). Import a snapshot from a Scaleway Object Storage bucket
|
|
223
|
-
The bucket must contain a QCOW2 image.
|
|
224
|
-
The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
|
|
225
|
-
*
|
|
226
|
-
* @deprecated
|
|
227
|
-
* @param request - The request {@link ImportSnapshotFromS3Request}
|
|
228
|
-
* @returns A Promise of Snapshot
|
|
229
|
-
*/
|
|
230
|
-
importSnapshotFromS3 = (request) => this.client.fetch(
|
|
231
|
-
{
|
|
232
|
-
body: JSON.stringify(
|
|
233
|
-
marshalling_gen.marshalImportSnapshotFromS3Request(request, this.client.settings)
|
|
234
|
-
),
|
|
235
|
-
headers: jsonContentHeaders,
|
|
236
|
-
method: "POST",
|
|
237
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-s3`
|
|
238
|
-
},
|
|
239
|
-
marshalling_gen.unmarshalSnapshot
|
|
240
|
-
);
|
|
241
|
-
/**
|
|
242
|
-
* Import a snapshot from a Scaleway Object Storage bucket. The bucket must contain a QCOW2 image.
|
|
243
|
-
The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
|
|
244
|
-
*
|
|
245
|
-
* @param request - The request {@link ImportSnapshotFromObjectStorageRequest}
|
|
246
|
-
* @returns A Promise of Snapshot
|
|
247
|
-
*/
|
|
248
|
-
importSnapshotFromObjectStorage = (request) => this.client.fetch(
|
|
249
|
-
{
|
|
250
|
-
body: JSON.stringify(
|
|
251
|
-
marshalling_gen.marshalImportSnapshotFromObjectStorageRequest(
|
|
252
|
-
request,
|
|
253
|
-
this.client.settings
|
|
254
|
-
)
|
|
255
|
-
),
|
|
256
|
-
headers: jsonContentHeaders,
|
|
257
|
-
method: "POST",
|
|
258
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-object-storage`
|
|
259
|
-
},
|
|
260
|
-
marshalling_gen.unmarshalSnapshot
|
|
261
|
-
);
|
|
262
|
-
/**
|
|
263
|
-
* Export a snapshot to a Scaleway Object Storage bucket. The snapshot is exported in QCOW2 format.
|
|
264
|
-
The snapshot must not be in transient state.
|
|
265
|
-
*
|
|
266
|
-
* @param request - The request {@link ExportSnapshotToObjectStorageRequest}
|
|
267
|
-
* @returns A Promise of Snapshot
|
|
268
|
-
*/
|
|
269
|
-
exportSnapshotToObjectStorage = (request) => this.client.fetch(
|
|
270
|
-
{
|
|
271
|
-
body: JSON.stringify(
|
|
272
|
-
marshalling_gen.marshalExportSnapshotToObjectStorageRequest(
|
|
273
|
-
request,
|
|
274
|
-
this.client.settings
|
|
275
|
-
)
|
|
276
|
-
),
|
|
277
|
-
headers: jsonContentHeaders,
|
|
278
|
-
method: "POST",
|
|
279
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}/export-to-object-storage`
|
|
280
|
-
},
|
|
281
|
-
marshalling_gen.unmarshalSnapshot
|
|
282
|
-
);
|
|
283
|
-
/**
|
|
284
|
-
* Delete a snapshot. You must specify the `snapshot_id` of the snapshot you want to delete. The snapshot must not be in use.
|
|
285
|
-
*
|
|
286
|
-
* @param request - The request {@link DeleteSnapshotRequest}
|
|
287
|
-
*/
|
|
288
|
-
deleteSnapshot = (request) => this.client.fetch({
|
|
289
|
-
method: "DELETE",
|
|
290
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}`
|
|
291
|
-
});
|
|
292
|
-
/**
|
|
293
|
-
* Update a snapshot. Update the name or tags of the snapshot.
|
|
294
|
-
*
|
|
295
|
-
* @param request - The request {@link UpdateSnapshotRequest}
|
|
296
|
-
* @returns A Promise of Snapshot
|
|
297
|
-
*/
|
|
298
|
-
updateSnapshot = (request) => this.client.fetch(
|
|
299
|
-
{
|
|
300
|
-
body: JSON.stringify(
|
|
301
|
-
marshalling_gen.marshalUpdateSnapshotRequest(request, this.client.settings)
|
|
302
|
-
),
|
|
303
|
-
headers: jsonContentHeaders,
|
|
304
|
-
method: "PATCH",
|
|
305
|
-
path: `/block/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}`
|
|
306
|
-
},
|
|
307
|
-
marshalling_gen.unmarshalSnapshot
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
exports.API = API;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const REFERENCE_TRANSIENT_STATUSES = [
|
|
4
|
-
"attaching",
|
|
5
|
-
"detaching",
|
|
6
|
-
"creating"
|
|
7
|
-
];
|
|
8
|
-
const SNAPSHOT_TRANSIENT_STATUSES = [
|
|
9
|
-
"creating",
|
|
10
|
-
"deleting",
|
|
11
|
-
"exporting"
|
|
12
|
-
];
|
|
13
|
-
const VOLUME_TRANSIENT_STATUSES = [
|
|
14
|
-
"creating",
|
|
15
|
-
"deleting",
|
|
16
|
-
"resizing",
|
|
17
|
-
"snapshotting",
|
|
18
|
-
"updating"
|
|
19
|
-
];
|
|
20
|
-
exports.REFERENCE_TRANSIENT_STATUSES = REFERENCE_TRANSIENT_STATUSES;
|
|
21
|
-
exports.SNAPSHOT_TRANSIENT_STATUSES = SNAPSHOT_TRANSIENT_STATUSES;
|
|
22
|
-
exports.VOLUME_TRANSIENT_STATUSES = VOLUME_TRANSIENT_STATUSES;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const api_gen = require("./api.gen.cjs");
|
|
4
|
-
const content_gen = require("./content.gen.cjs");
|
|
5
|
-
const marshalling_gen = require("./marshalling.gen.cjs");
|
|
6
|
-
const validationRules_gen = require("./validation-rules.gen.cjs");
|
|
7
|
-
exports.API = api_gen.API;
|
|
8
|
-
exports.REFERENCE_TRANSIENT_STATUSES = content_gen.REFERENCE_TRANSIENT_STATUSES;
|
|
9
|
-
exports.SNAPSHOT_TRANSIENT_STATUSES = content_gen.SNAPSHOT_TRANSIENT_STATUSES;
|
|
10
|
-
exports.VOLUME_TRANSIENT_STATUSES = content_gen.VOLUME_TRANSIENT_STATUSES;
|
|
11
|
-
exports.marshalCreateSnapshotRequest = marshalling_gen.marshalCreateSnapshotRequest;
|
|
12
|
-
exports.marshalCreateVolumeRequest = marshalling_gen.marshalCreateVolumeRequest;
|
|
13
|
-
exports.marshalExportSnapshotToObjectStorageRequest = marshalling_gen.marshalExportSnapshotToObjectStorageRequest;
|
|
14
|
-
exports.marshalImportSnapshotFromObjectStorageRequest = marshalling_gen.marshalImportSnapshotFromObjectStorageRequest;
|
|
15
|
-
exports.marshalImportSnapshotFromS3Request = marshalling_gen.marshalImportSnapshotFromS3Request;
|
|
16
|
-
exports.marshalUpdateSnapshotRequest = marshalling_gen.marshalUpdateSnapshotRequest;
|
|
17
|
-
exports.marshalUpdateVolumeRequest = marshalling_gen.marshalUpdateVolumeRequest;
|
|
18
|
-
exports.unmarshalListSnapshotsResponse = marshalling_gen.unmarshalListSnapshotsResponse;
|
|
19
|
-
exports.unmarshalListVolumeTypesResponse = marshalling_gen.unmarshalListVolumeTypesResponse;
|
|
20
|
-
exports.unmarshalListVolumesResponse = marshalling_gen.unmarshalListVolumesResponse;
|
|
21
|
-
exports.unmarshalSnapshot = marshalling_gen.unmarshalSnapshot;
|
|
22
|
-
exports.unmarshalVolume = marshalling_gen.unmarshalVolume;
|
|
23
|
-
exports.ValidationRules = validationRules_gen;
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const randomName = require("@scaleway/random-name");
|
|
4
|
-
const sdkClient = require("@scaleway/sdk-client");
|
|
5
|
-
const unmarshalReference = (data) => {
|
|
6
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
7
|
-
throw new TypeError(
|
|
8
|
-
`Unmarshalling the type 'Reference' failed as data isn't a dictionary.`
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
return {
|
|
12
|
-
createdAt: sdkClient.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 (!sdkClient.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 (!sdkClient.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: sdkClient.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: sdkClient.unmarshalArrayOfObject(data.references, unmarshalReference),
|
|
47
|
-
size: data.size,
|
|
48
|
-
status: data.status,
|
|
49
|
-
tags: data.tags,
|
|
50
|
-
updatedAt: sdkClient.unmarshalDate(data.updated_at),
|
|
51
|
-
zone: data.zone
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
const unmarshalVolumeSpecifications = (data) => {
|
|
55
|
-
if (!sdkClient.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 (!sdkClient.isJSONObject(data)) {
|
|
67
|
-
throw new TypeError(
|
|
68
|
-
`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
73
|
-
id: data.id,
|
|
74
|
-
lastDetachedAt: sdkClient.unmarshalDate(data.last_detached_at),
|
|
75
|
-
name: data.name,
|
|
76
|
-
parentSnapshotId: data.parent_snapshot_id,
|
|
77
|
-
projectId: data.project_id,
|
|
78
|
-
references: sdkClient.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: sdkClient.unmarshalDate(data.updated_at),
|
|
85
|
-
zone: data.zone
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
const unmarshalListSnapshotsResponse = (data) => {
|
|
89
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
90
|
-
throw new TypeError(
|
|
91
|
-
`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
snapshots: sdkClient.unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
|
|
96
|
-
totalCount: data.total_count
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
const unmarshalVolumeType = (data) => {
|
|
100
|
-
if (!sdkClient.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 ? sdkClient.unmarshalMoney(data.pricing) : void 0,
|
|
107
|
-
snapshotPricing: data.snapshot_pricing ? sdkClient.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 (!sdkClient.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: sdkClient.unmarshalArrayOfObject(data.volume_types, unmarshalVolumeType)
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
const unmarshalListVolumesResponse = (data) => {
|
|
124
|
-
if (!sdkClient.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: sdkClient.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
|
-
...sdkClient.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
|
-
...sdkClient.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 marshalImportSnapshotFromS3Request = (request, defaults) => ({
|
|
178
|
-
bucket: request.bucket,
|
|
179
|
-
key: request.key,
|
|
180
|
-
name: request.name,
|
|
181
|
-
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
182
|
-
size: request.size,
|
|
183
|
-
tags: request.tags
|
|
184
|
-
});
|
|
185
|
-
const marshalUpdateSnapshotRequest = (request, defaults) => ({
|
|
186
|
-
name: request.name,
|
|
187
|
-
tags: request.tags
|
|
188
|
-
});
|
|
189
|
-
const marshalUpdateVolumeRequest = (request, defaults) => ({
|
|
190
|
-
name: request.name,
|
|
191
|
-
perf_iops: request.perfIops,
|
|
192
|
-
size: request.size,
|
|
193
|
-
tags: request.tags
|
|
194
|
-
});
|
|
195
|
-
exports.marshalCreateSnapshotRequest = marshalCreateSnapshotRequest;
|
|
196
|
-
exports.marshalCreateVolumeRequest = marshalCreateVolumeRequest;
|
|
197
|
-
exports.marshalExportSnapshotToObjectStorageRequest = marshalExportSnapshotToObjectStorageRequest;
|
|
198
|
-
exports.marshalImportSnapshotFromObjectStorageRequest = marshalImportSnapshotFromObjectStorageRequest;
|
|
199
|
-
exports.marshalImportSnapshotFromS3Request = marshalImportSnapshotFromS3Request;
|
|
200
|
-
exports.marshalUpdateSnapshotRequest = marshalUpdateSnapshotRequest;
|
|
201
|
-
exports.marshalUpdateVolumeRequest = marshalUpdateVolumeRequest;
|
|
202
|
-
exports.unmarshalListSnapshotsResponse = unmarshalListSnapshotsResponse;
|
|
203
|
-
exports.unmarshalListVolumeTypesResponse = unmarshalListVolumeTypesResponse;
|
|
204
|
-
exports.unmarshalListVolumesResponse = unmarshalListVolumesResponse;
|
|
205
|
-
exports.unmarshalSnapshot = unmarshalSnapshot;
|
|
206
|
-
exports.unmarshalVolume = unmarshalVolume;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const CreateSnapshotRequest = {
|
|
4
|
-
name: {
|
|
5
|
-
minLength: 1
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
const CreateVolumeRequest = {
|
|
9
|
-
name: {
|
|
10
|
-
minLength: 1
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const ImportSnapshotFromObjectStorageRequest = {
|
|
14
|
-
name: {
|
|
15
|
-
minLength: 1
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const ImportSnapshotFromS3Request = {
|
|
19
|
-
name: {
|
|
20
|
-
minLength: 1
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const ListSnapshotsRequest = {
|
|
24
|
-
page: {
|
|
25
|
-
greaterThan: 0
|
|
26
|
-
},
|
|
27
|
-
pageSize: {
|
|
28
|
-
greaterThan: 0,
|
|
29
|
-
lessThanOrEqual: 100
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const ListVolumeTypesRequest = {
|
|
33
|
-
page: {
|
|
34
|
-
greaterThan: 0
|
|
35
|
-
},
|
|
36
|
-
pageSize: {
|
|
37
|
-
greaterThan: 0,
|
|
38
|
-
lessThanOrEqual: 100
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const ListVolumesRequest = {
|
|
42
|
-
page: {
|
|
43
|
-
greaterThan: 0
|
|
44
|
-
},
|
|
45
|
-
pageSize: {
|
|
46
|
-
greaterThan: 0,
|
|
47
|
-
lessThanOrEqual: 100
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const Reference = {
|
|
51
|
-
productResourceType: {
|
|
52
|
-
minLength: 1
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
exports.CreateSnapshotRequest = CreateSnapshotRequest;
|
|
56
|
-
exports.CreateVolumeRequest = CreateVolumeRequest;
|
|
57
|
-
exports.ImportSnapshotFromObjectStorageRequest = ImportSnapshotFromObjectStorageRequest;
|
|
58
|
-
exports.ImportSnapshotFromS3Request = ImportSnapshotFromS3Request;
|
|
59
|
-
exports.ListSnapshotsRequest = ListSnapshotsRequest;
|
|
60
|
-
exports.ListVolumeTypesRequest = ListVolumeTypesRequest;
|
|
61
|
-
exports.ListVolumesRequest = ListVolumesRequest;
|
|
62
|
-
exports.Reference = Reference;
|