@scaleway/sdk 2.67.0 → 2.68.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 (108) hide show
  1. package/dist/api/audit_trail/v1alpha1/api.gen.cjs +5 -1
  2. package/dist/api/audit_trail/v1alpha1/api.gen.js +5 -1
  3. package/dist/api/audit_trail/v1alpha1/marshalling.gen.cjs +1 -0
  4. package/dist/api/audit_trail/v1alpha1/marshalling.gen.js +1 -0
  5. package/dist/api/audit_trail/v1alpha1/types.gen.d.ts +6 -2
  6. package/dist/api/baremetal/v1/api.gen.cjs +13 -0
  7. package/dist/api/baremetal/v1/api.gen.d.ts +8 -1
  8. package/dist/api/baremetal/v1/api.gen.js +13 -0
  9. package/dist/api/baremetal/v1/content.gen.cjs +2 -1
  10. package/dist/api/baremetal/v1/content.gen.js +2 -1
  11. package/dist/api/baremetal/v1/index.gen.d.ts +1 -1
  12. package/dist/api/baremetal/v1/marshalling.gen.cjs +1 -0
  13. package/dist/api/baremetal/v1/marshalling.gen.js +1 -0
  14. package/dist/api/baremetal/v1/types.gen.d.ts +9 -1
  15. package/dist/api/block/index.gen.cjs +4 -2
  16. package/dist/api/block/index.gen.d.ts +1 -0
  17. package/dist/api/block/index.gen.js +4 -2
  18. package/dist/api/block/v1/api.gen.cjs +303 -0
  19. package/dist/api/block/v1/api.gen.d.ts +152 -0
  20. package/dist/api/block/v1/api.gen.js +303 -0
  21. package/dist/api/block/v1/content.gen.cjs +22 -0
  22. package/dist/api/block/v1/content.gen.d.ts +7 -0
  23. package/dist/api/block/v1/content.gen.js +22 -0
  24. package/dist/api/block/v1/index.gen.cjs +10 -0
  25. package/dist/api/block/v1/index.gen.d.ts +4 -0
  26. package/dist/api/block/v1/index.gen.js +10 -0
  27. package/dist/api/block/v1/marshalling.gen.cjs +200 -0
  28. package/dist/api/block/v1/marshalling.gen.d.ts +14 -0
  29. package/dist/api/block/v1/marshalling.gen.js +200 -0
  30. package/dist/api/block/v1/types.gen.d.ts +335 -0
  31. package/dist/api/block/v1/validation-rules.gen.cjs +56 -0
  32. package/dist/api/block/v1/validation-rules.gen.d.ts +47 -0
  33. package/dist/api/block/v1/validation-rules.gen.js +56 -0
  34. package/dist/api/block/v1alpha1/api.gen.cjs +1 -0
  35. package/dist/api/block/v1alpha1/api.gen.js +1 -0
  36. package/dist/api/block/v1alpha1/types.gen.d.ts +5 -0
  37. package/dist/api/edge_services/index.gen.cjs +2 -0
  38. package/dist/api/edge_services/index.gen.d.ts +1 -0
  39. package/dist/api/edge_services/index.gen.js +3 -1
  40. package/dist/api/edge_services/v1beta1/api.gen.cjs +941 -0
  41. package/dist/api/edge_services/v1beta1/api.gen.d.ts +454 -0
  42. package/dist/api/edge_services/v1beta1/api.gen.js +941 -0
  43. package/dist/api/edge_services/v1beta1/content.gen.cjs +8 -0
  44. package/dist/api/edge_services/v1beta1/content.gen.d.ts +5 -0
  45. package/dist/api/edge_services/v1beta1/content.gen.js +8 -0
  46. package/dist/api/{webhosting/v1alpha1 → edge_services/v1beta1}/index.gen.cjs +2 -2
  47. package/dist/api/edge_services/v1beta1/index.gen.d.ts +4 -0
  48. package/dist/api/edge_services/v1beta1/index.gen.js +9 -0
  49. package/dist/api/edge_services/v1beta1/marshalling.gen.cjs +808 -0
  50. package/dist/api/edge_services/v1beta1/marshalling.gen.d.ts +53 -0
  51. package/dist/api/edge_services/v1beta1/marshalling.gen.js +808 -0
  52. package/dist/api/edge_services/v1beta1/types.gen.d.ts +1218 -0
  53. package/dist/api/edge_services/v1beta1/validation-rules.gen.cjs +23 -0
  54. package/dist/api/edge_services/v1beta1/validation-rules.gen.d.ts +18 -0
  55. package/dist/api/edge_services/v1beta1/validation-rules.gen.js +23 -0
  56. package/dist/api/instance/v1/api.gen.cjs +18 -0
  57. package/dist/api/instance/v1/api.gen.d.ts +13 -1
  58. package/dist/api/instance/v1/api.gen.js +19 -1
  59. package/dist/api/instance/v1/index.gen.d.ts +1 -1
  60. package/dist/api/instance/v1/marshalling.gen.cjs +12 -0
  61. package/dist/api/instance/v1/marshalling.gen.d.ts +2 -1
  62. package/dist/api/instance/v1/marshalling.gen.js +12 -0
  63. package/dist/api/instance/v1/types.gen.d.ts +12 -0
  64. package/dist/api/lb/v1/marshalling.gen.cjs +2 -0
  65. package/dist/api/lb/v1/marshalling.gen.js +2 -0
  66. package/dist/api/lb/v1/types.gen.d.ts +2 -0
  67. package/dist/api/mongodb/v1alpha1/api.gen.cjs +11 -0
  68. package/dist/api/mongodb/v1alpha1/api.gen.d.ts +2 -1
  69. package/dist/api/mongodb/v1alpha1/api.gen.js +12 -1
  70. package/dist/api/mongodb/v1alpha1/index.gen.d.ts +1 -1
  71. package/dist/api/mongodb/v1alpha1/marshalling.gen.cjs +26 -1
  72. package/dist/api/mongodb/v1alpha1/marshalling.gen.d.ts +2 -1
  73. package/dist/api/mongodb/v1alpha1/marshalling.gen.js +26 -1
  74. package/dist/api/mongodb/v1alpha1/types.gen.d.ts +29 -0
  75. package/dist/api/mongodb/v1alpha1/validation-rules.gen.cjs +8 -0
  76. package/dist/api/mongodb/v1alpha1/validation-rules.gen.d.ts +7 -0
  77. package/dist/api/mongodb/v1alpha1/validation-rules.gen.js +8 -0
  78. package/dist/api/webhosting/index.gen.cjs +0 -2
  79. package/dist/api/webhosting/index.gen.d.ts +0 -1
  80. package/dist/api/webhosting/index.gen.js +1 -3
  81. package/dist/api/webhosting/v1/content.gen.cjs +0 -6
  82. package/dist/api/webhosting/v1/content.gen.d.ts +1 -3
  83. package/dist/api/webhosting/v1/content.gen.js +0 -6
  84. package/dist/api/webhosting/v1/index.gen.cjs +0 -1
  85. package/dist/api/webhosting/v1/index.gen.d.ts +1 -1
  86. package/dist/api/webhosting/v1/index.gen.js +1 -2
  87. package/dist/api/webhosting/v1/marshalling.gen.cjs +1 -2
  88. package/dist/api/webhosting/v1/marshalling.gen.js +1 -2
  89. package/dist/api/webhosting/v1/types.gen.d.ts +3 -6
  90. package/dist/scw/constants.cjs +1 -1
  91. package/dist/scw/constants.d.ts +2 -2
  92. package/dist/scw/constants.js +1 -1
  93. package/package.json +2 -2
  94. package/dist/api/webhosting/v1alpha1/api.gen.cjs +0 -339
  95. package/dist/api/webhosting/v1alpha1/api.gen.d.ts +0 -168
  96. package/dist/api/webhosting/v1alpha1/api.gen.js +0 -339
  97. package/dist/api/webhosting/v1alpha1/content.gen.cjs +0 -8
  98. package/dist/api/webhosting/v1alpha1/content.gen.d.ts +0 -3
  99. package/dist/api/webhosting/v1alpha1/content.gen.js +0 -8
  100. package/dist/api/webhosting/v1alpha1/index.gen.d.ts +0 -4
  101. package/dist/api/webhosting/v1alpha1/index.gen.js +0 -9
  102. package/dist/api/webhosting/v1alpha1/marshalling.gen.cjs +0 -300
  103. package/dist/api/webhosting/v1alpha1/marshalling.gen.d.ts +0 -17
  104. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +0 -300
  105. package/dist/api/webhosting/v1alpha1/types.gen.d.ts +0 -480
  106. package/dist/api/webhosting/v1alpha1/validation-rules.gen.cjs +0 -32
  107. package/dist/api/webhosting/v1alpha1/validation-rules.gen.d.ts +0 -27
  108. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +0 -32
@@ -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
+ }
@@ -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
+ };