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