@scaleway/sdk 2.50.0 → 2.51.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 (57) hide show
  1. package/dist/api/applesilicon/v1alpha1/marshalling.gen.cjs +1 -0
  2. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +1 -0
  3. package/dist/api/applesilicon/v1alpha1/types.gen.d.ts +8 -0
  4. package/dist/api/baremetal/v1/marshalling.gen.cjs +3 -1
  5. package/dist/api/baremetal/v1/marshalling.gen.js +3 -1
  6. package/dist/api/baremetal/v1/types.gen.d.ts +4 -3
  7. package/dist/api/edge_services/v1alpha1/api.gen.cjs +27 -2
  8. package/dist/api/edge_services/v1alpha1/api.gen.d.ts +10 -3
  9. package/dist/api/edge_services/v1alpha1/api.gen.js +28 -3
  10. package/dist/api/edge_services/v1alpha1/index.gen.d.ts +1 -1
  11. package/dist/api/edge_services/v1alpha1/marshalling.gen.cjs +30 -0
  12. package/dist/api/edge_services/v1alpha1/marshalling.gen.d.ts +3 -1
  13. package/dist/api/edge_services/v1alpha1/marshalling.gen.js +30 -0
  14. package/dist/api/edge_services/v1alpha1/types.gen.d.ts +45 -9
  15. package/dist/api/iam/v1alpha1/marshalling.gen.cjs +1 -0
  16. package/dist/api/iam/v1alpha1/marshalling.gen.js +1 -0
  17. package/dist/api/iam/v1alpha1/types.gen.d.ts +2 -0
  18. package/dist/api/index.gen.d.ts +2 -1
  19. package/dist/api/inference/v1beta1/validation-rules.gen.cjs +1 -1
  20. package/dist/api/inference/v1beta1/validation-rules.gen.js +1 -1
  21. package/dist/api/instance/v1/api.gen.cjs +0 -37
  22. package/dist/api/instance/v1/api.gen.d.ts +1 -21
  23. package/dist/api/instance/v1/api.gen.js +1 -38
  24. package/dist/api/instance/v1/index.gen.d.ts +1 -1
  25. package/dist/api/instance/v1/marshalling.gen.cjs +1 -28
  26. package/dist/api/instance/v1/marshalling.gen.d.ts +1 -3
  27. package/dist/api/instance/v1/marshalling.gen.js +1 -28
  28. package/dist/api/instance/v1/types.gen.d.ts +9 -53
  29. package/dist/api/instance/v1/types.private.gen.d.ts +1 -3
  30. package/dist/api/jobs/v1alpha1/validation-rules.gen.cjs +2 -2
  31. package/dist/api/jobs/v1alpha1/validation-rules.gen.js +2 -2
  32. package/dist/api/mongodb/index.gen.cjs +4 -0
  33. package/dist/api/mongodb/index.gen.d.ts +5 -0
  34. package/dist/api/mongodb/index.gen.js +4 -0
  35. package/dist/api/mongodb/v1alpha1/api.gen.cjs +385 -0
  36. package/dist/api/mongodb/v1alpha1/api.gen.d.ts +195 -0
  37. package/dist/api/mongodb/v1alpha1/api.gen.js +385 -0
  38. package/dist/api/mongodb/v1alpha1/content.gen.cjs +16 -0
  39. package/dist/api/mongodb/v1alpha1/content.gen.d.ts +5 -0
  40. package/dist/api/mongodb/v1alpha1/content.gen.js +16 -0
  41. package/dist/api/mongodb/v1alpha1/index.gen.cjs +9 -0
  42. package/dist/api/mongodb/v1alpha1/index.gen.d.ts +4 -0
  43. package/dist/api/mongodb/v1alpha1/index.gen.js +9 -0
  44. package/dist/api/mongodb/v1alpha1/marshalling.gen.cjs +326 -0
  45. package/dist/api/mongodb/v1alpha1/marshalling.gen.d.ts +19 -0
  46. package/dist/api/mongodb/v1alpha1/marshalling.gen.js +326 -0
  47. package/dist/api/mongodb/v1alpha1/types.gen.d.ts +461 -0
  48. package/dist/api/mongodb/v1alpha1/validation-rules.gen.cjs +147 -0
  49. package/dist/api/mongodb/v1alpha1/validation-rules.gen.d.ts +134 -0
  50. package/dist/api/mongodb/v1alpha1/validation-rules.gen.js +147 -0
  51. package/dist/api/webhosting/v1alpha1/types.gen.d.ts +1 -1
  52. package/dist/index.cjs +16 -14
  53. package/dist/index.js +16 -14
  54. package/dist/scw/constants.cjs +1 -1
  55. package/dist/scw/constants.d.ts +2 -2
  56. package/dist/scw/constants.js +1 -1
  57. package/package.json +2 -2
@@ -0,0 +1,326 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const json = require("../../../helpers/json.cjs");
4
+ const marshalling = require("../../../helpers/marshalling.cjs");
5
+ require("../../../vendor/base64/index.cjs");
6
+ const unmarshalEndpointPrivateNetworkDetails = (data) => {
7
+ if (!json.isJSONObject(data)) {
8
+ throw new TypeError(
9
+ `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
10
+ );
11
+ }
12
+ return {
13
+ privateNetworkId: data.private_network_id
14
+ };
15
+ };
16
+ const unmarshalEndpointPublicDetails = (data) => {
17
+ if (!json.isJSONObject(data)) {
18
+ throw new TypeError(
19
+ `Unmarshalling the type 'EndpointPublicDetails' failed as data isn't a dictionary.`
20
+ );
21
+ }
22
+ return {};
23
+ };
24
+ const unmarshalEndpoint = (data) => {
25
+ if (!json.isJSONObject(data)) {
26
+ throw new TypeError(
27
+ `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
28
+ );
29
+ }
30
+ return {
31
+ dnsRecords: data.dns_records,
32
+ id: data.id,
33
+ ips: data.ips,
34
+ port: data.port,
35
+ privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
36
+ public: data.public ? unmarshalEndpointPublicDetails(data.public) : void 0
37
+ };
38
+ };
39
+ const unmarshalInstanceSetting = (data) => {
40
+ if (!json.isJSONObject(data)) {
41
+ throw new TypeError(
42
+ `Unmarshalling the type 'InstanceSetting' failed as data isn't a dictionary.`
43
+ );
44
+ }
45
+ return {
46
+ name: data.name,
47
+ value: data.value
48
+ };
49
+ };
50
+ const unmarshalVolume = (data) => {
51
+ if (!json.isJSONObject(data)) {
52
+ throw new TypeError(
53
+ `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`
54
+ );
55
+ }
56
+ return {
57
+ size: data.size,
58
+ type: data.type
59
+ };
60
+ };
61
+ const unmarshalInstance = (data) => {
62
+ if (!json.isJSONObject(data)) {
63
+ throw new TypeError(
64
+ `Unmarshalling the type 'Instance' failed as data isn't a dictionary.`
65
+ );
66
+ }
67
+ return {
68
+ createdAt: marshalling.unmarshalDate(data.created_at),
69
+ endpoints: marshalling.unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
70
+ id: data.id,
71
+ name: data.name,
72
+ nodeNumber: data.node_number,
73
+ nodeType: data.node_type,
74
+ projectId: data.project_id,
75
+ region: data.region,
76
+ settings: marshalling.unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting),
77
+ status: data.status,
78
+ tags: data.tags,
79
+ version: data.version,
80
+ volume: data.volume ? unmarshalVolume(data.volume) : void 0
81
+ };
82
+ };
83
+ const unmarshalSnapshotVolumeType = (data) => {
84
+ if (!json.isJSONObject(data)) {
85
+ throw new TypeError(
86
+ `Unmarshalling the type 'SnapshotVolumeType' failed as data isn't a dictionary.`
87
+ );
88
+ }
89
+ return {
90
+ type: data.type
91
+ };
92
+ };
93
+ const unmarshalSnapshot = (data) => {
94
+ if (!json.isJSONObject(data)) {
95
+ throw new TypeError(
96
+ `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`
97
+ );
98
+ }
99
+ return {
100
+ createdAt: marshalling.unmarshalDate(data.created_at),
101
+ expiresAt: marshalling.unmarshalDate(data.expires_at),
102
+ id: data.id,
103
+ instanceId: data.instance_id,
104
+ instanceName: data.instance_name,
105
+ name: data.name,
106
+ nodeType: data.node_type,
107
+ region: data.region,
108
+ size: data.size,
109
+ status: data.status,
110
+ updatedAt: marshalling.unmarshalDate(data.updated_at),
111
+ volumeType: data.volume_type ? unmarshalSnapshotVolumeType(data.volume_type) : void 0
112
+ };
113
+ };
114
+ const unmarshalUser = (data) => {
115
+ if (!json.isJSONObject(data)) {
116
+ throw new TypeError(
117
+ `Unmarshalling the type 'User' failed as data isn't a dictionary.`
118
+ );
119
+ }
120
+ return {
121
+ name: data.name
122
+ };
123
+ };
124
+ const unmarshalListInstancesResponse = (data) => {
125
+ if (!json.isJSONObject(data)) {
126
+ throw new TypeError(
127
+ `Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`
128
+ );
129
+ }
130
+ return {
131
+ instances: marshalling.unmarshalArrayOfObject(data.instances, unmarshalInstance),
132
+ totalCount: data.total_count
133
+ };
134
+ };
135
+ const unmarshalNodeTypeVolumeType = (data) => {
136
+ if (!json.isJSONObject(data)) {
137
+ throw new TypeError(
138
+ `Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`
139
+ );
140
+ }
141
+ return {
142
+ chunkSize: data.chunk_size,
143
+ description: data.description,
144
+ maxSize: data.max_size,
145
+ minSize: data.min_size,
146
+ type: data.type
147
+ };
148
+ };
149
+ const unmarshalNodeType = (data) => {
150
+ if (!json.isJSONObject(data)) {
151
+ throw new TypeError(
152
+ `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
153
+ );
154
+ }
155
+ return {
156
+ availableVolumeTypes: marshalling.unmarshalArrayOfObject(
157
+ data.available_volume_types,
158
+ unmarshalNodeTypeVolumeType
159
+ ),
160
+ beta: data.beta,
161
+ description: data.description,
162
+ disabled: data.disabled,
163
+ instanceRange: data.instance_range,
164
+ memory: data.memory,
165
+ name: data.name,
166
+ stockStatus: data.stock_status,
167
+ vcpus: data.vcpus
168
+ };
169
+ };
170
+ const unmarshalListNodeTypesResponse = (data) => {
171
+ if (!json.isJSONObject(data)) {
172
+ throw new TypeError(
173
+ `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
174
+ );
175
+ }
176
+ return {
177
+ nodeTypes: marshalling.unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
178
+ totalCount: data.total_count
179
+ };
180
+ };
181
+ const unmarshalListSnapshotsResponse = (data) => {
182
+ if (!json.isJSONObject(data)) {
183
+ throw new TypeError(
184
+ `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`
185
+ );
186
+ }
187
+ return {
188
+ snapshots: marshalling.unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
189
+ totalCount: data.total_count
190
+ };
191
+ };
192
+ const unmarshalListUsersResponse = (data) => {
193
+ if (!json.isJSONObject(data)) {
194
+ throw new TypeError(
195
+ `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`
196
+ );
197
+ }
198
+ return {
199
+ totalCount: data.total_count,
200
+ users: marshalling.unmarshalArrayOfObject(data.users, unmarshalUser)
201
+ };
202
+ };
203
+ const unmarshalSetting = (data) => {
204
+ if (!json.isJSONObject(data)) {
205
+ throw new TypeError(
206
+ `Unmarshalling the type 'Setting' failed as data isn't a dictionary.`
207
+ );
208
+ }
209
+ return {
210
+ defaultValue: data.default_value,
211
+ description: data.description,
212
+ floatMax: data.float_max,
213
+ floatMin: data.float_min,
214
+ hotConfigurable: data.hot_configurable,
215
+ intMax: data.int_max,
216
+ intMin: data.int_min,
217
+ name: data.name,
218
+ propertyType: data.property_type,
219
+ stringConstraint: data.string_constraint,
220
+ unit: data.unit
221
+ };
222
+ };
223
+ const unmarshalVersion = (data) => {
224
+ if (!json.isJSONObject(data)) {
225
+ throw new TypeError(
226
+ `Unmarshalling the type 'Version' failed as data isn't a dictionary.`
227
+ );
228
+ }
229
+ return {
230
+ availableSettings: marshalling.unmarshalArrayOfObject(
231
+ data.available_settings,
232
+ unmarshalSetting
233
+ ),
234
+ endOfLifeAt: marshalling.unmarshalDate(data.end_of_life_at),
235
+ version: data.version
236
+ };
237
+ };
238
+ const unmarshalListVersionsResponse = (data) => {
239
+ if (!json.isJSONObject(data)) {
240
+ throw new TypeError(
241
+ `Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`
242
+ );
243
+ }
244
+ return {
245
+ totalCount: data.total_count,
246
+ versions: marshalling.unmarshalArrayOfObject(data.versions, unmarshalVersion)
247
+ };
248
+ };
249
+ const marshalEndpointSpecPrivateNetworkDetails = (request, defaults) => ({
250
+ private_network_id: request.privateNetworkId
251
+ });
252
+ const marshalEndpointSpecPublicDetails = (request, defaults) => ({});
253
+ const marshalCreateInstanceRequestVolumeDetails = (request, defaults) => ({
254
+ volume_size: request.volumeSize,
255
+ volume_type: request.volumeType
256
+ });
257
+ const marshalEndpointSpec = (request, defaults) => ({
258
+ ...marshalling.resolveOneOf([
259
+ {
260
+ param: "public",
261
+ value: request.public !== void 0 ? marshalEndpointSpecPublicDetails(request.public) : void 0
262
+ },
263
+ {
264
+ param: "private_network",
265
+ value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetworkDetails(
266
+ request.privateNetwork
267
+ ) : void 0
268
+ }
269
+ ])
270
+ });
271
+ const marshalCreateInstanceRequest = (request, defaults) => ({
272
+ endpoints: request.endpoints !== void 0 ? request.endpoints.map((elt) => marshalEndpointSpec(elt)) : void 0,
273
+ name: request.name,
274
+ node_number: request.nodeNumber,
275
+ node_type: request.nodeType,
276
+ password: request.password,
277
+ project_id: request.projectId ?? defaults.defaultProjectId,
278
+ tags: request.tags,
279
+ user_name: request.userName,
280
+ version: request.version,
281
+ volume: request.volume !== void 0 ? marshalCreateInstanceRequestVolumeDetails(request.volume) : void 0
282
+ });
283
+ const marshalCreateSnapshotRequest = (request, defaults) => ({
284
+ expires_at: request.expiresAt,
285
+ name: request.name
286
+ });
287
+ const marshalRestoreSnapshotRequestVolumeDetails = (request, defaults) => ({
288
+ volume_type: request.volumeType
289
+ });
290
+ const marshalRestoreSnapshotRequest = (request, defaults) => ({
291
+ instance_name: request.instanceName,
292
+ node_number: request.nodeNumber,
293
+ node_type: request.nodeType,
294
+ volume: marshalRestoreSnapshotRequestVolumeDetails(request.volume)
295
+ });
296
+ const marshalUpdateInstanceRequest = (request, defaults) => ({
297
+ name: request.name,
298
+ tags: request.tags
299
+ });
300
+ const marshalUpdateSnapshotRequest = (request, defaults) => ({
301
+ expires_at: request.expiresAt,
302
+ name: request.name
303
+ });
304
+ const marshalUpdateUserRequest = (request, defaults) => ({
305
+ password: request.password
306
+ });
307
+ const marshalUpgradeInstanceRequest = (request, defaults) => ({
308
+ ...marshalling.resolveOneOf([{ param: "volume_size", value: request.volumeSize }])
309
+ });
310
+ exports.marshalCreateInstanceRequest = marshalCreateInstanceRequest;
311
+ exports.marshalCreateSnapshotRequest = marshalCreateSnapshotRequest;
312
+ exports.marshalRestoreSnapshotRequest = marshalRestoreSnapshotRequest;
313
+ exports.marshalUpdateInstanceRequest = marshalUpdateInstanceRequest;
314
+ exports.marshalUpdateSnapshotRequest = marshalUpdateSnapshotRequest;
315
+ exports.marshalUpdateUserRequest = marshalUpdateUserRequest;
316
+ exports.marshalUpgradeInstanceRequest = marshalUpgradeInstanceRequest;
317
+ exports.unmarshalInstance = unmarshalInstance;
318
+ exports.unmarshalInstanceSetting = unmarshalInstanceSetting;
319
+ exports.unmarshalListInstancesResponse = unmarshalListInstancesResponse;
320
+ exports.unmarshalListNodeTypesResponse = unmarshalListNodeTypesResponse;
321
+ exports.unmarshalListSnapshotsResponse = unmarshalListSnapshotsResponse;
322
+ exports.unmarshalListUsersResponse = unmarshalListUsersResponse;
323
+ exports.unmarshalListVersionsResponse = unmarshalListVersionsResponse;
324
+ exports.unmarshalSnapshot = unmarshalSnapshot;
325
+ exports.unmarshalUser = unmarshalUser;
326
+ exports.unmarshalVolume = unmarshalVolume;
@@ -0,0 +1,19 @@
1
+ import type { DefaultValues } from '../../../bridge';
2
+ import type { CreateInstanceRequest, CreateSnapshotRequest, Instance, InstanceSetting, ListInstancesResponse, ListNodeTypesResponse, ListSnapshotsResponse, ListUsersResponse, ListVersionsResponse, RestoreSnapshotRequest, Snapshot, UpdateInstanceRequest, UpdateSnapshotRequest, UpdateUserRequest, UpgradeInstanceRequest, User, Volume } from './types.gen';
3
+ export declare const unmarshalInstanceSetting: (data: unknown) => InstanceSetting;
4
+ export declare const unmarshalVolume: (data: unknown) => Volume;
5
+ export declare const unmarshalInstance: (data: unknown) => Instance;
6
+ export declare const unmarshalSnapshot: (data: unknown) => Snapshot;
7
+ export declare const unmarshalUser: (data: unknown) => User;
8
+ export declare const unmarshalListInstancesResponse: (data: unknown) => ListInstancesResponse;
9
+ export declare const unmarshalListNodeTypesResponse: (data: unknown) => ListNodeTypesResponse;
10
+ export declare const unmarshalListSnapshotsResponse: (data: unknown) => ListSnapshotsResponse;
11
+ export declare const unmarshalListUsersResponse: (data: unknown) => ListUsersResponse;
12
+ export declare const unmarshalListVersionsResponse: (data: unknown) => ListVersionsResponse;
13
+ export declare const marshalCreateInstanceRequest: (request: CreateInstanceRequest, defaults: DefaultValues) => Record<string, unknown>;
14
+ export declare const marshalCreateSnapshotRequest: (request: CreateSnapshotRequest, defaults: DefaultValues) => Record<string, unknown>;
15
+ export declare const marshalRestoreSnapshotRequest: (request: RestoreSnapshotRequest, defaults: DefaultValues) => Record<string, unknown>;
16
+ export declare const marshalUpdateInstanceRequest: (request: UpdateInstanceRequest, defaults: DefaultValues) => Record<string, unknown>;
17
+ export declare const marshalUpdateSnapshotRequest: (request: UpdateSnapshotRequest, defaults: DefaultValues) => Record<string, unknown>;
18
+ export declare const marshalUpdateUserRequest: (request: UpdateUserRequest, defaults: DefaultValues) => Record<string, unknown>;
19
+ export declare const marshalUpgradeInstanceRequest: (request: UpgradeInstanceRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -0,0 +1,326 @@
1
+ import { isJSONObject } from "../../../helpers/json.js";
2
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from "../../../helpers/marshalling.js";
3
+ import "../../../vendor/base64/index.js";
4
+ const unmarshalEndpointPrivateNetworkDetails = (data) => {
5
+ if (!isJSONObject(data)) {
6
+ throw new TypeError(
7
+ `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
8
+ );
9
+ }
10
+ return {
11
+ privateNetworkId: data.private_network_id
12
+ };
13
+ };
14
+ const unmarshalEndpointPublicDetails = (data) => {
15
+ if (!isJSONObject(data)) {
16
+ throw new TypeError(
17
+ `Unmarshalling the type 'EndpointPublicDetails' failed as data isn't a dictionary.`
18
+ );
19
+ }
20
+ return {};
21
+ };
22
+ const unmarshalEndpoint = (data) => {
23
+ if (!isJSONObject(data)) {
24
+ throw new TypeError(
25
+ `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
26
+ );
27
+ }
28
+ return {
29
+ dnsRecords: data.dns_records,
30
+ id: data.id,
31
+ ips: data.ips,
32
+ port: data.port,
33
+ privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
34
+ public: data.public ? unmarshalEndpointPublicDetails(data.public) : void 0
35
+ };
36
+ };
37
+ const unmarshalInstanceSetting = (data) => {
38
+ if (!isJSONObject(data)) {
39
+ throw new TypeError(
40
+ `Unmarshalling the type 'InstanceSetting' failed as data isn't a dictionary.`
41
+ );
42
+ }
43
+ return {
44
+ name: data.name,
45
+ value: data.value
46
+ };
47
+ };
48
+ const unmarshalVolume = (data) => {
49
+ if (!isJSONObject(data)) {
50
+ throw new TypeError(
51
+ `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`
52
+ );
53
+ }
54
+ return {
55
+ size: data.size,
56
+ type: data.type
57
+ };
58
+ };
59
+ const unmarshalInstance = (data) => {
60
+ if (!isJSONObject(data)) {
61
+ throw new TypeError(
62
+ `Unmarshalling the type 'Instance' failed as data isn't a dictionary.`
63
+ );
64
+ }
65
+ return {
66
+ createdAt: unmarshalDate(data.created_at),
67
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
68
+ id: data.id,
69
+ name: data.name,
70
+ nodeNumber: data.node_number,
71
+ nodeType: data.node_type,
72
+ projectId: data.project_id,
73
+ region: data.region,
74
+ settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting),
75
+ status: data.status,
76
+ tags: data.tags,
77
+ version: data.version,
78
+ volume: data.volume ? unmarshalVolume(data.volume) : void 0
79
+ };
80
+ };
81
+ const unmarshalSnapshotVolumeType = (data) => {
82
+ if (!isJSONObject(data)) {
83
+ throw new TypeError(
84
+ `Unmarshalling the type 'SnapshotVolumeType' failed as data isn't a dictionary.`
85
+ );
86
+ }
87
+ return {
88
+ type: data.type
89
+ };
90
+ };
91
+ const unmarshalSnapshot = (data) => {
92
+ if (!isJSONObject(data)) {
93
+ throw new TypeError(
94
+ `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`
95
+ );
96
+ }
97
+ return {
98
+ createdAt: unmarshalDate(data.created_at),
99
+ expiresAt: unmarshalDate(data.expires_at),
100
+ id: data.id,
101
+ instanceId: data.instance_id,
102
+ instanceName: data.instance_name,
103
+ name: data.name,
104
+ nodeType: data.node_type,
105
+ region: data.region,
106
+ size: data.size,
107
+ status: data.status,
108
+ updatedAt: unmarshalDate(data.updated_at),
109
+ volumeType: data.volume_type ? unmarshalSnapshotVolumeType(data.volume_type) : void 0
110
+ };
111
+ };
112
+ const unmarshalUser = (data) => {
113
+ if (!isJSONObject(data)) {
114
+ throw new TypeError(
115
+ `Unmarshalling the type 'User' failed as data isn't a dictionary.`
116
+ );
117
+ }
118
+ return {
119
+ name: data.name
120
+ };
121
+ };
122
+ const unmarshalListInstancesResponse = (data) => {
123
+ if (!isJSONObject(data)) {
124
+ throw new TypeError(
125
+ `Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`
126
+ );
127
+ }
128
+ return {
129
+ instances: unmarshalArrayOfObject(data.instances, unmarshalInstance),
130
+ totalCount: data.total_count
131
+ };
132
+ };
133
+ const unmarshalNodeTypeVolumeType = (data) => {
134
+ if (!isJSONObject(data)) {
135
+ throw new TypeError(
136
+ `Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`
137
+ );
138
+ }
139
+ return {
140
+ chunkSize: data.chunk_size,
141
+ description: data.description,
142
+ maxSize: data.max_size,
143
+ minSize: data.min_size,
144
+ type: data.type
145
+ };
146
+ };
147
+ const unmarshalNodeType = (data) => {
148
+ if (!isJSONObject(data)) {
149
+ throw new TypeError(
150
+ `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
151
+ );
152
+ }
153
+ return {
154
+ availableVolumeTypes: unmarshalArrayOfObject(
155
+ data.available_volume_types,
156
+ unmarshalNodeTypeVolumeType
157
+ ),
158
+ beta: data.beta,
159
+ description: data.description,
160
+ disabled: data.disabled,
161
+ instanceRange: data.instance_range,
162
+ memory: data.memory,
163
+ name: data.name,
164
+ stockStatus: data.stock_status,
165
+ vcpus: data.vcpus
166
+ };
167
+ };
168
+ const unmarshalListNodeTypesResponse = (data) => {
169
+ if (!isJSONObject(data)) {
170
+ throw new TypeError(
171
+ `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
172
+ );
173
+ }
174
+ return {
175
+ nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
176
+ totalCount: data.total_count
177
+ };
178
+ };
179
+ const unmarshalListSnapshotsResponse = (data) => {
180
+ if (!isJSONObject(data)) {
181
+ throw new TypeError(
182
+ `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`
183
+ );
184
+ }
185
+ return {
186
+ snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
187
+ totalCount: data.total_count
188
+ };
189
+ };
190
+ const unmarshalListUsersResponse = (data) => {
191
+ if (!isJSONObject(data)) {
192
+ throw new TypeError(
193
+ `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`
194
+ );
195
+ }
196
+ return {
197
+ totalCount: data.total_count,
198
+ users: unmarshalArrayOfObject(data.users, unmarshalUser)
199
+ };
200
+ };
201
+ const unmarshalSetting = (data) => {
202
+ if (!isJSONObject(data)) {
203
+ throw new TypeError(
204
+ `Unmarshalling the type 'Setting' failed as data isn't a dictionary.`
205
+ );
206
+ }
207
+ return {
208
+ defaultValue: data.default_value,
209
+ description: data.description,
210
+ floatMax: data.float_max,
211
+ floatMin: data.float_min,
212
+ hotConfigurable: data.hot_configurable,
213
+ intMax: data.int_max,
214
+ intMin: data.int_min,
215
+ name: data.name,
216
+ propertyType: data.property_type,
217
+ stringConstraint: data.string_constraint,
218
+ unit: data.unit
219
+ };
220
+ };
221
+ const unmarshalVersion = (data) => {
222
+ if (!isJSONObject(data)) {
223
+ throw new TypeError(
224
+ `Unmarshalling the type 'Version' failed as data isn't a dictionary.`
225
+ );
226
+ }
227
+ return {
228
+ availableSettings: unmarshalArrayOfObject(
229
+ data.available_settings,
230
+ unmarshalSetting
231
+ ),
232
+ endOfLifeAt: unmarshalDate(data.end_of_life_at),
233
+ version: data.version
234
+ };
235
+ };
236
+ const unmarshalListVersionsResponse = (data) => {
237
+ if (!isJSONObject(data)) {
238
+ throw new TypeError(
239
+ `Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`
240
+ );
241
+ }
242
+ return {
243
+ totalCount: data.total_count,
244
+ versions: unmarshalArrayOfObject(data.versions, unmarshalVersion)
245
+ };
246
+ };
247
+ const marshalEndpointSpecPrivateNetworkDetails = (request, defaults) => ({
248
+ private_network_id: request.privateNetworkId
249
+ });
250
+ const marshalEndpointSpecPublicDetails = (request, defaults) => ({});
251
+ const marshalCreateInstanceRequestVolumeDetails = (request, defaults) => ({
252
+ volume_size: request.volumeSize,
253
+ volume_type: request.volumeType
254
+ });
255
+ const marshalEndpointSpec = (request, defaults) => ({
256
+ ...resolveOneOf([
257
+ {
258
+ param: "public",
259
+ value: request.public !== void 0 ? marshalEndpointSpecPublicDetails(request.public) : void 0
260
+ },
261
+ {
262
+ param: "private_network",
263
+ value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetworkDetails(
264
+ request.privateNetwork
265
+ ) : void 0
266
+ }
267
+ ])
268
+ });
269
+ const marshalCreateInstanceRequest = (request, defaults) => ({
270
+ endpoints: request.endpoints !== void 0 ? request.endpoints.map((elt) => marshalEndpointSpec(elt)) : void 0,
271
+ name: request.name,
272
+ node_number: request.nodeNumber,
273
+ node_type: request.nodeType,
274
+ password: request.password,
275
+ project_id: request.projectId ?? defaults.defaultProjectId,
276
+ tags: request.tags,
277
+ user_name: request.userName,
278
+ version: request.version,
279
+ volume: request.volume !== void 0 ? marshalCreateInstanceRequestVolumeDetails(request.volume) : void 0
280
+ });
281
+ const marshalCreateSnapshotRequest = (request, defaults) => ({
282
+ expires_at: request.expiresAt,
283
+ name: request.name
284
+ });
285
+ const marshalRestoreSnapshotRequestVolumeDetails = (request, defaults) => ({
286
+ volume_type: request.volumeType
287
+ });
288
+ const marshalRestoreSnapshotRequest = (request, defaults) => ({
289
+ instance_name: request.instanceName,
290
+ node_number: request.nodeNumber,
291
+ node_type: request.nodeType,
292
+ volume: marshalRestoreSnapshotRequestVolumeDetails(request.volume)
293
+ });
294
+ const marshalUpdateInstanceRequest = (request, defaults) => ({
295
+ name: request.name,
296
+ tags: request.tags
297
+ });
298
+ const marshalUpdateSnapshotRequest = (request, defaults) => ({
299
+ expires_at: request.expiresAt,
300
+ name: request.name
301
+ });
302
+ const marshalUpdateUserRequest = (request, defaults) => ({
303
+ password: request.password
304
+ });
305
+ const marshalUpgradeInstanceRequest = (request, defaults) => ({
306
+ ...resolveOneOf([{ param: "volume_size", value: request.volumeSize }])
307
+ });
308
+ export {
309
+ marshalCreateInstanceRequest,
310
+ marshalCreateSnapshotRequest,
311
+ marshalRestoreSnapshotRequest,
312
+ marshalUpdateInstanceRequest,
313
+ marshalUpdateSnapshotRequest,
314
+ marshalUpdateUserRequest,
315
+ marshalUpgradeInstanceRequest,
316
+ unmarshalInstance,
317
+ unmarshalInstanceSetting,
318
+ unmarshalListInstancesResponse,
319
+ unmarshalListNodeTypesResponse,
320
+ unmarshalListSnapshotsResponse,
321
+ unmarshalListUsersResponse,
322
+ unmarshalListVersionsResponse,
323
+ unmarshalSnapshot,
324
+ unmarshalUser,
325
+ unmarshalVolume
326
+ };