@scaleway/sdk-block 2.9.2 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/.vite/license.md +3 -0
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/index.gen.d.ts +6 -0
  4. package/dist/index.gen.js +3 -0
  5. package/dist/metadata.gen.d.ts +12 -0
  6. package/dist/metadata.gen.js +13 -0
  7. package/dist/v1/api.gen.d.ts +137 -0
  8. package/dist/v1/api.gen.js +102 -0
  9. package/dist/v1/content.gen.d.ts +7 -0
  10. package/dist/v1/content.gen.js +23 -0
  11. package/dist/v1/index.gen.d.ts +5 -0
  12. package/dist/v1/index.gen.js +27 -0
  13. package/dist/v1/marshalling.gen.d.ts +14 -0
  14. package/dist/v1/marshalling.gen.js +153 -0
  15. package/dist/v1/metadata.gen.d.ts +61 -0
  16. package/dist/v1/metadata.gen.js +69 -0
  17. package/dist/v1/types.gen.d.ts +555 -0
  18. package/dist/v1/types.gen.js +0 -0
  19. package/dist/v1/validation-rules.gen.d.ts +47 -0
  20. package/dist/v1/validation-rules.gen.js +38 -0
  21. package/dist/v1alpha1/api.gen.d.ts +147 -0
  22. package/dist/v1alpha1/api.gen.js +108 -0
  23. package/dist/v1alpha1/content.gen.d.ts +7 -0
  24. package/dist/v1alpha1/content.gen.js +23 -0
  25. package/dist/v1alpha1/index.gen.d.ts +5 -0
  26. package/dist/v1alpha1/index.gen.js +27 -0
  27. package/dist/v1alpha1/marshalling.gen.d.ts +14 -0
  28. package/dist/v1alpha1/marshalling.gen.js +155 -0
  29. package/dist/v1alpha1/metadata.gen.d.ts +61 -0
  30. package/dist/v1alpha1/metadata.gen.js +69 -0
  31. package/dist/v1alpha1/types.gen.d.ts +545 -0
  32. package/dist/v1alpha1/types.gen.js +0 -0
  33. package/dist/v1alpha1/validation-rules.gen.d.ts +52 -0
  34. package/dist/v1alpha1/validation-rules.gen.js +40 -0
  35. package/package.json +5 -5
  36. package/LICENSE +0 -191
@@ -0,0 +1,3 @@
1
+ # Licenses
2
+
3
+ The app does not bundle any dependencies with licenses.
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file is automatically generated
3
+ * PLEASE DO NOT EDIT HERE
4
+ */
5
+ export * as Blockv1 from './v1/index.gen.js';
6
+ export * as Blockv1alpha1 from './v1alpha1/index.gen.js';
@@ -0,0 +1,3 @@
1
+ import { index_gen_exports } from "./v1/index.gen.js";
2
+ import { index_gen_exports as index_gen_exports$1 } from "./v1alpha1/index.gen.js";
3
+ export { index_gen_exports as Blockv1, index_gen_exports$1 as Blockv1alpha1 };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file is automatically generated
3
+ * PLEASE DO NOT EDIT HERE
4
+ */
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
+ };
11
+ export type Metadata = typeof pkgMetadata;
12
+ export default pkgMetadata;
@@ -0,0 +1,13 @@
1
+ //#region src/metadata.gen.ts
2
+ /**
3
+ * This file is automatically generated
4
+ * PLEASE DO NOT EDIT HERE
5
+ */
6
+ const pkgMetadata = {
7
+ name: "@scaleway/sdk-block",
8
+ namespace: "block",
9
+ displayName: "Block",
10
+ versions: ["v1", "v1alpha1"]
11
+ };
12
+ //#endregion
13
+ export { pkgMetadata as default, pkgMetadata };
@@ -0,0 +1,137 @@
1
+ import { API as ParentAPI } from '@scaleway/sdk-client';
2
+ import type { WaitForOptions, ApiLocality } 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';
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
+ /**
11
+ * Locality of this API.
12
+ * type ∈ {'zone','region','global','unspecified'}
13
+ */
14
+ static readonly LOCALITY: ApiLocality;
15
+ protected pageOfListVolumeTypes: (request?: Readonly<ListVolumeTypesRequest>) => Promise<ListVolumeTypesResponse>;
16
+ /**
17
+ * List volume types. List all available volume types in a specified zone. The volume types listed are ordered by name in ascending order.
18
+ *
19
+ * @param request - The request {@link ListVolumeTypesRequest}
20
+ * @returns A Promise of ListVolumeTypesResponse
21
+ */
22
+ listVolumeTypes: (request?: Readonly<ListVolumeTypesRequest>) => Promise<ListVolumeTypesResponse> & {
23
+ all: () => Promise<import("./types.gen.js").VolumeType[]>;
24
+ [Symbol.asyncIterator]: () => AsyncGenerator<import("./types.gen.js").VolumeType[], void, void>;
25
+ };
26
+ protected pageOfListVolumes: (request: Readonly<ListVolumesRequest>) => Promise<ListVolumesResponse>;
27
+ /**
28
+ * 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.
29
+ *
30
+ * @param request - The request {@link ListVolumesRequest}
31
+ * @returns A Promise of ListVolumesResponse
32
+ */
33
+ listVolumes: (request: Readonly<ListVolumesRequest>) => Promise<ListVolumesResponse> & {
34
+ all: () => Promise<Volume[]>;
35
+ [Symbol.asyncIterator]: () => AsyncGenerator<Volume[], void, void>;
36
+ };
37
+ /**
38
+ * Create a volume. To create a new volume from scratch, you must specify `from_empty` and the `size`.
39
+ 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.
40
+ *
41
+ * @param request - The request {@link CreateVolumeRequest}
42
+ * @returns A Promise of Volume
43
+ */
44
+ createVolume: (request?: Readonly<CreateVolumeRequest>) => Promise<Volume>;
45
+ /**
46
+ * Get a volume. Retrieve technical information about a specific volume. Details such as size, type, and status are returned in the response.
47
+ *
48
+ * @param request - The request {@link GetVolumeRequest}
49
+ * @returns A Promise of Volume
50
+ */
51
+ getVolume: (request: Readonly<GetVolumeRequest>) => Promise<Volume>;
52
+ /**
53
+ * Waits for {@link Volume} to be in a final state.
54
+ *
55
+ * @param request - The request {@link GetVolumeRequest}
56
+ * @param options - The waiting options
57
+ * @returns A Promise of Volume
58
+ */
59
+ waitForVolume: (request: Readonly<GetVolumeRequest>, options?: Readonly<WaitForOptions<Volume>>) => Promise<Volume>;
60
+ /**
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
+ *
63
+ * @param request - The request {@link DeleteVolumeRequest}
64
+ */
65
+ deleteVolume: (request: Readonly<DeleteVolumeRequest>) => Promise<void>;
66
+ /**
67
+ * 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).
68
+ You can only resize a volume to a larger size. It is currently not possible to change your Block Storage Class.
69
+ *
70
+ * @param request - The request {@link UpdateVolumeRequest}
71
+ * @returns A Promise of Volume
72
+ */
73
+ updateVolume: (request: Readonly<UpdateVolumeRequest>) => Promise<Volume>;
74
+ protected pageOfListSnapshots: (request: Readonly<ListSnapshotsRequest>) => Promise<ListSnapshotsResponse>;
75
+ /**
76
+ * 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.
77
+ *
78
+ * @param request - The request {@link ListSnapshotsRequest}
79
+ * @returns A Promise of ListSnapshotsResponse
80
+ */
81
+ listSnapshots: (request: Readonly<ListSnapshotsRequest>) => Promise<ListSnapshotsResponse> & {
82
+ all: () => Promise<Snapshot[]>;
83
+ [Symbol.asyncIterator]: () => AsyncGenerator<Snapshot[], void, void>;
84
+ };
85
+ /**
86
+ * Get a snapshot. Retrieve technical information about a specific snapshot. Details such as size, volume type, and status are returned in the response.
87
+ *
88
+ * @param request - The request {@link GetSnapshotRequest}
89
+ * @returns A Promise of Snapshot
90
+ */
91
+ getSnapshot: (request: Readonly<GetSnapshotRequest>) => Promise<Snapshot>;
92
+ /**
93
+ * Waits for {@link Snapshot} to be in a final state.
94
+ *
95
+ * @param request - The request {@link GetSnapshotRequest}
96
+ * @param options - The waiting options
97
+ * @returns A Promise of Snapshot
98
+ */
99
+ waitForSnapshot: (request: Readonly<GetSnapshotRequest>, options?: Readonly<WaitForOptions<Snapshot>>) => Promise<Snapshot>;
100
+ /**
101
+ * Create a snapshot of a volume. To create a snapshot, the volume must be in the `in_use` or the `available` status.
102
+ If your volume is in a transient state, you need to wait until the end of the current operation.
103
+ *
104
+ * @param request - The request {@link CreateSnapshotRequest}
105
+ * @returns A Promise of Snapshot
106
+ */
107
+ createSnapshot: (request: Readonly<CreateSnapshotRequest>) => Promise<Snapshot>;
108
+ /**
109
+ * Import a snapshot from a Scaleway Object Storage bucket. The bucket must contain a QCOW2 image.
110
+ The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
111
+ *
112
+ * @param request - The request {@link ImportSnapshotFromObjectStorageRequest}
113
+ * @returns A Promise of Snapshot
114
+ */
115
+ importSnapshotFromObjectStorage: (request: Readonly<ImportSnapshotFromObjectStorageRequest>) => Promise<Snapshot>;
116
+ /**
117
+ * Export a snapshot to a Scaleway Object Storage bucket. The snapshot is exported in QCOW2 format.
118
+ The snapshot must not be in transient state.
119
+ *
120
+ * @param request - The request {@link ExportSnapshotToObjectStorageRequest}
121
+ * @returns A Promise of Snapshot
122
+ */
123
+ exportSnapshotToObjectStorage: (request: Readonly<ExportSnapshotToObjectStorageRequest>) => Promise<Snapshot>;
124
+ /**
125
+ * Delete a snapshot. You must specify the `snapshot_id` of the snapshot you want to delete. The snapshot must not be in use.
126
+ *
127
+ * @param request - The request {@link DeleteSnapshotRequest}
128
+ */
129
+ deleteSnapshot: (request: Readonly<DeleteSnapshotRequest>) => Promise<void>;
130
+ /**
131
+ * Update a snapshot. Update the name or tags of the snapshot.
132
+ *
133
+ * @param request - The request {@link UpdateSnapshotRequest}
134
+ * @returns A Promise of Snapshot
135
+ */
136
+ updateSnapshot: (request: Readonly<UpdateSnapshotRequest>) => Promise<Snapshot>;
137
+ }
@@ -0,0 +1,102 @@
1
+ import { SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES } from "./content.gen.js";
2
+ import { marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotToObjectStorageRequest, marshalImportSnapshotFromObjectStorageRequest, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, unmarshalSnapshot, unmarshalVolume } from "./marshalling.gen.js";
3
+ import { API as API$1, enrichForPagination, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ //#region src/v1/api.gen.ts
5
+ const jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
6
+ /**
7
+ * Block Storage API.
8
+
9
+ This API allows you to manage your Block Storage volumes.
10
+ */
11
+ var API = class extends API$1 {
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
+ }
100
+ };
101
+ //#endregion
102
+ export { API };
@@ -0,0 +1,7 @@
1
+ import type { ReferenceStatus, SnapshotStatus, VolumeStatus } from './types.gen.js';
2
+ /** Lists transient statutes of the enum {@link ReferenceStatus}. */
3
+ export declare const REFERENCE_TRANSIENT_STATUSES: ReferenceStatus[];
4
+ /** Lists transient statutes of the enum {@link SnapshotStatus}. */
5
+ export declare const SNAPSHOT_TRANSIENT_STATUSES: SnapshotStatus[];
6
+ /** Lists transient statutes of the enum {@link VolumeStatus}. */
7
+ export declare const VOLUME_TRANSIENT_STATUSES: VolumeStatus[];
@@ -0,0 +1,23 @@
1
+ //#region src/v1/content.gen.ts
2
+ /** Lists transient statutes of the enum {@link ReferenceStatus}. */
3
+ const REFERENCE_TRANSIENT_STATUSES = [
4
+ "attaching",
5
+ "detaching",
6
+ "creating"
7
+ ];
8
+ /** Lists transient statutes of the enum {@link SnapshotStatus}. */
9
+ const SNAPSHOT_TRANSIENT_STATUSES = [
10
+ "creating",
11
+ "deleting",
12
+ "exporting"
13
+ ];
14
+ /** Lists transient statutes of the enum {@link VolumeStatus}. */
15
+ const VOLUME_TRANSIENT_STATUSES = [
16
+ "creating",
17
+ "deleting",
18
+ "resizing",
19
+ "snapshotting",
20
+ "updating"
21
+ ];
22
+ //#endregion
23
+ export { REFERENCE_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES };
@@ -0,0 +1,5 @@
1
+ export { API, } from './api.gen.js';
2
+ export * from './content.gen.js';
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';
5
+ export * as ValidationRules from './validation-rules.gen.js';
@@ -0,0 +1,27 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { REFERENCE_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import { marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotToObjectStorageRequest, marshalImportSnapshotFromObjectStorageRequest, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, unmarshalReference, unmarshalSnapshot, unmarshalVolume } from "./marshalling.gen.js";
4
+ import { API } from "./api.gen.js";
5
+ import { validation_rules_gen_exports } from "./validation-rules.gen.js";
6
+ //#region src/v1/index.gen.ts
7
+ var index_gen_exports = /* @__PURE__ */ __exportAll({
8
+ API: () => API,
9
+ REFERENCE_TRANSIENT_STATUSES: () => REFERENCE_TRANSIENT_STATUSES,
10
+ SNAPSHOT_TRANSIENT_STATUSES: () => SNAPSHOT_TRANSIENT_STATUSES,
11
+ VOLUME_TRANSIENT_STATUSES: () => VOLUME_TRANSIENT_STATUSES,
12
+ ValidationRules: () => validation_rules_gen_exports,
13
+ marshalCreateSnapshotRequest: () => marshalCreateSnapshotRequest,
14
+ marshalCreateVolumeRequest: () => marshalCreateVolumeRequest,
15
+ marshalExportSnapshotToObjectStorageRequest: () => marshalExportSnapshotToObjectStorageRequest,
16
+ marshalImportSnapshotFromObjectStorageRequest: () => marshalImportSnapshotFromObjectStorageRequest,
17
+ marshalUpdateSnapshotRequest: () => marshalUpdateSnapshotRequest,
18
+ marshalUpdateVolumeRequest: () => marshalUpdateVolumeRequest,
19
+ unmarshalListSnapshotsResponse: () => unmarshalListSnapshotsResponse,
20
+ unmarshalListVolumeTypesResponse: () => unmarshalListVolumeTypesResponse,
21
+ unmarshalListVolumesResponse: () => unmarshalListVolumesResponse,
22
+ unmarshalReference: () => unmarshalReference,
23
+ unmarshalSnapshot: () => unmarshalSnapshot,
24
+ unmarshalVolume: () => unmarshalVolume
25
+ });
26
+ //#endregion
27
+ export { API, REFERENCE_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES, validation_rules_gen_exports as ValidationRules, index_gen_exports, marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotToObjectStorageRequest, marshalImportSnapshotFromObjectStorageRequest, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, unmarshalReference, unmarshalSnapshot, unmarshalVolume };
@@ -0,0 +1,14 @@
1
+ import type { DefaultValues } from '@scaleway/sdk-client';
2
+ import type { Reference, Snapshot, Volume, ListSnapshotsResponse, ListVolumeTypesResponse, ListVolumesResponse, CreateSnapshotRequest, CreateVolumeRequest, ExportSnapshotToObjectStorageRequest, ImportSnapshotFromObjectStorageRequest, UpdateSnapshotRequest, UpdateVolumeRequest } from './types.gen.js';
3
+ export declare const unmarshalReference: (data: unknown) => Reference;
4
+ export declare const unmarshalSnapshot: (data: unknown) => Snapshot;
5
+ export declare const unmarshalVolume: (data: unknown) => Volume;
6
+ export declare const unmarshalListSnapshotsResponse: (data: unknown) => ListSnapshotsResponse;
7
+ export declare const unmarshalListVolumeTypesResponse: (data: unknown) => ListVolumeTypesResponse;
8
+ export declare const unmarshalListVolumesResponse: (data: unknown) => ListVolumesResponse;
9
+ export declare const marshalCreateSnapshotRequest: (request: CreateSnapshotRequest, defaults: DefaultValues) => Record<string, unknown>;
10
+ export declare const marshalCreateVolumeRequest: (request: CreateVolumeRequest, defaults: DefaultValues) => Record<string, unknown>;
11
+ export declare const marshalExportSnapshotToObjectStorageRequest: (request: ExportSnapshotToObjectStorageRequest, defaults: DefaultValues) => Record<string, unknown>;
12
+ export declare const marshalImportSnapshotFromObjectStorageRequest: (request: ImportSnapshotFromObjectStorageRequest, defaults: DefaultValues) => Record<string, unknown>;
13
+ export declare const marshalUpdateSnapshotRequest: (request: UpdateSnapshotRequest, defaults: DefaultValues) => Record<string, unknown>;
14
+ export declare const marshalUpdateVolumeRequest: (request: UpdateVolumeRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -0,0 +1,153 @@
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney } from "@scaleway/sdk-client";
2
+ import randomName from "@scaleway/random-name";
3
+ //#region src/v1/marshalling.gen.ts
4
+ const unmarshalReference = (data) => {
5
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Reference' failed as data isn't a dictionary.`);
6
+ return {
7
+ createdAt: unmarshalDate(data.created_at),
8
+ id: data.id,
9
+ productResourceId: data.product_resource_id,
10
+ productResourceType: data.product_resource_type,
11
+ status: data.status,
12
+ type: data.type
13
+ };
14
+ };
15
+ const unmarshalSnapshotParentVolume = (data) => {
16
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`);
17
+ return {
18
+ id: data.id,
19
+ name: data.name,
20
+ status: data.status,
21
+ type: data.type
22
+ };
23
+ };
24
+ const unmarshalSnapshot = (data) => {
25
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`);
26
+ return {
27
+ class: data.class,
28
+ createdAt: unmarshalDate(data.created_at),
29
+ id: data.id,
30
+ name: data.name,
31
+ parentVolume: data.parent_volume ? unmarshalSnapshotParentVolume(data.parent_volume) : void 0,
32
+ projectId: data.project_id,
33
+ public: data.public,
34
+ references: unmarshalArrayOfObject(data.references, unmarshalReference),
35
+ size: data.size,
36
+ status: data.status,
37
+ tags: data.tags,
38
+ updatedAt: unmarshalDate(data.updated_at),
39
+ zone: data.zone
40
+ };
41
+ };
42
+ const unmarshalVolumeSpecifications = (data) => {
43
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`);
44
+ return {
45
+ class: data.class,
46
+ perfIops: data.perf_iops
47
+ };
48
+ };
49
+ const unmarshalVolume = (data) => {
50
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
51
+ return {
52
+ createdAt: unmarshalDate(data.created_at),
53
+ id: data.id,
54
+ kmsKeyId: data.kms_key_id,
55
+ lastDetachedAt: unmarshalDate(data.last_detached_at),
56
+ name: data.name,
57
+ parentSnapshotId: data.parent_snapshot_id,
58
+ projectId: data.project_id,
59
+ references: unmarshalArrayOfObject(data.references, unmarshalReference),
60
+ size: data.size,
61
+ specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
62
+ status: data.status,
63
+ tags: data.tags,
64
+ type: data.type,
65
+ updatedAt: unmarshalDate(data.updated_at),
66
+ zone: data.zone
67
+ };
68
+ };
69
+ const unmarshalListSnapshotsResponse = (data) => {
70
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
71
+ return {
72
+ snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
73
+ totalCount: data.total_count
74
+ };
75
+ };
76
+ const unmarshalVolumeType = (data) => {
77
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`);
78
+ return {
79
+ pricing: data.pricing ? unmarshalMoney(data.pricing) : void 0,
80
+ snapshotPricing: data.snapshot_pricing ? unmarshalMoney(data.snapshot_pricing) : void 0,
81
+ specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
82
+ type: data.type,
83
+ zone: data.zone
84
+ };
85
+ };
86
+ const unmarshalListVolumeTypesResponse = (data) => {
87
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVolumeTypesResponse' failed as data isn't a dictionary.`);
88
+ return {
89
+ totalCount: data.total_count,
90
+ volumeTypes: unmarshalArrayOfObject(data.volume_types, unmarshalVolumeType)
91
+ };
92
+ };
93
+ const unmarshalListVolumesResponse = (data) => {
94
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`);
95
+ return {
96
+ totalCount: data.total_count,
97
+ volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
98
+ };
99
+ };
100
+ const marshalCreateSnapshotRequest = (request, defaults) => ({
101
+ name: request.name || randomName("snp"),
102
+ project_id: request.projectId ?? defaults.defaultProjectId,
103
+ public: request.public,
104
+ tags: request.tags,
105
+ volume_id: request.volumeId
106
+ });
107
+ const marshalCreateVolumeRequestFromEmpty = (request, defaults) => ({ size: request.size });
108
+ const marshalCreateVolumeRequestFromSnapshot = (request, defaults) => ({
109
+ size: request.size,
110
+ snapshot_id: request.snapshotId
111
+ });
112
+ const marshalCreateVolumeRequest = (request, defaults) => ({
113
+ kms_key_id: request.kmsKeyId,
114
+ name: request.name || randomName("vol"),
115
+ project_id: request.projectId ?? defaults.defaultProjectId,
116
+ tags: request.tags,
117
+ ...resolveOneOf([{
118
+ param: "from_empty",
119
+ value: request.fromEmpty !== void 0 ? marshalCreateVolumeRequestFromEmpty(request.fromEmpty, defaults) : void 0
120
+ }, {
121
+ param: "from_snapshot",
122
+ value: request.fromSnapshot !== void 0 ? marshalCreateVolumeRequestFromSnapshot(request.fromSnapshot, defaults) : void 0
123
+ }]),
124
+ ...resolveOneOf([{
125
+ param: "perf_iops",
126
+ value: request.perfIops
127
+ }])
128
+ });
129
+ const marshalExportSnapshotToObjectStorageRequest = (request, defaults) => ({
130
+ bucket: request.bucket,
131
+ key: request.key
132
+ });
133
+ const marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
134
+ bucket: request.bucket,
135
+ key: request.key,
136
+ name: request.name,
137
+ project_id: request.projectId ?? defaults.defaultProjectId,
138
+ size: request.size,
139
+ tags: request.tags
140
+ });
141
+ const marshalUpdateSnapshotRequest = (request, defaults) => ({
142
+ name: request.name,
143
+ public: request.public,
144
+ tags: request.tags
145
+ });
146
+ const marshalUpdateVolumeRequest = (request, defaults) => ({
147
+ name: request.name,
148
+ perf_iops: request.perfIops,
149
+ size: request.size,
150
+ tags: request.tags
151
+ });
152
+ //#endregion
153
+ export { marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotToObjectStorageRequest, marshalImportSnapshotFromObjectStorageRequest, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, unmarshalReference, unmarshalSnapshot, unmarshalVolume };
@@ -0,0 +1,61 @@
1
+ export declare const queriesMetadata: {
2
+ readonly namespace: 'block';
3
+ readonly version: 'v1';
4
+ readonly folderName: 'blockv1';
5
+ readonly services: readonly [{
6
+ readonly apiClass: 'API';
7
+ readonly methods: readonly [{
8
+ readonly methodName: 'listVolumeTypes';
9
+ readonly protoName: 'ListVolumeTypes';
10
+ readonly paramsType: 'ListVolumeTypesRequest';
11
+ readonly returnType: 'ListVolumeTypesResponse';
12
+ readonly isList: true;
13
+ readonly paginationType: 'offset';
14
+ readonly pageParamKey: 'page';
15
+ readonly listItemType: 'VolumeType';
16
+ readonly isPrivate: false;
17
+ readonly description: '"';
18
+ }, {
19
+ readonly methodName: 'listVolumes';
20
+ readonly protoName: 'ListVolumes';
21
+ readonly paramsType: 'ListVolumesRequest';
22
+ readonly returnType: 'ListVolumesResponse';
23
+ readonly isList: true;
24
+ readonly paginationType: 'offset';
25
+ readonly pageParamKey: 'page';
26
+ readonly listItemType: 'Volume';
27
+ readonly isPrivate: false;
28
+ readonly description: '"';
29
+ }, {
30
+ readonly methodName: 'getVolume';
31
+ readonly protoName: 'GetVolume';
32
+ readonly paramsType: 'GetVolumeRequest';
33
+ readonly returnType: 'Volume';
34
+ readonly isList: false;
35
+ readonly paginationType: 'none';
36
+ readonly isPrivate: false;
37
+ readonly description: '"';
38
+ }, {
39
+ readonly methodName: 'listSnapshots';
40
+ readonly protoName: 'ListSnapshots';
41
+ readonly paramsType: 'ListSnapshotsRequest';
42
+ readonly returnType: 'ListSnapshotsResponse';
43
+ readonly isList: true;
44
+ readonly paginationType: 'offset';
45
+ readonly pageParamKey: 'page';
46
+ readonly listItemType: 'Snapshot';
47
+ readonly isPrivate: false;
48
+ readonly description: '"';
49
+ }, {
50
+ readonly methodName: 'getSnapshot';
51
+ readonly protoName: 'GetSnapshot';
52
+ readonly paramsType: 'GetSnapshotRequest';
53
+ readonly returnType: 'Snapshot';
54
+ readonly isList: false;
55
+ readonly paginationType: 'none';
56
+ readonly isPrivate: false;
57
+ readonly description: '"';
58
+ }];
59
+ }];
60
+ };
61
+ export type QueriesMetadata = typeof queriesMetadata;