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