@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/v1alpha1/api.gen.js
CHANGED
|
@@ -2,210 +2,107 @@ import { SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES } from "./conten
|
|
|
2
2
|
import { marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotToObjectStorageRequest, marshalImportSnapshotFromObjectStorageRequest, marshalImportSnapshotFromS3Request, 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/v1alpha1/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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`,
|
|
107
|
-
urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["tags", request.tags], ["volume_id", request.volumeId])
|
|
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/v1alpha1/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/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`
|
|
146
|
-
}, unmarshalSnapshot);
|
|
147
|
-
/**
|
|
148
|
-
* (Deprecated in favor of `ImportSnapshotFromObjectStorage`). Import a snapshot from a Scaleway Object Storage bucket
|
|
149
|
-
The bucket must contain a QCOW2 image.
|
|
150
|
-
The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
|
|
151
|
-
*
|
|
152
|
-
* @deprecated
|
|
153
|
-
* @param request - The request {@link ImportSnapshotFromS3Request}
|
|
154
|
-
* @returns A Promise of Snapshot
|
|
155
|
-
*/
|
|
156
|
-
importSnapshotFromS3 = (request) => this.client.fetch({
|
|
157
|
-
body: JSON.stringify(marshalImportSnapshotFromS3Request(request, this.client.settings)),
|
|
158
|
-
headers: jsonContentHeaders,
|
|
159
|
-
method: "POST",
|
|
160
|
-
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-s3`
|
|
161
|
-
}, unmarshalSnapshot);
|
|
162
|
-
/**
|
|
163
|
-
* Import a snapshot from a Scaleway Object Storage bucket. The bucket must contain a QCOW2 image.
|
|
164
|
-
The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
|
|
165
|
-
*
|
|
166
|
-
* @param request - The request {@link ImportSnapshotFromObjectStorageRequest}
|
|
167
|
-
* @returns A Promise of Snapshot
|
|
168
|
-
*/
|
|
169
|
-
importSnapshotFromObjectStorage = (request) => this.client.fetch({
|
|
170
|
-
body: JSON.stringify(marshalImportSnapshotFromObjectStorageRequest(request, this.client.settings)),
|
|
171
|
-
headers: jsonContentHeaders,
|
|
172
|
-
method: "POST",
|
|
173
|
-
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-object-storage`
|
|
174
|
-
}, unmarshalSnapshot);
|
|
175
|
-
/**
|
|
176
|
-
* Export a snapshot to a Scaleway Object Storage bucket. The snapshot is exported in QCOW2 format.
|
|
177
|
-
The snapshot must not be in transient state.
|
|
178
|
-
*
|
|
179
|
-
* @param request - The request {@link ExportSnapshotToObjectStorageRequest}
|
|
180
|
-
* @returns A Promise of Snapshot
|
|
181
|
-
*/
|
|
182
|
-
exportSnapshotToObjectStorage = (request) => this.client.fetch({
|
|
183
|
-
body: JSON.stringify(marshalExportSnapshotToObjectStorageRequest(request, this.client.settings)),
|
|
184
|
-
headers: jsonContentHeaders,
|
|
185
|
-
method: "POST",
|
|
186
|
-
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}/export-to-object-storage`
|
|
187
|
-
}, unmarshalSnapshot);
|
|
188
|
-
/**
|
|
189
|
-
* Delete a snapshot. You must specify the `snapshot_id` of the snapshot you want to delete. The snapshot must not be in use.
|
|
190
|
-
*
|
|
191
|
-
* @param request - The request {@link DeleteSnapshotRequest}
|
|
192
|
-
*/
|
|
193
|
-
deleteSnapshot = (request) => this.client.fetch({
|
|
194
|
-
method: "DELETE",
|
|
195
|
-
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
|
|
196
|
-
});
|
|
197
|
-
/**
|
|
198
|
-
* Update a snapshot. Update the name or tags of the snapshot.
|
|
199
|
-
*
|
|
200
|
-
* @param request - The request {@link UpdateSnapshotRequest}
|
|
201
|
-
* @returns A Promise of Snapshot
|
|
202
|
-
*/
|
|
203
|
-
updateSnapshot = (request) => this.client.fetch({
|
|
204
|
-
body: JSON.stringify(marshalUpdateSnapshotRequest(request, this.client.settings)),
|
|
205
|
-
headers: jsonContentHeaders,
|
|
206
|
-
method: "PATCH",
|
|
207
|
-
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
|
|
208
|
-
}, unmarshalSnapshot);
|
|
12
|
+
constructor(..._args) {
|
|
13
|
+
super(..._args);
|
|
14
|
+
this.pageOfListVolumeTypes = (request = {}) => this.client.fetch({
|
|
15
|
+
method: "GET",
|
|
16
|
+
path: `/block/v1alpha1/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/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`,
|
|
23
|
+
urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["product_resource_id", request.productResourceId], ["project_id", request.projectId], ["tags", request.tags])
|
|
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/v1alpha1/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/v1alpha1/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/v1alpha1/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/v1alpha1/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/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`,
|
|
50
|
+
urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["tags", request.tags], ["volume_id", request.volumeId])
|
|
51
|
+
}, unmarshalListSnapshotsResponse);
|
|
52
|
+
this.listSnapshots = (request = {}) => enrichForPagination("snapshots", this.pageOfListSnapshots, request);
|
|
53
|
+
this.getSnapshot = (request) => this.client.fetch({
|
|
54
|
+
method: "GET",
|
|
55
|
+
path: `/block/v1alpha1/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/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`
|
|
63
|
+
}, unmarshalSnapshot);
|
|
64
|
+
this.importSnapshotFromS3 = (request) => this.client.fetch({
|
|
65
|
+
body: JSON.stringify(marshalImportSnapshotFromS3Request(request, this.client.settings)),
|
|
66
|
+
headers: jsonContentHeaders,
|
|
67
|
+
method: "POST",
|
|
68
|
+
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-s3`
|
|
69
|
+
}, unmarshalSnapshot);
|
|
70
|
+
this.importSnapshotFromObjectStorage = (request) => this.client.fetch({
|
|
71
|
+
body: JSON.stringify(marshalImportSnapshotFromObjectStorageRequest(request, this.client.settings)),
|
|
72
|
+
headers: jsonContentHeaders,
|
|
73
|
+
method: "POST",
|
|
74
|
+
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-object-storage`
|
|
75
|
+
}, unmarshalSnapshot);
|
|
76
|
+
this.exportSnapshotToObjectStorage = (request) => this.client.fetch({
|
|
77
|
+
body: JSON.stringify(marshalExportSnapshotToObjectStorageRequest(request, this.client.settings)),
|
|
78
|
+
headers: jsonContentHeaders,
|
|
79
|
+
method: "POST",
|
|
80
|
+
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}/export-to-object-storage`
|
|
81
|
+
}, unmarshalSnapshot);
|
|
82
|
+
this.deleteSnapshot = (request) => this.client.fetch({
|
|
83
|
+
method: "DELETE",
|
|
84
|
+
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
|
|
85
|
+
});
|
|
86
|
+
this.updateSnapshot = (request) => this.client.fetch({
|
|
87
|
+
body: JSON.stringify(marshalUpdateSnapshotRequest(request, this.client.settings)),
|
|
88
|
+
headers: jsonContentHeaders,
|
|
89
|
+
method: "PATCH",
|
|
90
|
+
path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
|
|
91
|
+
}, unmarshalSnapshot);
|
|
92
|
+
}
|
|
93
|
+
static {
|
|
94
|
+
this.LOCALITY = toApiLocality({ zones: [
|
|
95
|
+
"fr-par-1",
|
|
96
|
+
"fr-par-2",
|
|
97
|
+
"fr-par-3",
|
|
98
|
+
"nl-ams-1",
|
|
99
|
+
"nl-ams-2",
|
|
100
|
+
"nl-ams-3",
|
|
101
|
+
"pl-waw-1",
|
|
102
|
+
"pl-waw-2",
|
|
103
|
+
"pl-waw-3"
|
|
104
|
+
] });
|
|
105
|
+
}
|
|
209
106
|
};
|
|
210
107
|
//#endregion
|
|
211
108
|
export { API };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
//#region src/v1alpha1/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/v1alpha1/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,
|
|
@@ -38,14 +38,14 @@ var unmarshalSnapshot = (data) => {
|
|
|
38
38
|
zone: data.zone
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
const unmarshalVolumeSpecifications = (data) => {
|
|
42
42
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`);
|
|
43
43
|
return {
|
|
44
44
|
class: data.class,
|
|
45
45
|
perfIops: data.perf_iops
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
const unmarshalVolume = (data) => {
|
|
49
49
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
|
|
50
50
|
return {
|
|
51
51
|
createdAt: unmarshalDate(data.created_at),
|
|
@@ -64,14 +64,14 @@ var unmarshalVolume = (data) => {
|
|
|
64
64
|
zone: data.zone
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
-
|
|
67
|
+
const unmarshalListSnapshotsResponse = (data) => {
|
|
68
68
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
|
|
69
69
|
return {
|
|
70
70
|
snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
|
|
71
71
|
totalCount: data.total_count
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
const unmarshalVolumeType = (data) => {
|
|
75
75
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`);
|
|
76
76
|
return {
|
|
77
77
|
pricing: data.pricing ? unmarshalMoney(data.pricing) : void 0,
|
|
@@ -80,32 +80,32 @@ var unmarshalVolumeType = (data) => {
|
|
|
80
80
|
type: data.type
|
|
81
81
|
};
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
const unmarshalListVolumeTypesResponse = (data) => {
|
|
84
84
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVolumeTypesResponse' failed as data isn't a dictionary.`);
|
|
85
85
|
return {
|
|
86
86
|
totalCount: data.total_count,
|
|
87
87
|
volumeTypes: unmarshalArrayOfObject(data.volume_types, unmarshalVolumeType)
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
-
|
|
90
|
+
const unmarshalListVolumesResponse = (data) => {
|
|
91
91
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`);
|
|
92
92
|
return {
|
|
93
93
|
totalCount: data.total_count,
|
|
94
94
|
volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
|
-
|
|
97
|
+
const marshalCreateSnapshotRequest = (request, defaults) => ({
|
|
98
98
|
name: request.name || randomName("snp"),
|
|
99
99
|
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
100
100
|
tags: request.tags,
|
|
101
101
|
volume_id: request.volumeId
|
|
102
102
|
});
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
const marshalCreateVolumeRequestFromEmpty = (request, defaults) => ({ size: request.size });
|
|
104
|
+
const marshalCreateVolumeRequestFromSnapshot = (request, defaults) => ({
|
|
105
105
|
size: request.size,
|
|
106
106
|
snapshot_id: request.snapshotId
|
|
107
107
|
});
|
|
108
|
-
|
|
108
|
+
const marshalCreateVolumeRequest = (request, defaults) => ({
|
|
109
109
|
name: request.name || randomName("vol"),
|
|
110
110
|
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
111
111
|
tags: request.tags,
|
|
@@ -121,11 +121,11 @@ var marshalCreateVolumeRequest = (request, defaults) => ({
|
|
|
121
121
|
value: request.perfIops
|
|
122
122
|
}])
|
|
123
123
|
});
|
|
124
|
-
|
|
124
|
+
const marshalExportSnapshotToObjectStorageRequest = (request, defaults) => ({
|
|
125
125
|
bucket: request.bucket,
|
|
126
126
|
key: request.key
|
|
127
127
|
});
|
|
128
|
-
|
|
128
|
+
const marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
|
|
129
129
|
bucket: request.bucket,
|
|
130
130
|
key: request.key,
|
|
131
131
|
name: request.name,
|
|
@@ -133,7 +133,7 @@ var marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
|
|
|
133
133
|
size: request.size,
|
|
134
134
|
tags: request.tags
|
|
135
135
|
});
|
|
136
|
-
|
|
136
|
+
const marshalImportSnapshotFromS3Request = (request, defaults) => ({
|
|
137
137
|
bucket: request.bucket,
|
|
138
138
|
key: request.key,
|
|
139
139
|
name: request.name,
|
|
@@ -141,11 +141,11 @@ var marshalImportSnapshotFromS3Request = (request, defaults) => ({
|
|
|
141
141
|
size: request.size,
|
|
142
142
|
tags: request.tags
|
|
143
143
|
});
|
|
144
|
-
|
|
144
|
+
const marshalUpdateSnapshotRequest = (request, defaults) => ({
|
|
145
145
|
name: request.name,
|
|
146
146
|
tags: request.tags
|
|
147
147
|
});
|
|
148
|
-
|
|
148
|
+
const marshalUpdateVolumeRequest = (request, defaults) => ({
|
|
149
149
|
name: request.name,
|
|
150
150
|
perf_iops: request.perfIops,
|
|
151
151
|
size: request.size,
|
|
@@ -10,31 +10,31 @@ var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({
|
|
|
10
10
|
ListVolumesRequest: () => ListVolumesRequest,
|
|
11
11
|
Reference: () => Reference
|
|
12
12
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const CreateSnapshotRequest = { name: { minLength: 1 } };
|
|
14
|
+
const CreateVolumeRequest = { name: { minLength: 1 } };
|
|
15
|
+
const ImportSnapshotFromObjectStorageRequest = { name: { minLength: 1 } };
|
|
16
|
+
const ImportSnapshotFromS3Request = { name: { minLength: 1 } };
|
|
17
|
+
const ListSnapshotsRequest = {
|
|
18
18
|
page: { greaterThan: 0 },
|
|
19
19
|
pageSize: {
|
|
20
20
|
greaterThan: 0,
|
|
21
21
|
lessThanOrEqual: 100
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
const ListVolumeTypesRequest = {
|
|
25
25
|
page: { greaterThan: 0 },
|
|
26
26
|
pageSize: {
|
|
27
27
|
greaterThan: 0,
|
|
28
28
|
lessThanOrEqual: 100
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
const ListVolumesRequest = {
|
|
32
32
|
page: { greaterThan: 0 },
|
|
33
33
|
pageSize: {
|
|
34
34
|
greaterThan: 0,
|
|
35
35
|
lessThanOrEqual: 100
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
const Reference = { productResourceType: { minLength: 1 } };
|
|
39
39
|
//#endregion
|
|
40
40
|
export { CreateSnapshotRequest, CreateVolumeRequest, ImportSnapshotFromObjectStorageRequest, ImportSnapshotFromS3Request, ListSnapshotsRequest, ListVolumeTypesRequest, ListVolumesRequest, Reference, validation_rules_gen_exports };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/sdk-block",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Scaleway SDK block",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
@@ -35,18 +35,20 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@scaleway/random-name": "5.1.4",
|
|
38
|
-
"@scaleway/sdk-std": "2.
|
|
38
|
+
"@scaleway/sdk-std": "2.4.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@
|
|
41
|
+
"@repo/configs": "^0.1.1",
|
|
42
|
+
"@scaleway/sdk-client": "^2.3.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@scaleway/sdk-client": "^2.
|
|
45
|
+
"@scaleway/sdk-client": "^2.3.0",
|
|
46
|
+
"@repo/configs": "^0.1.1"
|
|
45
47
|
},
|
|
46
48
|
"scripts": {
|
|
47
49
|
"package:check": "pnpm publint",
|
|
48
|
-
"typecheck": "
|
|
49
|
-
"type:generate": "
|
|
50
|
+
"typecheck": "tsgo --noEmit",
|
|
51
|
+
"type:generate": "tsgo --declaration -p tsconfig.build.json",
|
|
50
52
|
"build": "vite build --config vite.config.ts && pnpm run type:generate",
|
|
51
53
|
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts"
|
|
52
54
|
}
|