@scaleway/sdk-block 1.3.0 → 2.2.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/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @scaleway/sdk-block
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-block.svg)](https://www.npmjs.com/package/@scaleway/sdk-block)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-block.svg)](https://www.npmjs.com/package/@scaleway/sdk-block)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-block.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Block API.
8
+
9
+ > **Note**
10
+ > This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @scaleway/sdk-block @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-block @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-block @scaleway/sdk-client
28
+ ```
29
+
30
+ ## Getting Started
31
+
32
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
33
+
34
+ ### Basic Usage
35
+
36
+ ```typescript
37
+ import { createClient } from '@scaleway/sdk-client'
38
+ import { Block } from '@scaleway/sdk-block'
39
+
40
+ const client = createClient({
41
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
42
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultRegion: 'fr-par',
45
+ defaultZone: 'fr-par-1',
46
+ })
47
+
48
+ const api = new Block.v1.API(client)
49
+
50
+ // Use the API
51
+ // Example: await api.listServers()
52
+ ```
53
+
54
+ ### Using Configuration Loader
55
+
56
+ For a simpler setup, you can load credentials from the configuration file or environment variables:
57
+
58
+ ```typescript
59
+ import { createClient } from '@scaleway/sdk-client'
60
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
61
+ import { Block } from '@scaleway/sdk-block'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Block.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Block API Documentation](https://www.scaleway.com/en/developers/api/block/)
72
+ - 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
73
+ - 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
74
+
75
+ ## Features
76
+
77
+ - ✅ Full TypeScript support with complete type definitions
78
+ - ✅ Promise-based API
79
+ - ✅ Automatic pagination helpers
80
+ - ✅ Built-in error handling
81
+ - ✅ Compatible with Node.js ≥ 20
82
+
83
+ ## Support
84
+
85
+ We love feedback! Feel free to reach us on:
86
+ - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
+ - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
+
89
+ ## Contributing
90
+
91
+ This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
92
+
93
+ ## License
94
+
95
+ This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
+
@@ -1,6 +1,6 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client';
3
- import type { CreateSnapshotRequest, CreateVolumeRequest, DeleteSnapshotRequest, DeleteVolumeRequest, ExportSnapshotToObjectStorageRequest, GetSnapshotRequest, GetVolumeRequest, ImportSnapshotFromObjectStorageRequest, ListSnapshotsRequest, ListSnapshotsResponse, ListVolumeTypesRequest, ListVolumeTypesResponse, ListVolumesRequest, ListVolumesResponse, Snapshot, UpdateSnapshotRequest, UpdateVolumeRequest, Volume } from './types.gen.js';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
+ import type { CreateSnapshotRequest, CreateVolumeRequest, DeleteSnapshotRequest, DeleteVolumeRequest, ExportSnapshotToObjectStorageRequest, GetSnapshotRequest, GetVolumeRequest, ImportSnapshotFromObjectStorageRequest, ListSnapshotsRequest, ListSnapshotsResponse, ListVolumesRequest, ListVolumesResponse, ListVolumeTypesRequest, ListVolumeTypesResponse, Snapshot, UpdateSnapshotRequest, UpdateVolumeRequest, Volume } from './types.gen.js';
4
4
  /**
5
5
  * Block Storage API.
6
6
 
@@ -59,7 +59,8 @@ class API extends API$1 {
59
59
  ],
60
60
  ["product_resource_id", request.productResourceId],
61
61
  ["project_id", request.projectId],
62
- ["tags", request.tags]
62
+ ["tags", request.tags],
63
+ ["volume_type", request.volumeType]
63
64
  )
64
65
  },
65
66
  unmarshalListVolumesResponse
@@ -1,5 +1,5 @@
1
1
  export { API } from './api.gen.js';
2
2
  export * from './content.gen.js';
3
3
  export * from './marshalling.gen.js';
4
- 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.js';
4
+ export type { CreateSnapshotRequest, CreateVolumeRequest, CreateVolumeRequestFromEmpty, CreateVolumeRequestFromSnapshot, DeleteSnapshotRequest, DeleteVolumeRequest, ExportSnapshotToObjectStorageRequest, GetSnapshotRequest, GetVolumeRequest, ImportSnapshotFromObjectStorageRequest, ListSnapshotsRequest, ListSnapshotsRequestOrderBy, ListSnapshotsResponse, ListVolumesRequest, ListVolumesRequestOrderBy, ListVolumesResponse, ListVolumeTypesRequest, ListVolumeTypesResponse, Reference, ReferenceStatus, ReferenceType, Snapshot, SnapshotParentVolume, SnapshotStatus, StorageClass, UpdateSnapshotRequest, UpdateVolumeRequest, Volume, VolumeSpecifications, VolumeStatus, VolumeType, } from './types.gen.js';
5
5
  export * as ValidationRules from './validation-rules.gen.js';
@@ -1,5 +1,5 @@
1
1
  import type { DefaultValues } from '@scaleway/sdk-client';
2
- import type { CreateSnapshotRequest, CreateVolumeRequest, ExportSnapshotToObjectStorageRequest, ImportSnapshotFromObjectStorageRequest, ListSnapshotsResponse, ListVolumeTypesResponse, ListVolumesResponse, Reference, Snapshot, UpdateSnapshotRequest, UpdateVolumeRequest, Volume } from './types.gen.js';
2
+ import type { CreateSnapshotRequest, CreateVolumeRequest, ExportSnapshotToObjectStorageRequest, ImportSnapshotFromObjectStorageRequest, ListSnapshotsResponse, ListVolumesResponse, ListVolumeTypesResponse, Reference, Snapshot, UpdateSnapshotRequest, UpdateVolumeRequest, Volume } from './types.gen.js';
3
3
  export declare const unmarshalReference: (data: unknown) => Reference;
4
4
  export declare const unmarshalSnapshot: (data: unknown) => Snapshot;
5
5
  export declare const unmarshalVolume: (data: unknown) => Volume;
@@ -397,7 +397,7 @@ export interface ListSnapshotsResponse {
397
397
  */
398
398
  snapshots: Snapshot[];
399
399
  /**
400
- * Total number of snpashots in the project.
400
+ * Total number of snapshots in the project.
401
401
  */
402
402
  totalCount: number;
403
403
  }
@@ -466,6 +466,10 @@ export type ListVolumesRequest = {
466
466
  * Display deleted volumes not erased yet.
467
467
  */
468
468
  includeDeleted: boolean;
469
+ /**
470
+ * Filter by volume type.
471
+ */
472
+ volumeType?: string;
469
473
  };
470
474
  export interface ListVolumesResponse {
471
475
  /**
@@ -1,6 +1,6 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality, 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.js';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
+ import type { CreateSnapshotRequest, CreateVolumeRequest, DeleteSnapshotRequest, DeleteVolumeRequest, ExportSnapshotToObjectStorageRequest, GetSnapshotRequest, GetVolumeRequest, ImportSnapshotFromObjectStorageRequest, ImportSnapshotFromS3Request, ListSnapshotsRequest, ListSnapshotsResponse, ListVolumesRequest, ListVolumesResponse, ListVolumeTypesRequest, ListVolumeTypesResponse, Snapshot, UpdateSnapshotRequest, UpdateVolumeRequest, Volume } from './types.gen.js';
4
4
  /**
5
5
  * Block Storage API.
6
6
 
@@ -1,5 +1,5 @@
1
1
  export { API } from './api.gen.js';
2
2
  export * from './content.gen.js';
3
3
  export * from './marshalling.gen.js';
4
- export type { CreateSnapshotRequest, CreateVolumeRequest, CreateVolumeRequestFromEmpty, CreateVolumeRequestFromSnapshot, DeleteSnapshotRequest, DeleteVolumeRequest, ExportSnapshotToObjectStorageRequest, GetSnapshotRequest, GetVolumeRequest, ImportSnapshotFromObjectStorageRequest, ImportSnapshotFromS3Request, ListSnapshotsRequest, ListSnapshotsRequestOrderBy, ListSnapshotsResponse, ListVolumeTypesRequest, ListVolumeTypesResponse, ListVolumesRequest, ListVolumesRequestOrderBy, ListVolumesResponse, Reference, ReferenceStatus, ReferenceType, Snapshot, SnapshotParentVolume, SnapshotStatus, StorageClass, UpdateSnapshotRequest, UpdateVolumeRequest, Volume, VolumeSpecifications, VolumeStatus, VolumeType, } from './types.gen.js';
4
+ export type { CreateSnapshotRequest, CreateVolumeRequest, CreateVolumeRequestFromEmpty, CreateVolumeRequestFromSnapshot, DeleteSnapshotRequest, DeleteVolumeRequest, ExportSnapshotToObjectStorageRequest, GetSnapshotRequest, GetVolumeRequest, ImportSnapshotFromObjectStorageRequest, ImportSnapshotFromS3Request, ListSnapshotsRequest, ListSnapshotsRequestOrderBy, ListSnapshotsResponse, ListVolumesRequest, ListVolumesRequestOrderBy, ListVolumesResponse, ListVolumeTypesRequest, ListVolumeTypesResponse, Reference, ReferenceStatus, ReferenceType, Snapshot, SnapshotParentVolume, SnapshotStatus, StorageClass, UpdateSnapshotRequest, UpdateVolumeRequest, Volume, VolumeSpecifications, VolumeStatus, VolumeType, } from './types.gen.js';
5
5
  export * as ValidationRules from './validation-rules.gen.js';
@@ -1,5 +1,5 @@
1
1
  import type { DefaultValues } from '@scaleway/sdk-client';
2
- import type { CreateSnapshotRequest, CreateVolumeRequest, ExportSnapshotToObjectStorageRequest, ImportSnapshotFromObjectStorageRequest, ImportSnapshotFromS3Request, ListSnapshotsResponse, ListVolumeTypesResponse, ListVolumesResponse, Snapshot, UpdateSnapshotRequest, UpdateVolumeRequest, Volume } from './types.gen.js';
2
+ import type { CreateSnapshotRequest, CreateVolumeRequest, ExportSnapshotToObjectStorageRequest, ImportSnapshotFromObjectStorageRequest, ImportSnapshotFromS3Request, ListSnapshotsResponse, ListVolumesResponse, ListVolumeTypesResponse, Snapshot, UpdateSnapshotRequest, UpdateVolumeRequest, Volume } from './types.gen.js';
3
3
  export declare const unmarshalSnapshot: (data: unknown) => Snapshot;
4
4
  export declare const unmarshalVolume: (data: unknown) => Volume;
5
5
  export declare const unmarshalListSnapshotsResponse: (data: unknown) => ListSnapshotsResponse;
@@ -423,7 +423,7 @@ export interface ListSnapshotsResponse {
423
423
  */
424
424
  snapshots: Snapshot[];
425
425
  /**
426
- * Total number of snpashots in the project.
426
+ * Total number of snapshots in the project.
427
427
  */
428
428
  totalCount: number;
429
429
  }
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-block",
3
- "version": "1.3.0",
3
+ "version": "2.2.0",
4
4
  "description": "Scaleway SDK block",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
+ "README.md",
7
8
  "dist"
8
9
  ],
9
10
  "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/index.gen.d.ts",
13
- "import": "./dist/index.gen.js",
14
- "require": "./dist/index.gen.cjs",
15
14
  "default": "./dist/index.gen.js"
16
15
  },
17
16
  "./*": {
18
17
  "types": "./dist/*/index.gen.d.ts",
19
- "import": "./dist/*/index.gen.js",
20
- "require": "./dist/*/index.gen.cjs",
21
18
  "default": "./dist/*/index.gen.js"
22
19
  }
23
20
  },
@@ -26,17 +23,17 @@
26
23
  "directory": "packages_generated/block"
27
24
  },
28
25
  "engines": {
29
- "node": ">=20.19.4"
26
+ "node": ">=20.19.6"
30
27
  },
31
28
  "dependencies": {
32
29
  "@scaleway/random-name": "5.1.2",
33
- "@scaleway/sdk-std": "1.2.0"
30
+ "@scaleway/sdk-std": "2.1.0"
34
31
  },
35
32
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.3"
33
+ "@scaleway/sdk-client": "^2.1.0"
37
34
  },
38
35
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.3"
36
+ "@scaleway/sdk-client": "^2.1.0"
40
37
  },
41
38
  "scripts": {
42
39
  "package:check": "pnpm publint",
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index_gen = require("./v1/index.gen.cjs");
4
- const index_gen$1 = require("./v1alpha1/index.gen.cjs");
5
- exports.Blockv1 = index_gen;
6
- exports.Blockv1alpha1 = index_gen$1;
@@ -1,292 +0,0 @@
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
- /**
11
- * Locality of this API.
12
- * type ∈ {'zone','region','global','unspecified'}
13
- */
14
- static LOCALITY = sdkClient.toApiLocality({
15
- zones: [
16
- "fr-par-1",
17
- "fr-par-2",
18
- "fr-par-3",
19
- "nl-ams-1",
20
- "nl-ams-2",
21
- "nl-ams-3",
22
- "pl-waw-1",
23
- "pl-waw-2",
24
- "pl-waw-3"
25
- ]
26
- });
27
- pageOfListVolumeTypes = (request = {}) => this.client.fetch(
28
- {
29
- method: "GET",
30
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volume-types`,
31
- urlParams: sdkClient.urlParams(
32
- ["page", request.page],
33
- [
34
- "page_size",
35
- request.pageSize ?? this.client.settings.defaultPageSize
36
- ]
37
- )
38
- },
39
- marshalling_gen.unmarshalListVolumeTypesResponse
40
- );
41
- /**
42
- * List volume types. List all available volume types in a specified zone. The volume types listed are ordered by name in ascending order.
43
- *
44
- * @param request - The request {@link ListVolumeTypesRequest}
45
- * @returns A Promise of ListVolumeTypesResponse
46
- */
47
- listVolumeTypes = (request = {}) => sdkClient.enrichForPagination("volumeTypes", this.pageOfListVolumeTypes, request);
48
- pageOfListVolumes = (request) => this.client.fetch(
49
- {
50
- method: "GET",
51
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`,
52
- urlParams: sdkClient.urlParams(
53
- ["include_deleted", request.includeDeleted],
54
- ["name", request.name],
55
- ["order_by", request.orderBy],
56
- ["organization_id", request.organizationId],
57
- ["page", request.page],
58
- [
59
- "page_size",
60
- request.pageSize ?? this.client.settings.defaultPageSize
61
- ],
62
- ["product_resource_id", request.productResourceId],
63
- ["project_id", request.projectId],
64
- ["tags", request.tags]
65
- )
66
- },
67
- marshalling_gen.unmarshalListVolumesResponse
68
- );
69
- /**
70
- * 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.
71
- *
72
- * @param request - The request {@link ListVolumesRequest}
73
- * @returns A Promise of ListVolumesResponse
74
- */
75
- listVolumes = (request) => sdkClient.enrichForPagination("volumes", this.pageOfListVolumes, request);
76
- /**
77
- * Create a volume. To create a new volume from scratch, you must specify `from_empty` and the `size`.
78
- 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.
79
- *
80
- * @param request - The request {@link CreateVolumeRequest}
81
- * @returns A Promise of Volume
82
- */
83
- createVolume = (request = {}) => this.client.fetch(
84
- {
85
- body: JSON.stringify(
86
- marshalling_gen.marshalCreateVolumeRequest(request, this.client.settings)
87
- ),
88
- headers: jsonContentHeaders,
89
- method: "POST",
90
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`
91
- },
92
- marshalling_gen.unmarshalVolume
93
- );
94
- /**
95
- * Get a volume. Retrieve technical information about a specific volume. Details such as size, type, and status are returned in the response.
96
- *
97
- * @param request - The request {@link GetVolumeRequest}
98
- * @returns A Promise of Volume
99
- */
100
- getVolume = (request) => this.client.fetch(
101
- {
102
- method: "GET",
103
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${sdkClient.validatePathParam("volumeId", request.volumeId)}`
104
- },
105
- marshalling_gen.unmarshalVolume
106
- );
107
- /**
108
- * Waits for {@link Volume} to be in a final state.
109
- *
110
- * @param request - The request {@link GetVolumeRequest}
111
- * @param options - The waiting options
112
- * @returns A Promise of Volume
113
- */
114
- waitForVolume = (request, options) => sdkClient.waitForResource(
115
- options?.stop ?? ((res) => Promise.resolve(
116
- !content_gen.VOLUME_TRANSIENT_STATUSES.includes(res.status)
117
- )),
118
- this.getVolume,
119
- request,
120
- options
121
- );
122
- /**
123
- * 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.
124
- *
125
- * @param request - The request {@link DeleteVolumeRequest}
126
- */
127
- deleteVolume = (request) => this.client.fetch({
128
- method: "DELETE",
129
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${sdkClient.validatePathParam("volumeId", request.volumeId)}`
130
- });
131
- /**
132
- * 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).
133
- You can only resize a volume to a larger size. It is currently not possible to change your Block Storage Class.
134
- *
135
- * @param request - The request {@link UpdateVolumeRequest}
136
- * @returns A Promise of Volume
137
- */
138
- updateVolume = (request) => this.client.fetch(
139
- {
140
- body: JSON.stringify(
141
- marshalling_gen.marshalUpdateVolumeRequest(request, this.client.settings)
142
- ),
143
- headers: jsonContentHeaders,
144
- method: "PATCH",
145
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${sdkClient.validatePathParam("volumeId", request.volumeId)}`
146
- },
147
- marshalling_gen.unmarshalVolume
148
- );
149
- pageOfListSnapshots = (request) => this.client.fetch(
150
- {
151
- method: "GET",
152
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`,
153
- urlParams: sdkClient.urlParams(
154
- ["include_deleted", request.includeDeleted],
155
- ["name", request.name],
156
- ["order_by", request.orderBy],
157
- ["organization_id", request.organizationId],
158
- ["page", request.page],
159
- [
160
- "page_size",
161
- request.pageSize ?? this.client.settings.defaultPageSize
162
- ],
163
- ["project_id", request.projectId],
164
- ["tags", request.tags],
165
- ["volume_id", request.volumeId]
166
- )
167
- },
168
- marshalling_gen.unmarshalListSnapshotsResponse
169
- );
170
- /**
171
- * 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.
172
- *
173
- * @param request - The request {@link ListSnapshotsRequest}
174
- * @returns A Promise of ListSnapshotsResponse
175
- */
176
- listSnapshots = (request) => sdkClient.enrichForPagination("snapshots", this.pageOfListSnapshots, request);
177
- /**
178
- * Get a snapshot. Retrieve technical information about a specific snapshot. Details such as size, volume type, and status are returned in the response.
179
- *
180
- * @param request - The request {@link GetSnapshotRequest}
181
- * @returns A Promise of Snapshot
182
- */
183
- getSnapshot = (request) => this.client.fetch(
184
- {
185
- method: "GET",
186
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}`
187
- },
188
- marshalling_gen.unmarshalSnapshot
189
- );
190
- /**
191
- * Waits for {@link Snapshot} to be in a final state.
192
- *
193
- * @param request - The request {@link GetSnapshotRequest}
194
- * @param options - The waiting options
195
- * @returns A Promise of Snapshot
196
- */
197
- waitForSnapshot = (request, options) => sdkClient.waitForResource(
198
- options?.stop ?? ((res) => Promise.resolve(
199
- !content_gen.SNAPSHOT_TRANSIENT_STATUSES.includes(res.status)
200
- )),
201
- this.getSnapshot,
202
- request,
203
- options
204
- );
205
- /**
206
- * Create a snapshot of a volume. To create a snapshot, the volume must be in the `in_use` or the `available` status.
207
- If your volume is in a transient state, you need to wait until the end of the current operation.
208
- *
209
- * @param request - The request {@link CreateSnapshotRequest}
210
- * @returns A Promise of Snapshot
211
- */
212
- createSnapshot = (request) => this.client.fetch(
213
- {
214
- body: JSON.stringify(
215
- marshalling_gen.marshalCreateSnapshotRequest(request, this.client.settings)
216
- ),
217
- headers: jsonContentHeaders,
218
- method: "POST",
219
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`
220
- },
221
- marshalling_gen.unmarshalSnapshot
222
- );
223
- /**
224
- * Import a snapshot from a Scaleway Object Storage bucket. The bucket must contain a QCOW2 image.
225
- The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
226
- *
227
- * @param request - The request {@link ImportSnapshotFromObjectStorageRequest}
228
- * @returns A Promise of Snapshot
229
- */
230
- importSnapshotFromObjectStorage = (request) => this.client.fetch(
231
- {
232
- body: JSON.stringify(
233
- marshalling_gen.marshalImportSnapshotFromObjectStorageRequest(
234
- request,
235
- this.client.settings
236
- )
237
- ),
238
- headers: jsonContentHeaders,
239
- method: "POST",
240
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-object-storage`
241
- },
242
- marshalling_gen.unmarshalSnapshot
243
- );
244
- /**
245
- * Export a snapshot to a Scaleway Object Storage bucket. The snapshot is exported in QCOW2 format.
246
- The snapshot must not be in transient state.
247
- *
248
- * @param request - The request {@link ExportSnapshotToObjectStorageRequest}
249
- * @returns A Promise of Snapshot
250
- */
251
- exportSnapshotToObjectStorage = (request) => this.client.fetch(
252
- {
253
- body: JSON.stringify(
254
- marshalling_gen.marshalExportSnapshotToObjectStorageRequest(
255
- request,
256
- this.client.settings
257
- )
258
- ),
259
- headers: jsonContentHeaders,
260
- method: "POST",
261
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}/export-to-object-storage`
262
- },
263
- marshalling_gen.unmarshalSnapshot
264
- );
265
- /**
266
- * Delete a snapshot. You must specify the `snapshot_id` of the snapshot you want to delete. The snapshot must not be in use.
267
- *
268
- * @param request - The request {@link DeleteSnapshotRequest}
269
- */
270
- deleteSnapshot = (request) => this.client.fetch({
271
- method: "DELETE",
272
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}`
273
- });
274
- /**
275
- * Update a snapshot. Update the name or tags of the snapshot.
276
- *
277
- * @param request - The request {@link UpdateSnapshotRequest}
278
- * @returns A Promise of Snapshot
279
- */
280
- updateSnapshot = (request) => this.client.fetch(
281
- {
282
- body: JSON.stringify(
283
- marshalling_gen.marshalUpdateSnapshotRequest(request, this.client.settings)
284
- ),
285
- headers: jsonContentHeaders,
286
- method: "PATCH",
287
- path: `/block/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}`
288
- },
289
- marshalling_gen.unmarshalSnapshot
290
- );
291
- }
292
- exports.API = API;
@@ -1,22 +0,0 @@
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;
@@ -1,23 +0,0 @@
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 marshalling_gen = require("./marshalling.gen.cjs");
6
- const validationRules_gen = require("./validation-rules.gen.cjs");
7
- exports.API = api_gen.API;
8
- exports.REFERENCE_TRANSIENT_STATUSES = content_gen.REFERENCE_TRANSIENT_STATUSES;
9
- exports.SNAPSHOT_TRANSIENT_STATUSES = content_gen.SNAPSHOT_TRANSIENT_STATUSES;
10
- exports.VOLUME_TRANSIENT_STATUSES = content_gen.VOLUME_TRANSIENT_STATUSES;
11
- exports.marshalCreateSnapshotRequest = marshalling_gen.marshalCreateSnapshotRequest;
12
- exports.marshalCreateVolumeRequest = marshalling_gen.marshalCreateVolumeRequest;
13
- exports.marshalExportSnapshotToObjectStorageRequest = marshalling_gen.marshalExportSnapshotToObjectStorageRequest;
14
- exports.marshalImportSnapshotFromObjectStorageRequest = marshalling_gen.marshalImportSnapshotFromObjectStorageRequest;
15
- exports.marshalUpdateSnapshotRequest = marshalling_gen.marshalUpdateSnapshotRequest;
16
- exports.marshalUpdateVolumeRequest = marshalling_gen.marshalUpdateVolumeRequest;
17
- exports.unmarshalListSnapshotsResponse = marshalling_gen.unmarshalListSnapshotsResponse;
18
- exports.unmarshalListVolumeTypesResponse = marshalling_gen.unmarshalListVolumeTypesResponse;
19
- exports.unmarshalListVolumesResponse = marshalling_gen.unmarshalListVolumesResponse;
20
- exports.unmarshalReference = marshalling_gen.unmarshalReference;
21
- exports.unmarshalSnapshot = marshalling_gen.unmarshalSnapshot;
22
- exports.unmarshalVolume = marshalling_gen.unmarshalVolume;
23
- exports.ValidationRules = validationRules_gen;