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