@scaleway/sdk-block 2.6.0 → 2.7.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.
- package/dist/.vite/license.md +3 -0
- package/dist/metadata.gen.d.ts +6 -6
- package/dist/metadata.gen.js +6 -2
- package/dist/v1/api.gen.d.ts +2 -2
- package/dist/v1/api.gen.js +89 -183
- package/dist/v1/content.gen.js +3 -3
- package/dist/v1/marshalling.gen.js +17 -17
- package/dist/v1/metadata.gen.js +1 -1
- package/dist/v1/validation-rules.gen.js +7 -7
- package/dist/v1alpha1/api.gen.d.ts +2 -2
- package/dist/v1alpha1/api.gen.js +95 -198
- package/dist/v1alpha1/content.gen.js +3 -3
- package/dist/v1alpha1/marshalling.gen.js +18 -18
- package/dist/v1alpha1/metadata.gen.js +1 -1
- package/dist/v1alpha1/validation-rules.gen.js +8 -8
- package/package.json +8 -6
- package/LICENSE +0 -191
- package/dist/metadata.gen.json +0 -6
- package/dist/metadata2.gen.js +0 -8
package/dist/metadata.gen.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* This file is automatically generated
|
|
3
3
|
* PLEASE DO NOT EDIT HERE
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
name:
|
|
7
|
-
namespace:
|
|
8
|
-
displayName:
|
|
9
|
-
versions:
|
|
5
|
+
export declare const pkgMetadata: {
|
|
6
|
+
readonly name: "@scaleway/sdk-block";
|
|
7
|
+
readonly namespace: "block";
|
|
8
|
+
readonly displayName: "Block";
|
|
9
|
+
readonly versions: readonly ["v1", "v1alpha1"];
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type Metadata = typeof pkgMetadata;
|
|
12
12
|
export default pkgMetadata;
|
package/dist/metadata.gen.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import metadata_gen_default from "./metadata2.gen.js";
|
|
2
1
|
//#region src/metadata.gen.ts
|
|
3
2
|
/**
|
|
4
3
|
* This file is automatically generated
|
|
5
4
|
* PLEASE DO NOT EDIT HERE
|
|
6
5
|
*/
|
|
7
|
-
|
|
6
|
+
const pkgMetadata = {
|
|
7
|
+
name: "@scaleway/sdk-block",
|
|
8
|
+
namespace: "block",
|
|
9
|
+
displayName: "Block",
|
|
10
|
+
versions: ["v1", "v1alpha1"]
|
|
11
|
+
};
|
|
8
12
|
//#endregion
|
|
9
13
|
export { pkgMetadata as default, pkgMetadata };
|
package/dist/v1/api.gen.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export declare class API extends ParentAPI {
|
|
|
56
56
|
* @param options - The waiting options
|
|
57
57
|
* @returns A Promise of Volume
|
|
58
58
|
*/
|
|
59
|
-
waitForVolume: (request: Readonly<GetVolumeRequest>, options?: Readonly<WaitForOptions<Volume>>) => Promise<Volume>;
|
|
59
|
+
waitForVolume: (request: Readonly<GetVolumeRequest>, options?: Readonly<WaitForOptions<Volume>> | undefined) => Promise<Volume>;
|
|
60
60
|
/**
|
|
61
61
|
* Delete a detached volume. You must specify the `volume_id` of the volume you want to delete. The volume must not be in the `in_use` status.
|
|
62
62
|
*
|
|
@@ -96,7 +96,7 @@ export declare class API extends ParentAPI {
|
|
|
96
96
|
* @param options - The waiting options
|
|
97
97
|
* @returns A Promise of Snapshot
|
|
98
98
|
*/
|
|
99
|
-
waitForSnapshot: (request: Readonly<GetSnapshotRequest>, options?: Readonly<WaitForOptions<Snapshot>>) => Promise<Snapshot>;
|
|
99
|
+
waitForSnapshot: (request: Readonly<GetSnapshotRequest>, options?: Readonly<WaitForOptions<Snapshot>> | undefined) => Promise<Snapshot>;
|
|
100
100
|
/**
|
|
101
101
|
* Create a snapshot of a volume. To create a snapshot, the volume must be in the `in_use` or the `available` status.
|
|
102
102
|
If your volume is in a transient state, you need to wait until the end of the current operation.
|
package/dist/v1/api.gen.js
CHANGED
|
@@ -2,195 +2,101 @@ import { SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES } from "./conten
|
|
|
2
2
|
import { marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotToObjectStorageRequest, marshalImportSnapshotFromObjectStorageRequest, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, unmarshalSnapshot, unmarshalVolume } from "./marshalling.gen.js";
|
|
3
3
|
import { API as API$1, enrichForPagination, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
|
|
4
4
|
//#region src/v1/api.gen.ts
|
|
5
|
-
|
|
5
|
+
const jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
|
|
6
6
|
/**
|
|
7
7
|
* Block Storage API.
|
|
8
8
|
|
|
9
9
|
This API allows you to manage your Block Storage volumes.
|
|
10
10
|
*/
|
|
11
11
|
var API = class extends API$1 {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
headers: jsonContentHeaders,
|
|
101
|
-
method: "PATCH",
|
|
102
|
-
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam("volumeId", request.volumeId)}`
|
|
103
|
-
}, unmarshalVolume);
|
|
104
|
-
pageOfListSnapshots = (request) => this.client.fetch({
|
|
105
|
-
method: "GET",
|
|
106
|
-
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`,
|
|
107
|
-
urlParams: urlParams(["include_deleted", request.includeDeleted], ["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["tags", request.tags], ["volume_id", request.volumeId])
|
|
108
|
-
}, unmarshalListSnapshotsResponse);
|
|
109
|
-
/**
|
|
110
|
-
* List all snapshots. List all available snapshots in a specified zone. By default, the snapshots listed are ordered by creation date in ascending order. This can be modified via the `order_by` field.
|
|
111
|
-
*
|
|
112
|
-
* @param request - The request {@link ListSnapshotsRequest}
|
|
113
|
-
* @returns A Promise of ListSnapshotsResponse
|
|
114
|
-
*/
|
|
115
|
-
listSnapshots = (request) => enrichForPagination("snapshots", this.pageOfListSnapshots, request);
|
|
116
|
-
/**
|
|
117
|
-
* Get a snapshot. Retrieve technical information about a specific snapshot. Details such as size, volume type, and status are returned in the response.
|
|
118
|
-
*
|
|
119
|
-
* @param request - The request {@link GetSnapshotRequest}
|
|
120
|
-
* @returns A Promise of Snapshot
|
|
121
|
-
*/
|
|
122
|
-
getSnapshot = (request) => this.client.fetch({
|
|
123
|
-
method: "GET",
|
|
124
|
-
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
|
|
125
|
-
}, unmarshalSnapshot);
|
|
126
|
-
/**
|
|
127
|
-
* Waits for {@link Snapshot} to be in a final state.
|
|
128
|
-
*
|
|
129
|
-
* @param request - The request {@link GetSnapshotRequest}
|
|
130
|
-
* @param options - The waiting options
|
|
131
|
-
* @returns A Promise of Snapshot
|
|
132
|
-
*/
|
|
133
|
-
waitForSnapshot = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!SNAPSHOT_TRANSIENT_STATUSES.includes(res.status))), this.getSnapshot, request, options);
|
|
134
|
-
/**
|
|
135
|
-
* Create a snapshot of a volume. To create a snapshot, the volume must be in the `in_use` or the `available` status.
|
|
136
|
-
If your volume is in a transient state, you need to wait until the end of the current operation.
|
|
137
|
-
*
|
|
138
|
-
* @param request - The request {@link CreateSnapshotRequest}
|
|
139
|
-
* @returns A Promise of Snapshot
|
|
140
|
-
*/
|
|
141
|
-
createSnapshot = (request) => this.client.fetch({
|
|
142
|
-
body: JSON.stringify(marshalCreateSnapshotRequest(request, this.client.settings)),
|
|
143
|
-
headers: jsonContentHeaders,
|
|
144
|
-
method: "POST",
|
|
145
|
-
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`
|
|
146
|
-
}, unmarshalSnapshot);
|
|
147
|
-
/**
|
|
148
|
-
* Import a snapshot from a Scaleway Object Storage bucket. The bucket must contain a QCOW2 image.
|
|
149
|
-
The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
|
|
150
|
-
*
|
|
151
|
-
* @param request - The request {@link ImportSnapshotFromObjectStorageRequest}
|
|
152
|
-
* @returns A Promise of Snapshot
|
|
153
|
-
*/
|
|
154
|
-
importSnapshotFromObjectStorage = (request) => this.client.fetch({
|
|
155
|
-
body: JSON.stringify(marshalImportSnapshotFromObjectStorageRequest(request, this.client.settings)),
|
|
156
|
-
headers: jsonContentHeaders,
|
|
157
|
-
method: "POST",
|
|
158
|
-
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-object-storage`
|
|
159
|
-
}, unmarshalSnapshot);
|
|
160
|
-
/**
|
|
161
|
-
* Export a snapshot to a Scaleway Object Storage bucket. The snapshot is exported in QCOW2 format.
|
|
162
|
-
The snapshot must not be in transient state.
|
|
163
|
-
*
|
|
164
|
-
* @param request - The request {@link ExportSnapshotToObjectStorageRequest}
|
|
165
|
-
* @returns A Promise of Snapshot
|
|
166
|
-
*/
|
|
167
|
-
exportSnapshotToObjectStorage = (request) => this.client.fetch({
|
|
168
|
-
body: JSON.stringify(marshalExportSnapshotToObjectStorageRequest(request, this.client.settings)),
|
|
169
|
-
headers: jsonContentHeaders,
|
|
170
|
-
method: "POST",
|
|
171
|
-
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}/export-to-object-storage`
|
|
172
|
-
}, unmarshalSnapshot);
|
|
173
|
-
/**
|
|
174
|
-
* Delete a snapshot. You must specify the `snapshot_id` of the snapshot you want to delete. The snapshot must not be in use.
|
|
175
|
-
*
|
|
176
|
-
* @param request - The request {@link DeleteSnapshotRequest}
|
|
177
|
-
*/
|
|
178
|
-
deleteSnapshot = (request) => this.client.fetch({
|
|
179
|
-
method: "DELETE",
|
|
180
|
-
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
|
|
181
|
-
});
|
|
182
|
-
/**
|
|
183
|
-
* Update a snapshot. Update the name or tags of the snapshot.
|
|
184
|
-
*
|
|
185
|
-
* @param request - The request {@link UpdateSnapshotRequest}
|
|
186
|
-
* @returns A Promise of Snapshot
|
|
187
|
-
*/
|
|
188
|
-
updateSnapshot = (request) => this.client.fetch({
|
|
189
|
-
body: JSON.stringify(marshalUpdateSnapshotRequest(request, this.client.settings)),
|
|
190
|
-
headers: jsonContentHeaders,
|
|
191
|
-
method: "PATCH",
|
|
192
|
-
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
|
|
193
|
-
}, unmarshalSnapshot);
|
|
12
|
+
constructor(..._args) {
|
|
13
|
+
super(..._args);
|
|
14
|
+
this.pageOfListVolumeTypes = (request = {}) => this.client.fetch({
|
|
15
|
+
method: "GET",
|
|
16
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volume-types`,
|
|
17
|
+
urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
|
|
18
|
+
}, unmarshalListVolumeTypesResponse);
|
|
19
|
+
this.listVolumeTypes = (request = {}) => enrichForPagination("volumeTypes", this.pageOfListVolumeTypes, request);
|
|
20
|
+
this.pageOfListVolumes = (request) => this.client.fetch({
|
|
21
|
+
method: "GET",
|
|
22
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`,
|
|
23
|
+
urlParams: urlParams(["include_deleted", request.includeDeleted], ["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["product_resource_id", request.productResourceId], ["project_id", request.projectId], ["tags", request.tags], ["volume_ids", request.volumeIds], ["volume_type", request.volumeType])
|
|
24
|
+
}, unmarshalListVolumesResponse);
|
|
25
|
+
this.listVolumes = (request) => enrichForPagination("volumes", this.pageOfListVolumes, request);
|
|
26
|
+
this.createVolume = (request = {}) => this.client.fetch({
|
|
27
|
+
body: JSON.stringify(marshalCreateVolumeRequest(request, this.client.settings)),
|
|
28
|
+
headers: jsonContentHeaders,
|
|
29
|
+
method: "POST",
|
|
30
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`
|
|
31
|
+
}, unmarshalVolume);
|
|
32
|
+
this.getVolume = (request) => this.client.fetch({
|
|
33
|
+
method: "GET",
|
|
34
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam("volumeId", request.volumeId)}`
|
|
35
|
+
}, unmarshalVolume);
|
|
36
|
+
this.waitForVolume = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!VOLUME_TRANSIENT_STATUSES.includes(res.status))), this.getVolume, request, options);
|
|
37
|
+
this.deleteVolume = (request) => this.client.fetch({
|
|
38
|
+
method: "DELETE",
|
|
39
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam("volumeId", request.volumeId)}`
|
|
40
|
+
});
|
|
41
|
+
this.updateVolume = (request) => this.client.fetch({
|
|
42
|
+
body: JSON.stringify(marshalUpdateVolumeRequest(request, this.client.settings)),
|
|
43
|
+
headers: jsonContentHeaders,
|
|
44
|
+
method: "PATCH",
|
|
45
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam("volumeId", request.volumeId)}`
|
|
46
|
+
}, unmarshalVolume);
|
|
47
|
+
this.pageOfListSnapshots = (request) => this.client.fetch({
|
|
48
|
+
method: "GET",
|
|
49
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`,
|
|
50
|
+
urlParams: urlParams(["include_deleted", request.includeDeleted], ["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["tags", request.tags], ["volume_id", request.volumeId])
|
|
51
|
+
}, unmarshalListSnapshotsResponse);
|
|
52
|
+
this.listSnapshots = (request) => enrichForPagination("snapshots", this.pageOfListSnapshots, request);
|
|
53
|
+
this.getSnapshot = (request) => this.client.fetch({
|
|
54
|
+
method: "GET",
|
|
55
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
|
|
56
|
+
}, unmarshalSnapshot);
|
|
57
|
+
this.waitForSnapshot = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!SNAPSHOT_TRANSIENT_STATUSES.includes(res.status))), this.getSnapshot, request, options);
|
|
58
|
+
this.createSnapshot = (request) => this.client.fetch({
|
|
59
|
+
body: JSON.stringify(marshalCreateSnapshotRequest(request, this.client.settings)),
|
|
60
|
+
headers: jsonContentHeaders,
|
|
61
|
+
method: "POST",
|
|
62
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`
|
|
63
|
+
}, unmarshalSnapshot);
|
|
64
|
+
this.importSnapshotFromObjectStorage = (request) => this.client.fetch({
|
|
65
|
+
body: JSON.stringify(marshalImportSnapshotFromObjectStorageRequest(request, this.client.settings)),
|
|
66
|
+
headers: jsonContentHeaders,
|
|
67
|
+
method: "POST",
|
|
68
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-object-storage`
|
|
69
|
+
}, unmarshalSnapshot);
|
|
70
|
+
this.exportSnapshotToObjectStorage = (request) => this.client.fetch({
|
|
71
|
+
body: JSON.stringify(marshalExportSnapshotToObjectStorageRequest(request, this.client.settings)),
|
|
72
|
+
headers: jsonContentHeaders,
|
|
73
|
+
method: "POST",
|
|
74
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}/export-to-object-storage`
|
|
75
|
+
}, unmarshalSnapshot);
|
|
76
|
+
this.deleteSnapshot = (request) => this.client.fetch({
|
|
77
|
+
method: "DELETE",
|
|
78
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
|
|
79
|
+
});
|
|
80
|
+
this.updateSnapshot = (request) => this.client.fetch({
|
|
81
|
+
body: JSON.stringify(marshalUpdateSnapshotRequest(request, this.client.settings)),
|
|
82
|
+
headers: jsonContentHeaders,
|
|
83
|
+
method: "PATCH",
|
|
84
|
+
path: `/block/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
|
|
85
|
+
}, unmarshalSnapshot);
|
|
86
|
+
}
|
|
87
|
+
static {
|
|
88
|
+
this.LOCALITY = toApiLocality({ zones: [
|
|
89
|
+
"fr-par-1",
|
|
90
|
+
"fr-par-2",
|
|
91
|
+
"fr-par-3",
|
|
92
|
+
"nl-ams-1",
|
|
93
|
+
"nl-ams-2",
|
|
94
|
+
"nl-ams-3",
|
|
95
|
+
"pl-waw-1",
|
|
96
|
+
"pl-waw-2",
|
|
97
|
+
"pl-waw-3"
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
194
100
|
};
|
|
195
101
|
//#endregion
|
|
196
102
|
export { API };
|
package/dist/v1/content.gen.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
//#region src/v1/content.gen.ts
|
|
2
2
|
/** Lists transient statutes of the enum {@link ReferenceStatus}. */
|
|
3
|
-
|
|
3
|
+
const REFERENCE_TRANSIENT_STATUSES = [
|
|
4
4
|
"attaching",
|
|
5
5
|
"detaching",
|
|
6
6
|
"creating"
|
|
7
7
|
];
|
|
8
8
|
/** Lists transient statutes of the enum {@link SnapshotStatus}. */
|
|
9
|
-
|
|
9
|
+
const SNAPSHOT_TRANSIENT_STATUSES = [
|
|
10
10
|
"creating",
|
|
11
11
|
"deleting",
|
|
12
12
|
"exporting"
|
|
13
13
|
];
|
|
14
14
|
/** Lists transient statutes of the enum {@link VolumeStatus}. */
|
|
15
|
-
|
|
15
|
+
const VOLUME_TRANSIENT_STATUSES = [
|
|
16
16
|
"creating",
|
|
17
17
|
"deleting",
|
|
18
18
|
"resizing",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney } from "@scaleway/sdk-client";
|
|
2
2
|
import randomName from "@scaleway/random-name";
|
|
3
3
|
//#region src/v1/marshalling.gen.ts
|
|
4
|
-
|
|
4
|
+
const unmarshalReference = (data) => {
|
|
5
5
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Reference' failed as data isn't a dictionary.`);
|
|
6
6
|
return {
|
|
7
7
|
createdAt: unmarshalDate(data.created_at),
|
|
@@ -12,7 +12,7 @@ var unmarshalReference = (data) => {
|
|
|
12
12
|
type: data.type
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
const unmarshalSnapshotParentVolume = (data) => {
|
|
16
16
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`);
|
|
17
17
|
return {
|
|
18
18
|
id: data.id,
|
|
@@ -21,7 +21,7 @@ var unmarshalSnapshotParentVolume = (data) => {
|
|
|
21
21
|
type: data.type
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
const unmarshalSnapshot = (data) => {
|
|
25
25
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`);
|
|
26
26
|
return {
|
|
27
27
|
class: data.class,
|
|
@@ -39,14 +39,14 @@ var unmarshalSnapshot = (data) => {
|
|
|
39
39
|
zone: data.zone
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
const unmarshalVolumeSpecifications = (data) => {
|
|
43
43
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`);
|
|
44
44
|
return {
|
|
45
45
|
class: data.class,
|
|
46
46
|
perfIops: data.perf_iops
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
const unmarshalVolume = (data) => {
|
|
50
50
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
|
|
51
51
|
return {
|
|
52
52
|
createdAt: unmarshalDate(data.created_at),
|
|
@@ -65,14 +65,14 @@ var unmarshalVolume = (data) => {
|
|
|
65
65
|
zone: data.zone
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
const unmarshalListSnapshotsResponse = (data) => {
|
|
69
69
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
|
|
70
70
|
return {
|
|
71
71
|
snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
|
|
72
72
|
totalCount: data.total_count
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
|
-
|
|
75
|
+
const unmarshalVolumeType = (data) => {
|
|
76
76
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`);
|
|
77
77
|
return {
|
|
78
78
|
pricing: data.pricing ? unmarshalMoney(data.pricing) : void 0,
|
|
@@ -81,33 +81,33 @@ var unmarshalVolumeType = (data) => {
|
|
|
81
81
|
type: data.type
|
|
82
82
|
};
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
const unmarshalListVolumeTypesResponse = (data) => {
|
|
85
85
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVolumeTypesResponse' failed as data isn't a dictionary.`);
|
|
86
86
|
return {
|
|
87
87
|
totalCount: data.total_count,
|
|
88
88
|
volumeTypes: unmarshalArrayOfObject(data.volume_types, unmarshalVolumeType)
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
const unmarshalListVolumesResponse = (data) => {
|
|
92
92
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`);
|
|
93
93
|
return {
|
|
94
94
|
totalCount: data.total_count,
|
|
95
95
|
volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
|
-
|
|
98
|
+
const marshalCreateSnapshotRequest = (request, defaults) => ({
|
|
99
99
|
name: request.name || randomName("snp"),
|
|
100
100
|
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
101
101
|
public: request.public,
|
|
102
102
|
tags: request.tags,
|
|
103
103
|
volume_id: request.volumeId
|
|
104
104
|
});
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const marshalCreateVolumeRequestFromEmpty = (request, defaults) => ({ size: request.size });
|
|
106
|
+
const marshalCreateVolumeRequestFromSnapshot = (request, defaults) => ({
|
|
107
107
|
size: request.size,
|
|
108
108
|
snapshot_id: request.snapshotId
|
|
109
109
|
});
|
|
110
|
-
|
|
110
|
+
const marshalCreateVolumeRequest = (request, defaults) => ({
|
|
111
111
|
name: request.name || randomName("vol"),
|
|
112
112
|
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
113
113
|
tags: request.tags,
|
|
@@ -123,11 +123,11 @@ var marshalCreateVolumeRequest = (request, defaults) => ({
|
|
|
123
123
|
value: request.perfIops
|
|
124
124
|
}])
|
|
125
125
|
});
|
|
126
|
-
|
|
126
|
+
const marshalExportSnapshotToObjectStorageRequest = (request, defaults) => ({
|
|
127
127
|
bucket: request.bucket,
|
|
128
128
|
key: request.key
|
|
129
129
|
});
|
|
130
|
-
|
|
130
|
+
const marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
|
|
131
131
|
bucket: request.bucket,
|
|
132
132
|
key: request.key,
|
|
133
133
|
name: request.name,
|
|
@@ -135,12 +135,12 @@ var marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
|
|
|
135
135
|
size: request.size,
|
|
136
136
|
tags: request.tags
|
|
137
137
|
});
|
|
138
|
-
|
|
138
|
+
const marshalUpdateSnapshotRequest = (request, defaults) => ({
|
|
139
139
|
name: request.name,
|
|
140
140
|
public: request.public,
|
|
141
141
|
tags: request.tags
|
|
142
142
|
});
|
|
143
|
-
|
|
143
|
+
const marshalUpdateVolumeRequest = (request, defaults) => ({
|
|
144
144
|
name: request.name,
|
|
145
145
|
perf_iops: request.perfIops,
|
|
146
146
|
size: request.size,
|
package/dist/v1/metadata.gen.js
CHANGED
|
@@ -9,30 +9,30 @@ var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({
|
|
|
9
9
|
ListVolumesRequest: () => ListVolumesRequest,
|
|
10
10
|
Reference: () => Reference
|
|
11
11
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const CreateSnapshotRequest = { name: { minLength: 1 } };
|
|
13
|
+
const CreateVolumeRequest = { name: { minLength: 1 } };
|
|
14
|
+
const ImportSnapshotFromObjectStorageRequest = { name: { minLength: 1 } };
|
|
15
|
+
const ListSnapshotsRequest = {
|
|
16
16
|
page: { greaterThan: 0 },
|
|
17
17
|
pageSize: {
|
|
18
18
|
greaterThan: 0,
|
|
19
19
|
lessThanOrEqual: 100
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
const ListVolumeTypesRequest = {
|
|
23
23
|
page: { greaterThan: 0 },
|
|
24
24
|
pageSize: {
|
|
25
25
|
greaterThan: 0,
|
|
26
26
|
lessThanOrEqual: 100
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
const ListVolumesRequest = {
|
|
30
30
|
page: { greaterThan: 0 },
|
|
31
31
|
pageSize: {
|
|
32
32
|
greaterThan: 0,
|
|
33
33
|
lessThanOrEqual: 100
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
const Reference = { productResourceType: { minLength: 1 } };
|
|
37
37
|
//#endregion
|
|
38
38
|
export { CreateSnapshotRequest, CreateVolumeRequest, ImportSnapshotFromObjectStorageRequest, ListSnapshotsRequest, ListVolumeTypesRequest, ListVolumesRequest, Reference, validation_rules_gen_exports };
|
|
@@ -56,7 +56,7 @@ export declare class API extends ParentAPI {
|
|
|
56
56
|
* @param options - The waiting options
|
|
57
57
|
* @returns A Promise of Volume
|
|
58
58
|
*/
|
|
59
|
-
waitForVolume: (request: Readonly<GetVolumeRequest>, options?: Readonly<WaitForOptions<Volume>>) => Promise<Volume>;
|
|
59
|
+
waitForVolume: (request: Readonly<GetVolumeRequest>, options?: Readonly<WaitForOptions<Volume>> | undefined) => Promise<Volume>;
|
|
60
60
|
/**
|
|
61
61
|
* Delete a detached volume. You must specify the `volume_id` of the volume you want to delete. The volume must not be in the `in_use` status.
|
|
62
62
|
*
|
|
@@ -96,7 +96,7 @@ export declare class API extends ParentAPI {
|
|
|
96
96
|
* @param options - The waiting options
|
|
97
97
|
* @returns A Promise of Snapshot
|
|
98
98
|
*/
|
|
99
|
-
waitForSnapshot: (request: Readonly<GetSnapshotRequest>, options?: Readonly<WaitForOptions<Snapshot>>) => Promise<Snapshot>;
|
|
99
|
+
waitForSnapshot: (request: Readonly<GetSnapshotRequest>, options?: Readonly<WaitForOptions<Snapshot>> | undefined) => Promise<Snapshot>;
|
|
100
100
|
/**
|
|
101
101
|
* Create a snapshot of a volume. To create a snapshot, the volume must be in the `in_use` or the `available` status.
|
|
102
102
|
If your volume is in a transient state, you need to wait until the end of the current operation.
|