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