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