@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.
- package/README.md +1 -1
- package/dist/_virtual/_rolldown/runtime.js +11 -0
- package/dist/index.gen.js +3 -6
- package/dist/v1/api.gen.js +193 -292
- package/dist/v1/content.gen.js +15 -16
- package/dist/v1/index.gen.d.ts +1 -1
- package/dist/v1/index.gen.js +23 -21
- package/dist/v1/marshalling.gen.js +116 -169
- package/dist/v1/types.gen.d.ts +4 -0
- package/dist/v1/validation-rules.gen.js +31 -51
- package/dist/v1alpha1/api.gen.js +208 -309
- package/dist/v1alpha1/content.gen.js +15 -16
- package/dist/v1alpha1/index.gen.d.ts +1 -1
- package/dist/v1alpha1/index.gen.js +23 -21
- package/dist/v1alpha1/marshalling.gen.js +123 -176
- package/dist/v1alpha1/validation-rules.gen.js +33 -57
- package/package.json +4 -4
|
@@ -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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
|
|
165
|
-
|
|
124
|
+
bucket: request.bucket,
|
|
125
|
+
key: request.key
|
|
166
126
|
});
|
|
167
127
|
const marshalImportSnapshotFromObjectStorageRequest = (request, defaults) => ({
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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
|
-
|
|
177
|
-
|
|
136
|
+
name: request.name,
|
|
137
|
+
tags: request.tags
|
|
178
138
|
});
|
|
179
139
|
const marshalUpdateVolumeRequest = (request, defaults) => ({
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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 };
|
package/dist/v1/types.gen.d.ts
CHANGED
|
@@ -1,56 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
lessThanOrEqual: 100
|
|
23
|
-
}
|
|
15
|
+
page: { greaterThan: 0 },
|
|
16
|
+
pageSize: {
|
|
17
|
+
greaterThan: 0,
|
|
18
|
+
lessThanOrEqual: 100
|
|
19
|
+
}
|
|
24
20
|
};
|
|
25
21
|
const ListVolumeTypesRequest = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
lessThanOrEqual: 100
|
|
32
|
-
}
|
|
22
|
+
page: { greaterThan: 0 },
|
|
23
|
+
pageSize: {
|
|
24
|
+
greaterThan: 0,
|
|
25
|
+
lessThanOrEqual: 100
|
|
26
|
+
}
|
|
33
27
|
};
|
|
34
28
|
const ListVolumesRequest = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 };
|