@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,147 @@
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, ImportSnapshotFromS3Request, 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
+ * (Deprecated in favor of `ImportSnapshotFromObjectStorage`). Import a snapshot from a Scaleway Object Storage bucket
110
+ The bucket must contain a QCOW2 image.
111
+ The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
112
+ *
113
+ * @deprecated
114
+ * @param request - The request {@link ImportSnapshotFromS3Request}
115
+ * @returns A Promise of Snapshot
116
+ */
117
+ importSnapshotFromS3: (request: Readonly<ImportSnapshotFromS3Request>) => Promise<Snapshot>;
118
+ /**
119
+ * Import a snapshot from a Scaleway Object Storage bucket. The bucket must contain a QCOW2 image.
120
+ The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
121
+ *
122
+ * @param request - The request {@link ImportSnapshotFromObjectStorageRequest}
123
+ * @returns A Promise of Snapshot
124
+ */
125
+ importSnapshotFromObjectStorage: (request: Readonly<ImportSnapshotFromObjectStorageRequest>) => Promise<Snapshot>;
126
+ /**
127
+ * Export a snapshot to a Scaleway Object Storage bucket. The snapshot is exported in QCOW2 format.
128
+ The snapshot must not be in transient state.
129
+ *
130
+ * @param request - The request {@link ExportSnapshotToObjectStorageRequest}
131
+ * @returns A Promise of Snapshot
132
+ */
133
+ exportSnapshotToObjectStorage: (request: Readonly<ExportSnapshotToObjectStorageRequest>) => Promise<Snapshot>;
134
+ /**
135
+ * Delete a snapshot. You must specify the `snapshot_id` of the snapshot you want to delete. The snapshot must not be in use.
136
+ *
137
+ * @param request - The request {@link DeleteSnapshotRequest}
138
+ */
139
+ deleteSnapshot: (request: Readonly<DeleteSnapshotRequest>) => Promise<void>;
140
+ /**
141
+ * Update a snapshot. Update the name or tags of the snapshot.
142
+ *
143
+ * @param request - The request {@link UpdateSnapshotRequest}
144
+ * @returns A Promise of Snapshot
145
+ */
146
+ updateSnapshot: (request: Readonly<UpdateSnapshotRequest>) => Promise<Snapshot>;
147
+ }
@@ -0,0 +1,108 @@
1
+ import { SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES } from "./content.gen.js";
2
+ import { marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotToObjectStorageRequest, marshalImportSnapshotFromObjectStorageRequest, marshalImportSnapshotFromS3Request, 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/v1alpha1/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/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volume-types`,
17
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
18
+ }, unmarshalListVolumeTypesResponse);
19
+ this.listVolumeTypes = (request = {}) => enrichForPagination("volumeTypes", this.pageOfListVolumeTypes, request);
20
+ this.pageOfListVolumes = (request = {}) => this.client.fetch({
21
+ method: "GET",
22
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`,
23
+ urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["product_resource_id", request.productResourceId], ["project_id", request.projectId], ["tags", request.tags])
24
+ }, unmarshalListVolumesResponse);
25
+ this.listVolumes = (request = {}) => enrichForPagination("volumes", this.pageOfListVolumes, request);
26
+ this.createVolume = (request = {}) => this.client.fetch({
27
+ body: JSON.stringify(marshalCreateVolumeRequest(request, this.client.settings)),
28
+ headers: jsonContentHeaders,
29
+ method: "POST",
30
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`
31
+ }, unmarshalVolume);
32
+ this.getVolume = (request) => this.client.fetch({
33
+ method: "GET",
34
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam("volumeId", request.volumeId)}`
35
+ }, unmarshalVolume);
36
+ this.waitForVolume = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!VOLUME_TRANSIENT_STATUSES.includes(res.status))), this.getVolume, request, options);
37
+ this.deleteVolume = (request) => this.client.fetch({
38
+ method: "DELETE",
39
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam("volumeId", request.volumeId)}`
40
+ });
41
+ this.updateVolume = (request) => this.client.fetch({
42
+ body: JSON.stringify(marshalUpdateVolumeRequest(request, this.client.settings)),
43
+ headers: jsonContentHeaders,
44
+ method: "PATCH",
45
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam("volumeId", request.volumeId)}`
46
+ }, unmarshalVolume);
47
+ this.pageOfListSnapshots = (request = {}) => this.client.fetch({
48
+ method: "GET",
49
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`,
50
+ urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["tags", request.tags], ["volume_id", request.volumeId])
51
+ }, unmarshalListSnapshotsResponse);
52
+ this.listSnapshots = (request = {}) => enrichForPagination("snapshots", this.pageOfListSnapshots, request);
53
+ this.getSnapshot = (request) => this.client.fetch({
54
+ method: "GET",
55
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
56
+ }, unmarshalSnapshot);
57
+ this.waitForSnapshot = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!SNAPSHOT_TRANSIENT_STATUSES.includes(res.status))), this.getSnapshot, request, options);
58
+ this.createSnapshot = (request) => this.client.fetch({
59
+ body: JSON.stringify(marshalCreateSnapshotRequest(request, this.client.settings)),
60
+ headers: jsonContentHeaders,
61
+ method: "POST",
62
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`
63
+ }, unmarshalSnapshot);
64
+ this.importSnapshotFromS3 = (request) => this.client.fetch({
65
+ body: JSON.stringify(marshalImportSnapshotFromS3Request(request, this.client.settings)),
66
+ headers: jsonContentHeaders,
67
+ method: "POST",
68
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-s3`
69
+ }, unmarshalSnapshot);
70
+ this.importSnapshotFromObjectStorage = (request) => this.client.fetch({
71
+ body: JSON.stringify(marshalImportSnapshotFromObjectStorageRequest(request, this.client.settings)),
72
+ headers: jsonContentHeaders,
73
+ method: "POST",
74
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/import-from-object-storage`
75
+ }, unmarshalSnapshot);
76
+ this.exportSnapshotToObjectStorage = (request) => this.client.fetch({
77
+ body: JSON.stringify(marshalExportSnapshotToObjectStorageRequest(request, this.client.settings)),
78
+ headers: jsonContentHeaders,
79
+ method: "POST",
80
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}/export-to-object-storage`
81
+ }, unmarshalSnapshot);
82
+ this.deleteSnapshot = (request) => this.client.fetch({
83
+ method: "DELETE",
84
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
85
+ });
86
+ this.updateSnapshot = (request) => this.client.fetch({
87
+ body: JSON.stringify(marshalUpdateSnapshotRequest(request, this.client.settings)),
88
+ headers: jsonContentHeaders,
89
+ method: "PATCH",
90
+ path: `/block/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
91
+ }, unmarshalSnapshot);
92
+ }
93
+ static {
94
+ this.LOCALITY = toApiLocality({ zones: [
95
+ "fr-par-1",
96
+ "fr-par-2",
97
+ "fr-par-3",
98
+ "nl-ams-1",
99
+ "nl-ams-2",
100
+ "nl-ams-3",
101
+ "pl-waw-1",
102
+ "pl-waw-2",
103
+ "pl-waw-3"
104
+ ] });
105
+ }
106
+ };
107
+ //#endregion
108
+ 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/v1alpha1/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, 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';
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, marshalImportSnapshotFromS3Request, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, 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/v1alpha1/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
+ marshalImportSnapshotFromS3Request: () => marshalImportSnapshotFromS3Request,
18
+ marshalUpdateSnapshotRequest: () => marshalUpdateSnapshotRequest,
19
+ marshalUpdateVolumeRequest: () => marshalUpdateVolumeRequest,
20
+ unmarshalListSnapshotsResponse: () => unmarshalListSnapshotsResponse,
21
+ unmarshalListVolumeTypesResponse: () => unmarshalListVolumeTypesResponse,
22
+ unmarshalListVolumesResponse: () => unmarshalListVolumesResponse,
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, marshalImportSnapshotFromS3Request, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, unmarshalSnapshot, unmarshalVolume };
@@ -0,0 +1,14 @@
1
+ import type { DefaultValues } from '@scaleway/sdk-client';
2
+ import type { Snapshot, Volume, ListSnapshotsResponse, ListVolumeTypesResponse, ListVolumesResponse, CreateSnapshotRequest, CreateVolumeRequest, ExportSnapshotToObjectStorageRequest, ImportSnapshotFromObjectStorageRequest, ImportSnapshotFromS3Request, UpdateSnapshotRequest, UpdateVolumeRequest } from './types.gen.js';
3
+ export declare const unmarshalSnapshot: (data: unknown) => Snapshot;
4
+ export declare const unmarshalVolume: (data: unknown) => Volume;
5
+ export declare const unmarshalListSnapshotsResponse: (data: unknown) => ListSnapshotsResponse;
6
+ export declare const unmarshalListVolumeTypesResponse: (data: unknown) => ListVolumeTypesResponse;
7
+ export declare const unmarshalListVolumesResponse: (data: unknown) => ListVolumesResponse;
8
+ export declare const marshalCreateSnapshotRequest: (request: CreateSnapshotRequest, defaults: DefaultValues) => Record<string, unknown>;
9
+ export declare const marshalCreateVolumeRequest: (request: CreateVolumeRequest, defaults: DefaultValues) => Record<string, unknown>;
10
+ export declare const marshalExportSnapshotToObjectStorageRequest: (request: ExportSnapshotToObjectStorageRequest, defaults: DefaultValues) => Record<string, unknown>;
11
+ export declare const marshalImportSnapshotFromObjectStorageRequest: (request: ImportSnapshotFromObjectStorageRequest, defaults: DefaultValues) => Record<string, unknown>;
12
+ export declare const marshalImportSnapshotFromS3Request: (request: ImportSnapshotFromS3Request, 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,155 @@
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney } from "@scaleway/sdk-client";
2
+ import randomName from "@scaleway/random-name";
3
+ //#region src/v1alpha1/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
+ references: unmarshalArrayOfObject(data.references, unmarshalReference),
34
+ size: data.size,
35
+ status: data.status,
36
+ tags: data.tags,
37
+ updatedAt: unmarshalDate(data.updated_at),
38
+ zone: data.zone
39
+ };
40
+ };
41
+ const unmarshalVolumeSpecifications = (data) => {
42
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`);
43
+ return {
44
+ class: data.class,
45
+ perfIops: data.perf_iops
46
+ };
47
+ };
48
+ const unmarshalVolume = (data) => {
49
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
50
+ return {
51
+ createdAt: unmarshalDate(data.created_at),
52
+ id: data.id,
53
+ lastDetachedAt: unmarshalDate(data.last_detached_at),
54
+ name: data.name,
55
+ parentSnapshotId: data.parent_snapshot_id,
56
+ projectId: data.project_id,
57
+ references: unmarshalArrayOfObject(data.references, unmarshalReference),
58
+ size: data.size,
59
+ specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
60
+ status: data.status,
61
+ tags: data.tags,
62
+ type: data.type,
63
+ updatedAt: unmarshalDate(data.updated_at),
64
+ zone: data.zone
65
+ };
66
+ };
67
+ const unmarshalListSnapshotsResponse = (data) => {
68
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
69
+ return {
70
+ snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
71
+ totalCount: data.total_count
72
+ };
73
+ };
74
+ const unmarshalVolumeType = (data) => {
75
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`);
76
+ return {
77
+ pricing: data.pricing ? unmarshalMoney(data.pricing) : void 0,
78
+ snapshotPricing: data.snapshot_pricing ? unmarshalMoney(data.snapshot_pricing) : void 0,
79
+ specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
80
+ type: data.type
81
+ };
82
+ };
83
+ const unmarshalListVolumeTypesResponse = (data) => {
84
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVolumeTypesResponse' failed as data isn't a dictionary.`);
85
+ return {
86
+ totalCount: data.total_count,
87
+ volumeTypes: unmarshalArrayOfObject(data.volume_types, unmarshalVolumeType)
88
+ };
89
+ };
90
+ const unmarshalListVolumesResponse = (data) => {
91
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`);
92
+ return {
93
+ totalCount: data.total_count,
94
+ volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
95
+ };
96
+ };
97
+ const marshalCreateSnapshotRequest = (request, defaults) => ({
98
+ name: request.name || randomName("snp"),
99
+ project_id: request.projectId ?? defaults.defaultProjectId,
100
+ tags: request.tags,
101
+ volume_id: request.volumeId
102
+ });
103
+ const marshalCreateVolumeRequestFromEmpty = (request, defaults) => ({ size: request.size });
104
+ const marshalCreateVolumeRequestFromSnapshot = (request, defaults) => ({
105
+ size: request.size,
106
+ snapshot_id: request.snapshotId
107
+ });
108
+ const marshalCreateVolumeRequest = (request, defaults) => ({
109
+ name: request.name || randomName("vol"),
110
+ project_id: request.projectId ?? defaults.defaultProjectId,
111
+ tags: request.tags,
112
+ ...resolveOneOf([{
113
+ param: "from_empty",
114
+ value: request.fromEmpty !== void 0 ? marshalCreateVolumeRequestFromEmpty(request.fromEmpty, defaults) : void 0
115
+ }, {
116
+ param: "from_snapshot",
117
+ value: request.fromSnapshot !== void 0 ? marshalCreateVolumeRequestFromSnapshot(request.fromSnapshot, defaults) : void 0
118
+ }]),
119
+ ...resolveOneOf([{
120
+ param: "perf_iops",
121
+ value: request.perfIops
122
+ }])
123
+ });
124
+ const marshalExportSnapshotToObjectStorageRequest = (request, defaults) => ({
125
+ bucket: request.bucket,
126
+ key: request.key
127
+ });
128
+ const marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
129
+ bucket: request.bucket,
130
+ key: request.key,
131
+ name: request.name,
132
+ project_id: request.projectId ?? defaults.defaultProjectId,
133
+ size: request.size,
134
+ tags: request.tags
135
+ });
136
+ const marshalImportSnapshotFromS3Request = (request, defaults) => ({
137
+ bucket: request.bucket,
138
+ key: request.key,
139
+ name: request.name,
140
+ project_id: request.projectId ?? defaults.defaultProjectId,
141
+ size: request.size,
142
+ tags: request.tags
143
+ });
144
+ const marshalUpdateSnapshotRequest = (request, defaults) => ({
145
+ name: request.name,
146
+ tags: request.tags
147
+ });
148
+ const marshalUpdateVolumeRequest = (request, defaults) => ({
149
+ name: request.name,
150
+ perf_iops: request.perfIops,
151
+ size: request.size,
152
+ tags: request.tags
153
+ });
154
+ //#endregion
155
+ export { marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotToObjectStorageRequest, marshalImportSnapshotFromObjectStorageRequest, marshalImportSnapshotFromS3Request, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, unmarshalSnapshot, unmarshalVolume };
@@ -0,0 +1,61 @@
1
+ export declare const queriesMetadata: {
2
+ readonly namespace: 'block';
3
+ readonly version: 'v1alpha1';
4
+ readonly folderName: 'blockv1alpha1';
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;
@@ -0,0 +1,69 @@
1
+ //#region src/v1alpha1/metadata.gen.ts
2
+ const queriesMetadata = {
3
+ namespace: "block",
4
+ version: "v1alpha1",
5
+ folderName: "blockv1alpha1",
6
+ services: [{
7
+ apiClass: "API",
8
+ methods: [
9
+ {
10
+ methodName: "listVolumeTypes",
11
+ protoName: "ListVolumeTypes",
12
+ paramsType: "ListVolumeTypesRequest",
13
+ returnType: "ListVolumeTypesResponse",
14
+ isList: true,
15
+ paginationType: "offset",
16
+ pageParamKey: "page",
17
+ listItemType: "VolumeType",
18
+ isPrivate: false,
19
+ description: "\""
20
+ },
21
+ {
22
+ methodName: "listVolumes",
23
+ protoName: "ListVolumes",
24
+ paramsType: "ListVolumesRequest",
25
+ returnType: "ListVolumesResponse",
26
+ isList: true,
27
+ paginationType: "offset",
28
+ pageParamKey: "page",
29
+ listItemType: "Volume",
30
+ isPrivate: false,
31
+ description: "\""
32
+ },
33
+ {
34
+ methodName: "getVolume",
35
+ protoName: "GetVolume",
36
+ paramsType: "GetVolumeRequest",
37
+ returnType: "Volume",
38
+ isList: false,
39
+ paginationType: "none",
40
+ isPrivate: false,
41
+ description: "\""
42
+ },
43
+ {
44
+ methodName: "listSnapshots",
45
+ protoName: "ListSnapshots",
46
+ paramsType: "ListSnapshotsRequest",
47
+ returnType: "ListSnapshotsResponse",
48
+ isList: true,
49
+ paginationType: "offset",
50
+ pageParamKey: "page",
51
+ listItemType: "Snapshot",
52
+ isPrivate: false,
53
+ description: "\""
54
+ },
55
+ {
56
+ methodName: "getSnapshot",
57
+ protoName: "GetSnapshot",
58
+ paramsType: "GetSnapshotRequest",
59
+ returnType: "Snapshot",
60
+ isList: false,
61
+ paginationType: "none",
62
+ isPrivate: false,
63
+ description: "\""
64
+ }
65
+ ]
66
+ }]
67
+ };
68
+ //#endregion
69
+ export { queriesMetadata };