@scaleway/sdk-block 2.2.2 → 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,209 +1,153 @@
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
- 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
- };
3
+ var unmarshalReference = (data) => {
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(request.fromSnapshot) : void 0
157
- }
158
- ]),
159
- ...resolveOneOf([
160
- {
161
- param: "perf_iops",
162
- value: request.perfIops
163
- }
164
- ])
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
+ }])
165
122
  });
166
123
  const marshalExportSnapshotToObjectStorageRequest = (request, defaults) => ({
167
- bucket: request.bucket,
168
- key: request.key
124
+ bucket: request.bucket,
125
+ key: request.key
169
126
  });
170
127
  const marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
171
- bucket: request.bucket,
172
- key: request.key,
173
- name: request.name,
174
- project_id: request.projectId ?? defaults.defaultProjectId,
175
- size: request.size,
176
- 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
177
134
  });
178
135
  const marshalImportSnapshotFromS3Request = (request, defaults) => ({
179
- bucket: request.bucket,
180
- key: request.key,
181
- name: request.name,
182
- project_id: request.projectId ?? defaults.defaultProjectId,
183
- size: request.size,
184
- tags: request.tags
136
+ bucket: request.bucket,
137
+ key: request.key,
138
+ name: request.name,
139
+ project_id: request.projectId ?? defaults.defaultProjectId,
140
+ size: request.size,
141
+ tags: request.tags
185
142
  });
186
143
  const marshalUpdateSnapshotRequest = (request, defaults) => ({
187
- name: request.name,
188
- tags: request.tags
144
+ name: request.name,
145
+ tags: request.tags
189
146
  });
190
147
  const marshalUpdateVolumeRequest = (request, defaults) => ({
191
- name: request.name,
192
- perf_iops: request.perfIops,
193
- size: request.size,
194
- tags: request.tags
148
+ name: request.name,
149
+ perf_iops: request.perfIops,
150
+ size: request.size,
151
+ tags: request.tags
195
152
  });
196
- export {
197
- marshalCreateSnapshotRequest,
198
- marshalCreateVolumeRequest,
199
- marshalExportSnapshotToObjectStorageRequest,
200
- marshalImportSnapshotFromObjectStorageRequest,
201
- marshalImportSnapshotFromS3Request,
202
- marshalUpdateSnapshotRequest,
203
- marshalUpdateVolumeRequest,
204
- unmarshalListSnapshotsResponse,
205
- unmarshalListVolumeTypesResponse,
206
- unmarshalListVolumesResponse,
207
- unmarshalSnapshot,
208
- unmarshalVolume
209
- };
153
+ export { marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotToObjectStorageRequest, marshalImportSnapshotFromObjectStorageRequest, marshalImportSnapshotFromS3Request, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, unmarshalSnapshot, unmarshalVolume };
@@ -1,62 +1,38 @@
1
- const CreateSnapshotRequest = {
2
- name: {
3
- minLength: 1
4
- }
5
- };
6
- const CreateVolumeRequest = {
7
- name: {
8
- minLength: 1
9
- }
10
- };
11
- const ImportSnapshotFromObjectStorageRequest = {
12
- name: {
13
- minLength: 1
14
- }
15
- };
16
- const ImportSnapshotFromS3Request = {
17
- name: {
18
- minLength: 1
19
- }
20
- };
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
+ ImportSnapshotFromS3Request: () => ImportSnapshotFromS3Request,
7
+ ListSnapshotsRequest: () => ListSnapshotsRequest,
8
+ ListVolumeTypesRequest: () => ListVolumeTypesRequest,
9
+ ListVolumesRequest: () => ListVolumesRequest,
10
+ Reference: () => Reference
11
+ });
12
+ const CreateSnapshotRequest = { name: { minLength: 1 } };
13
+ const CreateVolumeRequest = { name: { minLength: 1 } };
14
+ const ImportSnapshotFromObjectStorageRequest = { name: { minLength: 1 } };
15
+ const ImportSnapshotFromS3Request = { name: { minLength: 1 } };
21
16
  const ListSnapshotsRequest = {
22
- page: {
23
- greaterThan: 0
24
- },
25
- pageSize: {
26
- greaterThan: 0,
27
- lessThanOrEqual: 100
28
- }
17
+ page: { greaterThan: 0 },
18
+ pageSize: {
19
+ greaterThan: 0,
20
+ lessThanOrEqual: 100
21
+ }
29
22
  };
30
23
  const ListVolumeTypesRequest = {
31
- page: {
32
- greaterThan: 0
33
- },
34
- pageSize: {
35
- greaterThan: 0,
36
- lessThanOrEqual: 100
37
- }
24
+ page: { greaterThan: 0 },
25
+ pageSize: {
26
+ greaterThan: 0,
27
+ lessThanOrEqual: 100
28
+ }
38
29
  };
39
30
  const ListVolumesRequest = {
40
- page: {
41
- greaterThan: 0
42
- },
43
- pageSize: {
44
- greaterThan: 0,
45
- lessThanOrEqual: 100
46
- }
47
- };
48
- const Reference = {
49
- productResourceType: {
50
- minLength: 1
51
- }
52
- };
53
- export {
54
- CreateSnapshotRequest,
55
- CreateVolumeRequest,
56
- ImportSnapshotFromObjectStorageRequest,
57
- ImportSnapshotFromS3Request,
58
- ListSnapshotsRequest,
59
- ListVolumeTypesRequest,
60
- ListVolumesRequest,
61
- Reference
62
- };
31
+ page: { greaterThan: 0 },
32
+ pageSize: {
33
+ greaterThan: 0,
34
+ lessThanOrEqual: 100
35
+ }
36
+ };
37
+ const Reference = { productResourceType: { minLength: 1 } };
38
+ export { validation_rules_gen_exports };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-block",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "description": "Scaleway SDK block",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@scaleway/random-name": "5.1.2",
30
- "@scaleway/sdk-std": "2.1.1"
30
+ "@scaleway/sdk-std": "2.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@scaleway/sdk-client": "^2.1.0"
33
+ "@scaleway/sdk-client": "^2.2.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@scaleway/sdk-client": "^2.1.0"
36
+ "@scaleway/sdk-client": "^2.2.0"
37
37
  },
38
38
  "scripts": {
39
39
  "package:check": "pnpm publint",