@scaleway/sdk-block 2.2.1 → 2.3.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.
@@ -1,198 +1,145 @@
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney } from "@scaleway/sdk-client";
1
2
  import randomName from "@scaleway/random-name";
2
- import { resolveOneOf, isJSONObject, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney } from "@scaleway/sdk-client";
3
3
  const unmarshalReference = (data) => {
4
- if (!isJSONObject(data)) {
5
- throw new TypeError(
6
- `Unmarshalling the type 'Reference' failed as data isn't a dictionary.`
7
- );
8
- }
9
- return {
10
- createdAt: unmarshalDate(data.created_at),
11
- id: data.id,
12
- productResourceId: data.product_resource_id,
13
- productResourceType: data.product_resource_type,
14
- status: data.status,
15
- type: data.type
16
- };
4
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Reference' failed as data isn't a dictionary.`);
5
+ return {
6
+ createdAt: unmarshalDate(data.created_at),
7
+ id: data.id,
8
+ productResourceId: data.product_resource_id,
9
+ productResourceType: data.product_resource_type,
10
+ status: data.status,
11
+ type: data.type
12
+ };
17
13
  };
18
- const unmarshalSnapshotParentVolume = (data) => {
19
- if (!isJSONObject(data)) {
20
- throw new TypeError(
21
- `Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`
22
- );
23
- }
24
- return {
25
- id: data.id,
26
- name: data.name,
27
- status: data.status,
28
- type: data.type
29
- };
14
+ var unmarshalSnapshotParentVolume = (data) => {
15
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`);
16
+ return {
17
+ id: data.id,
18
+ name: data.name,
19
+ status: data.status,
20
+ type: data.type
21
+ };
30
22
  };
31
23
  const unmarshalSnapshot = (data) => {
32
- if (!isJSONObject(data)) {
33
- throw new TypeError(
34
- `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`
35
- );
36
- }
37
- return {
38
- class: data.class,
39
- createdAt: unmarshalDate(data.created_at),
40
- id: data.id,
41
- name: data.name,
42
- parentVolume: data.parent_volume ? unmarshalSnapshotParentVolume(data.parent_volume) : void 0,
43
- projectId: data.project_id,
44
- references: unmarshalArrayOfObject(data.references, unmarshalReference),
45
- size: data.size,
46
- status: data.status,
47
- tags: data.tags,
48
- updatedAt: unmarshalDate(data.updated_at),
49
- zone: data.zone
50
- };
24
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`);
25
+ return {
26
+ class: data.class,
27
+ createdAt: unmarshalDate(data.created_at),
28
+ id: data.id,
29
+ name: data.name,
30
+ parentVolume: data.parent_volume ? unmarshalSnapshotParentVolume(data.parent_volume) : void 0,
31
+ projectId: data.project_id,
32
+ references: unmarshalArrayOfObject(data.references, unmarshalReference),
33
+ size: data.size,
34
+ status: data.status,
35
+ tags: data.tags,
36
+ updatedAt: unmarshalDate(data.updated_at),
37
+ zone: data.zone
38
+ };
51
39
  };
52
- const unmarshalVolumeSpecifications = (data) => {
53
- if (!isJSONObject(data)) {
54
- throw new TypeError(
55
- `Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`
56
- );
57
- }
58
- return {
59
- class: data.class,
60
- perfIops: data.perf_iops
61
- };
40
+ var unmarshalVolumeSpecifications = (data) => {
41
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`);
42
+ return {
43
+ class: data.class,
44
+ perfIops: data.perf_iops
45
+ };
62
46
  };
63
47
  const unmarshalVolume = (data) => {
64
- if (!isJSONObject(data)) {
65
- throw new TypeError(
66
- `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`
67
- );
68
- }
69
- return {
70
- createdAt: unmarshalDate(data.created_at),
71
- id: data.id,
72
- lastDetachedAt: unmarshalDate(data.last_detached_at),
73
- name: data.name,
74
- parentSnapshotId: data.parent_snapshot_id,
75
- projectId: data.project_id,
76
- references: unmarshalArrayOfObject(data.references, unmarshalReference),
77
- size: data.size,
78
- specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
79
- status: data.status,
80
- tags: data.tags,
81
- type: data.type,
82
- updatedAt: unmarshalDate(data.updated_at),
83
- zone: data.zone
84
- };
48
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
49
+ return {
50
+ createdAt: unmarshalDate(data.created_at),
51
+ id: data.id,
52
+ lastDetachedAt: unmarshalDate(data.last_detached_at),
53
+ name: data.name,
54
+ parentSnapshotId: data.parent_snapshot_id,
55
+ projectId: data.project_id,
56
+ references: unmarshalArrayOfObject(data.references, unmarshalReference),
57
+ size: data.size,
58
+ specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
59
+ status: data.status,
60
+ tags: data.tags,
61
+ type: data.type,
62
+ updatedAt: unmarshalDate(data.updated_at),
63
+ zone: data.zone
64
+ };
85
65
  };
86
66
  const unmarshalListSnapshotsResponse = (data) => {
87
- if (!isJSONObject(data)) {
88
- throw new TypeError(
89
- `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`
90
- );
91
- }
92
- return {
93
- snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
94
- totalCount: data.total_count
95
- };
67
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
68
+ return {
69
+ snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
70
+ totalCount: data.total_count
71
+ };
96
72
  };
97
- const unmarshalVolumeType = (data) => {
98
- if (!isJSONObject(data)) {
99
- throw new TypeError(
100
- `Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`
101
- );
102
- }
103
- return {
104
- pricing: data.pricing ? unmarshalMoney(data.pricing) : void 0,
105
- snapshotPricing: data.snapshot_pricing ? unmarshalMoney(data.snapshot_pricing) : void 0,
106
- specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
107
- type: data.type
108
- };
73
+ var unmarshalVolumeType = (data) => {
74
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`);
75
+ return {
76
+ pricing: data.pricing ? unmarshalMoney(data.pricing) : void 0,
77
+ snapshotPricing: data.snapshot_pricing ? unmarshalMoney(data.snapshot_pricing) : void 0,
78
+ specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : void 0,
79
+ type: data.type
80
+ };
109
81
  };
110
82
  const unmarshalListVolumeTypesResponse = (data) => {
111
- if (!isJSONObject(data)) {
112
- throw new TypeError(
113
- `Unmarshalling the type 'ListVolumeTypesResponse' failed as data isn't a dictionary.`
114
- );
115
- }
116
- return {
117
- totalCount: data.total_count,
118
- volumeTypes: unmarshalArrayOfObject(data.volume_types, unmarshalVolumeType)
119
- };
83
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVolumeTypesResponse' failed as data isn't a dictionary.`);
84
+ return {
85
+ totalCount: data.total_count,
86
+ volumeTypes: unmarshalArrayOfObject(data.volume_types, unmarshalVolumeType)
87
+ };
120
88
  };
121
89
  const unmarshalListVolumesResponse = (data) => {
122
- if (!isJSONObject(data)) {
123
- throw new TypeError(
124
- `Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`
125
- );
126
- }
127
- return {
128
- totalCount: data.total_count,
129
- volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
130
- };
90
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`);
91
+ return {
92
+ totalCount: data.total_count,
93
+ volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
94
+ };
131
95
  };
132
96
  const marshalCreateSnapshotRequest = (request, defaults) => ({
133
- name: request.name || randomName("snp"),
134
- project_id: request.projectId ?? defaults.defaultProjectId,
135
- tags: request.tags,
136
- volume_id: request.volumeId
97
+ name: request.name || randomName("snp"),
98
+ project_id: request.projectId ?? defaults.defaultProjectId,
99
+ tags: request.tags,
100
+ volume_id: request.volumeId
137
101
  });
138
- const marshalCreateVolumeRequestFromEmpty = (request, defaults) => ({
139
- size: request.size
140
- });
141
- const marshalCreateVolumeRequestFromSnapshot = (request, defaults) => ({
142
- size: request.size,
143
- snapshot_id: request.snapshotId
102
+ var marshalCreateVolumeRequestFromEmpty = (request, defaults) => ({ size: request.size });
103
+ var marshalCreateVolumeRequestFromSnapshot = (request, defaults) => ({
104
+ size: request.size,
105
+ snapshot_id: request.snapshotId
144
106
  });
145
107
  const marshalCreateVolumeRequest = (request, defaults) => ({
146
- name: request.name || randomName("vol"),
147
- project_id: request.projectId ?? defaults.defaultProjectId,
148
- tags: request.tags,
149
- ...resolveOneOf([
150
- {
151
- param: "from_empty",
152
- value: request.fromEmpty !== void 0 ? marshalCreateVolumeRequestFromEmpty(request.fromEmpty) : void 0
153
- },
154
- {
155
- param: "from_snapshot",
156
- value: request.fromSnapshot !== void 0 ? marshalCreateVolumeRequestFromSnapshot(
157
- request.fromSnapshot
158
- ) : void 0
159
- }
160
- ]),
161
- ...resolveOneOf([{ param: "perf_iops", value: request.perfIops }])
108
+ name: request.name || randomName("vol"),
109
+ project_id: request.projectId ?? defaults.defaultProjectId,
110
+ tags: request.tags,
111
+ ...resolveOneOf([{
112
+ param: "from_empty",
113
+ value: request.fromEmpty !== void 0 ? marshalCreateVolumeRequestFromEmpty(request.fromEmpty, defaults) : void 0
114
+ }, {
115
+ param: "from_snapshot",
116
+ value: request.fromSnapshot !== void 0 ? marshalCreateVolumeRequestFromSnapshot(request.fromSnapshot, defaults) : void 0
117
+ }]),
118
+ ...resolveOneOf([{
119
+ param: "perf_iops",
120
+ value: request.perfIops
121
+ }])
162
122
  });
163
123
  const marshalExportSnapshotToObjectStorageRequest = (request, defaults) => ({
164
- bucket: request.bucket,
165
- key: request.key
124
+ bucket: request.bucket,
125
+ key: request.key
166
126
  });
167
127
  const marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
168
- bucket: request.bucket,
169
- key: request.key,
170
- name: request.name,
171
- project_id: request.projectId ?? defaults.defaultProjectId,
172
- size: request.size,
173
- tags: request.tags
128
+ bucket: request.bucket,
129
+ key: request.key,
130
+ name: request.name,
131
+ project_id: request.projectId ?? defaults.defaultProjectId,
132
+ size: request.size,
133
+ tags: request.tags
174
134
  });
175
135
  const marshalUpdateSnapshotRequest = (request, defaults) => ({
176
- name: request.name,
177
- tags: request.tags
136
+ name: request.name,
137
+ tags: request.tags
178
138
  });
179
139
  const marshalUpdateVolumeRequest = (request, defaults) => ({
180
- name: request.name,
181
- perf_iops: request.perfIops,
182
- size: request.size,
183
- tags: request.tags
140
+ name: request.name,
141
+ perf_iops: request.perfIops,
142
+ size: request.size,
143
+ tags: request.tags
184
144
  });
185
- export {
186
- marshalCreateSnapshotRequest,
187
- marshalCreateVolumeRequest,
188
- marshalExportSnapshotToObjectStorageRequest,
189
- marshalImportSnapshotFromObjectStorageRequest,
190
- marshalUpdateSnapshotRequest,
191
- marshalUpdateVolumeRequest,
192
- unmarshalListSnapshotsResponse,
193
- unmarshalListVolumeTypesResponse,
194
- unmarshalListVolumesResponse,
195
- unmarshalReference,
196
- unmarshalSnapshot,
197
- unmarshalVolume
198
- };
145
+ export { marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotToObjectStorageRequest, marshalImportSnapshotFromObjectStorageRequest, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, unmarshalReference, unmarshalSnapshot, unmarshalVolume };
@@ -470,6 +470,10 @@ export type ListVolumesRequest = {
470
470
  * Filter by volume type.
471
471
  */
472
472
  volumeType?: string;
473
+ /**
474
+ * Filter by volume IDs.
475
+ */
476
+ volumeIds?: string[];
473
477
  };
474
478
  export interface ListVolumesResponse {
475
479
  /**
@@ -1,56 +1,36 @@
1
- const CreateSnapshotRequest = {
2
- name: {
3
- minLength: 1
4
- }
5
- };
6
- const CreateVolumeRequest = {
7
- name: {
8
- minLength: 1
9
- }
10
- };
11
- const ImportSnapshotFromObjectStorageRequest = {
12
- name: {
13
- minLength: 1
14
- }
15
- };
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({
3
+ CreateSnapshotRequest: () => CreateSnapshotRequest,
4
+ CreateVolumeRequest: () => CreateVolumeRequest,
5
+ ImportSnapshotFromObjectStorageRequest: () => ImportSnapshotFromObjectStorageRequest,
6
+ ListSnapshotsRequest: () => ListSnapshotsRequest,
7
+ ListVolumeTypesRequest: () => ListVolumeTypesRequest,
8
+ ListVolumesRequest: () => ListVolumesRequest,
9
+ Reference: () => Reference
10
+ });
11
+ const CreateSnapshotRequest = { name: { minLength: 1 } };
12
+ const CreateVolumeRequest = { name: { minLength: 1 } };
13
+ const ImportSnapshotFromObjectStorageRequest = { name: { minLength: 1 } };
16
14
  const ListSnapshotsRequest = {
17
- page: {
18
- greaterThan: 0
19
- },
20
- pageSize: {
21
- greaterThan: 0,
22
- lessThanOrEqual: 100
23
- }
15
+ page: { greaterThan: 0 },
16
+ pageSize: {
17
+ greaterThan: 0,
18
+ lessThanOrEqual: 100
19
+ }
24
20
  };
25
21
  const ListVolumeTypesRequest = {
26
- page: {
27
- greaterThan: 0
28
- },
29
- pageSize: {
30
- greaterThan: 0,
31
- lessThanOrEqual: 100
32
- }
22
+ page: { greaterThan: 0 },
23
+ pageSize: {
24
+ greaterThan: 0,
25
+ lessThanOrEqual: 100
26
+ }
33
27
  };
34
28
  const ListVolumesRequest = {
35
- page: {
36
- greaterThan: 0
37
- },
38
- pageSize: {
39
- greaterThan: 0,
40
- lessThanOrEqual: 100
41
- }
42
- };
43
- const Reference = {
44
- productResourceType: {
45
- minLength: 1
46
- }
47
- };
48
- export {
49
- CreateSnapshotRequest,
50
- CreateVolumeRequest,
51
- ImportSnapshotFromObjectStorageRequest,
52
- ListSnapshotsRequest,
53
- ListVolumeTypesRequest,
54
- ListVolumesRequest,
55
- Reference
56
- };
29
+ page: { greaterThan: 0 },
30
+ pageSize: {
31
+ greaterThan: 0,
32
+ lessThanOrEqual: 100
33
+ }
34
+ };
35
+ const Reference = { productResourceType: { minLength: 1 } };
36
+ export { validation_rules_gen_exports };