@scaleway/sdk 2.0.0-alpha.12 → 2.0.0-alpha.14

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 (63) hide show
  1. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +12 -12
  2. package/dist/api/baremetal/v1/marshalling.gen.js +60 -49
  3. package/dist/api/block/v1alpha1/api.gen.js +23 -19
  4. package/dist/api/block/v1alpha1/marshalling.gen.js +47 -40
  5. package/dist/api/block/v1alpha1/validation-rules.gen.js +11 -1
  6. package/dist/api/cockpit/v1beta1/api.gen.js +143 -48
  7. package/dist/api/cockpit/v1beta1/marshalling.gen.js +86 -35
  8. package/dist/api/container/v1beta1/index.gen.js +2 -0
  9. package/dist/api/container/v1beta1/marshalling.gen.js +63 -35
  10. package/dist/api/container/v1beta1/validation-rules.gen.js +44 -0
  11. package/dist/api/document_db/v1beta1/marshalling.gen.js +117 -61
  12. package/dist/api/domain/v2beta1/api.gen.js +29 -37
  13. package/dist/api/domain/v2beta1/index.gen.js +0 -2
  14. package/dist/api/domain/v2beta1/marshalling.gen.js +408 -194
  15. package/dist/api/flexibleip/v1alpha1/api.gen.js +6 -14
  16. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +2 -2
  17. package/dist/api/function/v1beta1/index.gen.js +2 -0
  18. package/dist/api/function/v1beta1/marshalling.gen.js +64 -36
  19. package/dist/api/function/v1beta1/validation-rules.gen.js +44 -0
  20. package/dist/api/iam/v1alpha1/api.gen.js +26 -42
  21. package/dist/api/iam/v1alpha1/marshalling.gen.js +44 -33
  22. package/dist/api/instance/v1/api.gen.js +1 -1
  23. package/dist/api/instance/v1/marshalling.gen.js +394 -185
  24. package/dist/api/iot/v1/api.gen.js +24 -32
  25. package/dist/api/iot/v1/marshalling.gen.js +87 -36
  26. package/dist/api/ipam/index.js +2 -0
  27. package/dist/api/ipam/v1/api.gen.js +113 -0
  28. package/dist/api/ipam/v1/index.gen.js +6 -0
  29. package/dist/api/ipam/v1/marshalling.gen.js +77 -0
  30. package/dist/api/ipam/v1/validation-rules.gen.js +11 -0
  31. package/dist/api/ipfs/v1alpha1/api.gen.js +120 -3
  32. package/dist/api/ipfs/v1alpha1/content.gen.js +4 -1
  33. package/dist/api/ipfs/v1alpha1/index.gen.js +2 -2
  34. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +78 -19
  35. package/dist/api/k8s/v1/marshalling.gen.js +125 -37
  36. package/dist/api/lb/v1/api.gen.js +1 -1
  37. package/dist/api/lb/v1/marshalling.gen.js +251 -135
  38. package/dist/api/marketplace/v1/marshalling.gen.js +11 -11
  39. package/dist/api/marketplace/v2/api.gen.js +3 -3
  40. package/dist/api/mnq/index.js +2 -0
  41. package/dist/api/mnq/v1alpha1/api.gen.js +12 -20
  42. package/dist/api/mnq/v1alpha1/marshalling.gen.js +19 -14
  43. package/dist/api/mnq/v1beta1/api.gen.js +529 -0
  44. package/dist/api/mnq/v1beta1/index.gen.js +6 -0
  45. package/dist/api/mnq/v1beta1/marshalling.gen.js +212 -0
  46. package/dist/api/mnq/v1beta1/validation-rules.gen.js +77 -0
  47. package/dist/api/rdb/v1/marshalling.gen.js +122 -64
  48. package/dist/api/redis/v1/marshalling.gen.js +51 -27
  49. package/dist/api/registry/v1/marshalling.gen.js +3 -1
  50. package/dist/api/secret/v1alpha1/marshalling.gen.js +11 -4
  51. package/dist/api/tem/v1alpha1/marshalling.gen.js +22 -13
  52. package/dist/api/test/v1/marshalling.gen.js +2 -0
  53. package/dist/api/vpc/v2/marshalling.gen.js +2 -0
  54. package/dist/api/vpcgw/v1/marshalling.gen.js +47 -24
  55. package/dist/api/webhosting/v1alpha1/api.gen.js +2 -54
  56. package/dist/api/webhosting/v1alpha1/index.gen.js +1 -1
  57. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +14 -41
  58. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +1 -10
  59. package/dist/index.cjs +3735 -1615
  60. package/dist/index.d.ts +5809 -2209
  61. package/dist/index.js +30 -28
  62. package/dist/scw/constants.js +1 -1
  63. package/package.json +2 -2
@@ -17,24 +17,32 @@ const unmarshalPrivateNIC = data => {
17
17
  tags: data.tags
18
18
  };
19
19
  };
20
- const unmarshalVolumeSummary = data => {
20
+ const unmarshalServerSummary = data => {
21
21
  if (!isJSONObject(data)) {
22
- throw new TypeError(`Unmarshalling the type 'VolumeSummary' failed as data isn't a dictionary.`);
22
+ throw new TypeError(`Unmarshalling the type 'ServerSummary' failed as data isn't a dictionary.`);
23
23
  }
24
24
  return {
25
25
  id: data.id,
26
- name: data.name,
27
- size: data.size,
28
- volumeType: data.volume_type
26
+ name: data.name
29
27
  };
30
28
  };
31
- const unmarshalServerSummary = data => {
29
+ const unmarshalBootscript = data => {
32
30
  if (!isJSONObject(data)) {
33
- throw new TypeError(`Unmarshalling the type 'ServerSummary' failed as data isn't a dictionary.`);
31
+ throw new TypeError(`Unmarshalling the type 'Bootscript' failed as data isn't a dictionary.`);
34
32
  }
35
33
  return {
34
+ arch: data.arch,
35
+ bootcmdargs: data.bootcmdargs,
36
+ default: data.default,
37
+ dtb: data.dtb,
36
38
  id: data.id,
37
- name: data.name
39
+ initrd: data.initrd,
40
+ kernel: data.kernel,
41
+ organization: data.organization,
42
+ project: data.project,
43
+ public: data.public,
44
+ title: data.title,
45
+ zone: data.zone
38
46
  };
39
47
  };
40
48
  const unmarshalVolume = data => {
@@ -43,13 +51,13 @@ const unmarshalVolume = data => {
43
51
  }
44
52
  return {
45
53
  creationDate: unmarshalDate(data.creation_date),
46
- exportUri: data.export_uri ? data.export_uri : undefined,
54
+ exportUri: data.export_uri,
47
55
  id: data.id,
48
56
  modificationDate: unmarshalDate(data.modification_date),
49
57
  name: data.name,
50
58
  organization: data.organization,
51
59
  project: data.project,
52
- server: unmarshalServerSummary(data.server),
60
+ server: data.server ? unmarshalServerSummary(data.server) : undefined,
53
61
  size: data.size,
54
62
  state: data.state,
55
63
  tags: data.tags,
@@ -57,23 +65,15 @@ const unmarshalVolume = data => {
57
65
  zone: data.zone
58
66
  };
59
67
  };
60
- const unmarshalBootscript = data => {
68
+ const unmarshalVolumeSummary = data => {
61
69
  if (!isJSONObject(data)) {
62
- throw new TypeError(`Unmarshalling the type 'Bootscript' failed as data isn't a dictionary.`);
70
+ throw new TypeError(`Unmarshalling the type 'VolumeSummary' failed as data isn't a dictionary.`);
63
71
  }
64
72
  return {
65
- arch: data.arch,
66
- bootcmdargs: data.bootcmdargs,
67
- default: data.default,
68
- dtb: data.dtb,
69
73
  id: data.id,
70
- initrd: data.initrd,
71
- kernel: data.kernel,
72
- organization: data.organization,
73
- project: data.project,
74
- public: data.public,
75
- title: data.title,
76
- zone: data.zone
74
+ name: data.name,
75
+ size: data.size,
76
+ volumeType: data.volume_type
77
77
  };
78
78
  };
79
79
  const unmarshalImage = data => {
@@ -92,7 +92,7 @@ const unmarshalImage = data => {
92
92
  organization: data.organization,
93
93
  project: data.project,
94
94
  public: data.public,
95
- rootVolume: unmarshalVolumeSummary(data.root_volume),
95
+ rootVolume: data.root_volume ? unmarshalVolumeSummary(data.root_volume) : undefined,
96
96
  state: data.state,
97
97
  tags: data.tags,
98
98
  zone: data.zone
@@ -103,7 +103,7 @@ const unmarshalCreateImageResponse = data => {
103
103
  throw new TypeError(`Unmarshalling the type 'CreateImageResponse' failed as data isn't a dictionary.`);
104
104
  }
105
105
  return {
106
- image: unmarshalImage(data.image)
106
+ image: data.image ? unmarshalImage(data.image) : undefined
107
107
  };
108
108
  };
109
109
  const unmarshalIp = data => {
@@ -116,8 +116,8 @@ const unmarshalIp = data => {
116
116
  organization: data.organization,
117
117
  prefix: data.prefix,
118
118
  project: data.project,
119
- reverse: data.reverse ? data.reverse : undefined,
120
- server: unmarshalServerSummary(data.server),
119
+ reverse: data.reverse,
120
+ server: data.server ? unmarshalServerSummary(data.server) : undefined,
121
121
  state: data.state,
122
122
  tags: data.tags,
123
123
  type: data.type,
@@ -129,7 +129,7 @@ const unmarshalCreateIpResponse = data => {
129
129
  throw new TypeError(`Unmarshalling the type 'CreateIpResponse' failed as data isn't a dictionary.`);
130
130
  }
131
131
  return {
132
- ip: unmarshalIp(data.ip)
132
+ ip: data.ip ? unmarshalIp(data.ip) : undefined
133
133
  };
134
134
  };
135
135
  const unmarshalPlacementGroup = data => {
@@ -153,7 +153,7 @@ const unmarshalCreatePlacementGroupResponse = data => {
153
153
  throw new TypeError(`Unmarshalling the type 'CreatePlacementGroupResponse' failed as data isn't a dictionary.`);
154
154
  }
155
155
  return {
156
- placementGroup: unmarshalPlacementGroup(data.placement_group)
156
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined
157
157
  };
158
158
  };
159
159
  const unmarshalCreatePrivateNICResponse = data => {
@@ -161,7 +161,7 @@ const unmarshalCreatePrivateNICResponse = data => {
161
161
  throw new TypeError(`Unmarshalling the type 'CreatePrivateNICResponse' failed as data isn't a dictionary.`);
162
162
  }
163
163
  return {
164
- privateNic: unmarshalPrivateNIC(data.private_nic)
164
+ privateNic: data.private_nic ? unmarshalPrivateNIC(data.private_nic) : undefined
165
165
  };
166
166
  };
167
167
  const unmarshalSecurityGroup = data => {
@@ -177,7 +177,7 @@ const unmarshalSecurityGroup = data => {
177
177
  modificationDate: unmarshalDate(data.modification_date),
178
178
  name: data.name,
179
179
  organization: data.organization,
180
- organizationDefault: data.organization_default ? data.organization_default : undefined,
180
+ organizationDefault: data.organization_default,
181
181
  outboundDefaultPolicy: data.outbound_default_policy,
182
182
  project: data.project,
183
183
  projectDefault: data.project_default,
@@ -193,7 +193,7 @@ const unmarshalCreateSecurityGroupResponse = data => {
193
193
  throw new TypeError(`Unmarshalling the type 'CreateSecurityGroupResponse' failed as data isn't a dictionary.`);
194
194
  }
195
195
  return {
196
- securityGroup: unmarshalSecurityGroup(data.security_group)
196
+ securityGroup: data.security_group ? unmarshalSecurityGroup(data.security_group) : undefined
197
197
  };
198
198
  };
199
199
  const unmarshalSecurityGroupRule = data => {
@@ -202,8 +202,8 @@ const unmarshalSecurityGroupRule = data => {
202
202
  }
203
203
  return {
204
204
  action: data.action,
205
- destPortFrom: data.dest_port_from ? data.dest_port_from : undefined,
206
- destPortTo: data.dest_port_to ? data.dest_port_to : undefined,
205
+ destPortFrom: data.dest_port_from,
206
+ destPortTo: data.dest_port_to,
207
207
  direction: data.direction,
208
208
  editable: data.editable,
209
209
  id: data.id,
@@ -218,15 +218,7 @@ const unmarshalCreateSecurityGroupRuleResponse = data => {
218
218
  throw new TypeError(`Unmarshalling the type 'CreateSecurityGroupRuleResponse' failed as data isn't a dictionary.`);
219
219
  }
220
220
  return {
221
- rule: unmarshalSecurityGroupRule(data.rule)
222
- };
223
- };
224
- const unmarshalServerMaintenance = data => {
225
- if (!isJSONObject(data)) {
226
- throw new TypeError(`Unmarshalling the type 'ServerMaintenance' failed as data isn't a dictionary.`);
227
- }
228
- return {
229
- reason: data.reason
221
+ rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined
230
222
  };
231
223
  };
232
224
  const unmarshalSecurityGroupSummary = data => {
@@ -238,24 +230,19 @@ const unmarshalSecurityGroupSummary = data => {
238
230
  name: data.name
239
231
  };
240
232
  };
241
- const unmarshalVolumeServer = data => {
233
+ const unmarshalServerIp = data => {
242
234
  if (!isJSONObject(data)) {
243
- throw new TypeError(`Unmarshalling the type 'VolumeServer' failed as data isn't a dictionary.`);
235
+ throw new TypeError(`Unmarshalling the type 'ServerIp' failed as data isn't a dictionary.`);
244
236
  }
245
237
  return {
246
- boot: data.boot,
247
- creationDate: unmarshalDate(data.creation_date),
248
- exportUri: data.export_uri,
238
+ address: data.address,
239
+ dynamic: data.dynamic,
240
+ family: data.family,
241
+ gateway: data.gateway,
249
242
  id: data.id,
250
- modificationDate: unmarshalDate(data.modification_date),
251
- name: data.name,
252
- organization: data.organization,
253
- project: data.project,
254
- server: unmarshalServerSummary(data.server),
255
- size: data.size,
256
- state: data.state,
257
- volumeType: data.volume_type,
258
- zone: data.zone
243
+ netmask: data.netmask,
244
+ provisioningMode: data.provisioning_mode,
245
+ tags: data.tags
259
246
  };
260
247
  };
261
248
  const unmarshalServerIpv6 = data => {
@@ -280,18 +267,32 @@ const unmarshalServerLocation = data => {
280
267
  zoneId: data.zone_id
281
268
  };
282
269
  };
283
- const unmarshalServerIp = data => {
270
+ const unmarshalServerMaintenance = data => {
284
271
  if (!isJSONObject(data)) {
285
- throw new TypeError(`Unmarshalling the type 'ServerIp' failed as data isn't a dictionary.`);
272
+ throw new TypeError(`Unmarshalling the type 'ServerMaintenance' failed as data isn't a dictionary.`);
286
273
  }
287
274
  return {
288
- address: data.address,
289
- dynamic: data.dynamic,
290
- family: data.family,
291
- gateway: data.gateway,
275
+ reason: data.reason
276
+ };
277
+ };
278
+ const unmarshalVolumeServer = data => {
279
+ if (!isJSONObject(data)) {
280
+ throw new TypeError(`Unmarshalling the type 'VolumeServer' failed as data isn't a dictionary.`);
281
+ }
282
+ return {
283
+ boot: data.boot,
284
+ creationDate: unmarshalDate(data.creation_date),
285
+ exportUri: data.export_uri,
292
286
  id: data.id,
293
- netmask: data.netmask,
294
- provisioningMode: data.provisioning_mode
287
+ modificationDate: unmarshalDate(data.modification_date),
288
+ name: data.name,
289
+ organization: data.organization,
290
+ project: data.project,
291
+ server: data.server ? unmarshalServerSummary(data.server) : undefined,
292
+ size: data.size,
293
+ state: data.state,
294
+ volumeType: data.volume_type,
295
+ zone: data.zone
295
296
  };
296
297
  };
297
298
  const unmarshalServer = data => {
@@ -309,23 +310,23 @@ const unmarshalServer = data => {
309
310
  enableIpv6: data.enable_ipv6,
310
311
  hostname: data.hostname,
311
312
  id: data.id,
312
- image: unmarshalImage(data.image),
313
- ipv6: unmarshalServerIpv6(data.ipv6),
314
- location: unmarshalServerLocation(data.location),
313
+ image: data.image ? unmarshalImage(data.image) : undefined,
314
+ ipv6: data.ipv6 ? unmarshalServerIpv6(data.ipv6) : undefined,
315
+ location: data.location ? unmarshalServerLocation(data.location) : undefined,
315
316
  macAddress: data.mac_address,
316
317
  maintenances: unmarshalArrayOfObject(data.maintenances, unmarshalServerMaintenance),
317
318
  modificationDate: unmarshalDate(data.modification_date),
318
319
  name: data.name,
319
320
  organization: data.organization,
320
- placementGroup: unmarshalPlacementGroup(data.placement_group),
321
- privateIp: data.private_ip ? data.private_ip : undefined,
321
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined,
322
+ privateIp: data.private_ip,
322
323
  privateNics: unmarshalArrayOfObject(data.private_nics, unmarshalPrivateNIC),
323
324
  project: data.project,
324
325
  protected: data.protected,
325
- publicIp: unmarshalServerIp(data.public_ip),
326
+ publicIp: data.public_ip ? unmarshalServerIp(data.public_ip) : undefined,
326
327
  publicIps: unmarshalArrayOfObject(data.public_ips, unmarshalServerIp),
327
328
  routedIpEnabled: data.routed_ip_enabled,
328
- securityGroup: unmarshalSecurityGroupSummary(data.security_group),
329
+ securityGroup: data.security_group ? unmarshalSecurityGroupSummary(data.security_group) : undefined,
329
330
  state: data.state,
330
331
  stateDetail: data.state_detail,
331
332
  tags: data.tags,
@@ -338,23 +339,7 @@ const unmarshalCreateServerResponse = data => {
338
339
  throw new TypeError(`Unmarshalling the type 'CreateServerResponse' failed as data isn't a dictionary.`);
339
340
  }
340
341
  return {
341
- server: unmarshalServer(data.server)
342
- };
343
- };
344
- const unmarshalTask = data => {
345
- if (!isJSONObject(data)) {
346
- throw new TypeError(`Unmarshalling the type 'Task' failed as data isn't a dictionary.`);
347
- }
348
- return {
349
- description: data.description,
350
- hrefFrom: data.href_from,
351
- hrefResult: data.href_result,
352
- id: data.id,
353
- progress: data.progress,
354
- startedAt: unmarshalDate(data.started_at),
355
- status: data.status,
356
- terminatedAt: unmarshalDate(data.terminated_at),
357
- zone: data.zone
342
+ server: data.server ? unmarshalServer(data.server) : undefined
358
343
  };
359
344
  };
360
345
  const unmarshalSnapshotBaseVolume = data => {
@@ -371,9 +356,9 @@ const unmarshalSnapshot = data => {
371
356
  throw new TypeError(`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`);
372
357
  }
373
358
  return {
374
- baseVolume: unmarshalSnapshotBaseVolume(data.base_volume),
359
+ baseVolume: data.base_volume ? unmarshalSnapshotBaseVolume(data.base_volume) : undefined,
375
360
  creationDate: unmarshalDate(data.creation_date),
376
- errorReason: data.error_reason ? data.error_reason : undefined,
361
+ errorReason: data.error_reason,
377
362
  id: data.id,
378
363
  modificationDate: unmarshalDate(data.modification_date),
379
364
  name: data.name,
@@ -386,13 +371,29 @@ const unmarshalSnapshot = data => {
386
371
  zone: data.zone
387
372
  };
388
373
  };
374
+ const unmarshalTask = data => {
375
+ if (!isJSONObject(data)) {
376
+ throw new TypeError(`Unmarshalling the type 'Task' failed as data isn't a dictionary.`);
377
+ }
378
+ return {
379
+ description: data.description,
380
+ hrefFrom: data.href_from,
381
+ hrefResult: data.href_result,
382
+ id: data.id,
383
+ progress: data.progress,
384
+ startedAt: unmarshalDate(data.started_at),
385
+ status: data.status,
386
+ terminatedAt: unmarshalDate(data.terminated_at),
387
+ zone: data.zone
388
+ };
389
+ };
389
390
  const unmarshalCreateSnapshotResponse = data => {
390
391
  if (!isJSONObject(data)) {
391
392
  throw new TypeError(`Unmarshalling the type 'CreateSnapshotResponse' failed as data isn't a dictionary.`);
392
393
  }
393
394
  return {
394
- snapshot: unmarshalSnapshot(data.snapshot),
395
- task: unmarshalTask(data.task)
395
+ snapshot: data.snapshot ? unmarshalSnapshot(data.snapshot) : undefined,
396
+ task: data.task ? unmarshalTask(data.task) : undefined
396
397
  };
397
398
  };
398
399
  const unmarshalCreateVolumeResponse = data => {
@@ -400,7 +401,7 @@ const unmarshalCreateVolumeResponse = data => {
400
401
  throw new TypeError(`Unmarshalling the type 'CreateVolumeResponse' failed as data isn't a dictionary.`);
401
402
  }
402
403
  return {
403
- volume: unmarshalVolume(data.volume)
404
+ volume: data.volume ? unmarshalVolume(data.volume) : undefined
404
405
  };
405
406
  };
406
407
  const unmarshalExportSnapshotResponse = data => {
@@ -408,7 +409,7 @@ const unmarshalExportSnapshotResponse = data => {
408
409
  throw new TypeError(`Unmarshalling the type 'ExportSnapshotResponse' failed as data isn't a dictionary.`);
409
410
  }
410
411
  return {
411
- task: unmarshalTask(data.task)
412
+ task: data.task ? unmarshalTask(data.task) : undefined
412
413
  };
413
414
  };
414
415
  const unmarshalGetBootscriptResponse = data => {
@@ -416,7 +417,7 @@ const unmarshalGetBootscriptResponse = data => {
416
417
  throw new TypeError(`Unmarshalling the type 'GetBootscriptResponse' failed as data isn't a dictionary.`);
417
418
  }
418
419
  return {
419
- bootscript: unmarshalBootscript(data.bootscript)
420
+ bootscript: data.bootscript ? unmarshalBootscript(data.bootscript) : undefined
420
421
  };
421
422
  };
422
423
  const unmarshalDashboard = data => {
@@ -446,7 +447,7 @@ const unmarshalGetDashboardResponse = data => {
446
447
  throw new TypeError(`Unmarshalling the type 'GetDashboardResponse' failed as data isn't a dictionary.`);
447
448
  }
448
449
  return {
449
- dashboard: unmarshalDashboard(data.dashboard)
450
+ dashboard: data.dashboard ? unmarshalDashboard(data.dashboard) : undefined
450
451
  };
451
452
  };
452
453
  const unmarshalGetImageResponse = data => {
@@ -454,7 +455,7 @@ const unmarshalGetImageResponse = data => {
454
455
  throw new TypeError(`Unmarshalling the type 'GetImageResponse' failed as data isn't a dictionary.`);
455
456
  }
456
457
  return {
457
- image: unmarshalImage(data.image)
458
+ image: data.image ? unmarshalImage(data.image) : undefined
458
459
  };
459
460
  };
460
461
  const unmarshalGetIpResponse = data => {
@@ -462,7 +463,7 @@ const unmarshalGetIpResponse = data => {
462
463
  throw new TypeError(`Unmarshalling the type 'GetIpResponse' failed as data isn't a dictionary.`);
463
464
  }
464
465
  return {
465
- ip: unmarshalIp(data.ip)
466
+ ip: data.ip ? unmarshalIp(data.ip) : undefined
466
467
  };
467
468
  };
468
469
  const unmarshalGetPlacementGroupResponse = data => {
@@ -470,7 +471,7 @@ const unmarshalGetPlacementGroupResponse = data => {
470
471
  throw new TypeError(`Unmarshalling the type 'GetPlacementGroupResponse' failed as data isn't a dictionary.`);
471
472
  }
472
473
  return {
473
- placementGroup: unmarshalPlacementGroup(data.placement_group)
474
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined
474
475
  };
475
476
  };
476
477
  const unmarshalPlacementGroupServer = data => {
@@ -496,7 +497,7 @@ const unmarshalGetPrivateNICResponse = data => {
496
497
  throw new TypeError(`Unmarshalling the type 'GetPrivateNICResponse' failed as data isn't a dictionary.`);
497
498
  }
498
499
  return {
499
- privateNic: unmarshalPrivateNIC(data.private_nic)
500
+ privateNic: data.private_nic ? unmarshalPrivateNIC(data.private_nic) : undefined
500
501
  };
501
502
  };
502
503
  const unmarshalGetSecurityGroupResponse = data => {
@@ -504,7 +505,7 @@ const unmarshalGetSecurityGroupResponse = data => {
504
505
  throw new TypeError(`Unmarshalling the type 'GetSecurityGroupResponse' failed as data isn't a dictionary.`);
505
506
  }
506
507
  return {
507
- securityGroup: unmarshalSecurityGroup(data.security_group)
508
+ securityGroup: data.security_group ? unmarshalSecurityGroup(data.security_group) : undefined
508
509
  };
509
510
  };
510
511
  const unmarshalGetSecurityGroupRuleResponse = data => {
@@ -512,7 +513,7 @@ const unmarshalGetSecurityGroupRuleResponse = data => {
512
513
  throw new TypeError(`Unmarshalling the type 'GetSecurityGroupRuleResponse' failed as data isn't a dictionary.`);
513
514
  }
514
515
  return {
515
- rule: unmarshalSecurityGroupRule(data.rule)
516
+ rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined
516
517
  };
517
518
  };
518
519
  const unmarshalGetServerResponse = data => {
@@ -520,7 +521,7 @@ const unmarshalGetServerResponse = data => {
520
521
  throw new TypeError(`Unmarshalling the type 'GetServerResponse' failed as data isn't a dictionary.`);
521
522
  }
522
523
  return {
523
- server: unmarshalServer(data.server)
524
+ server: data.server ? unmarshalServer(data.server) : undefined
524
525
  };
525
526
  };
526
527
  const unmarshalGetServerTypesAvailabilityResponseAvailability = data => {
@@ -545,7 +546,7 @@ const unmarshalGetSnapshotResponse = data => {
545
546
  throw new TypeError(`Unmarshalling the type 'GetSnapshotResponse' failed as data isn't a dictionary.`);
546
547
  }
547
548
  return {
548
- snapshot: unmarshalSnapshot(data.snapshot)
549
+ snapshot: data.snapshot ? unmarshalSnapshot(data.snapshot) : undefined
549
550
  };
550
551
  };
551
552
  const unmarshalGetVolumeResponse = data => {
@@ -553,7 +554,7 @@ const unmarshalGetVolumeResponse = data => {
553
554
  throw new TypeError(`Unmarshalling the type 'GetVolumeResponse' failed as data isn't a dictionary.`);
554
555
  }
555
556
  return {
556
- volume: unmarshalVolume(data.volume)
557
+ volume: data.volume ? unmarshalVolume(data.volume) : undefined
557
558
  };
558
559
  };
559
560
  const unmarshalListBootscriptsResponse = data => {
@@ -644,42 +645,42 @@ const unmarshalListServersResponse = data => {
644
645
  totalCount: data.total_count
645
646
  };
646
647
  };
647
- const unmarshalServerTypeCapabilities = data => {
648
+ const unmarshalServerTypeNetworkInterface = data => {
648
649
  if (!isJSONObject(data)) {
649
- throw new TypeError(`Unmarshalling the type 'ServerTypeCapabilities' failed as data isn't a dictionary.`);
650
+ throw new TypeError(`Unmarshalling the type 'ServerTypeNetworkInterface' failed as data isn't a dictionary.`);
650
651
  }
651
652
  return {
652
- blockStorage: data.block_storage ? data.block_storage : undefined,
653
- bootTypes: data.boot_types
653
+ internalBandwidth: data.internal_bandwidth,
654
+ internetBandwidth: data.internet_bandwidth
654
655
  };
655
656
  };
656
- const unmarshalServerTypeNetworkInterface = data => {
657
+ const unmarshalServerTypeVolumeConstraintSizes = data => {
657
658
  if (!isJSONObject(data)) {
658
- throw new TypeError(`Unmarshalling the type 'ServerTypeNetworkInterface' failed as data isn't a dictionary.`);
659
+ throw new TypeError(`Unmarshalling the type 'ServerTypeVolumeConstraintSizes' failed as data isn't a dictionary.`);
659
660
  }
660
661
  return {
661
- internalBandwidth: data.internal_bandwidth ? data.internal_bandwidth : undefined,
662
- internetBandwidth: data.internet_bandwidth ? data.internet_bandwidth : undefined
662
+ maxSize: data.max_size,
663
+ minSize: data.min_size
663
664
  };
664
665
  };
665
- const unmarshalServerTypeNetwork = data => {
666
+ const unmarshalServerTypeCapabilities = data => {
666
667
  if (!isJSONObject(data)) {
667
- throw new TypeError(`Unmarshalling the type 'ServerTypeNetwork' failed as data isn't a dictionary.`);
668
+ throw new TypeError(`Unmarshalling the type 'ServerTypeCapabilities' failed as data isn't a dictionary.`);
668
669
  }
669
670
  return {
670
- interfaces: unmarshalArrayOfObject(data.interfaces, unmarshalServerTypeNetworkInterface),
671
- ipv6Support: data.ipv6_support,
672
- sumInternalBandwidth: data.sum_internal_bandwidth ? data.sum_internal_bandwidth : undefined,
673
- sumInternetBandwidth: data.sum_internet_bandwidth ? data.sum_internet_bandwidth : undefined
671
+ blockStorage: data.block_storage,
672
+ bootTypes: data.boot_types
674
673
  };
675
674
  };
676
- const unmarshalServerTypeVolumeConstraintSizes = data => {
675
+ const unmarshalServerTypeNetwork = data => {
677
676
  if (!isJSONObject(data)) {
678
- throw new TypeError(`Unmarshalling the type 'ServerTypeVolumeConstraintSizes' failed as data isn't a dictionary.`);
677
+ throw new TypeError(`Unmarshalling the type 'ServerTypeNetwork' failed as data isn't a dictionary.`);
679
678
  }
680
679
  return {
681
- maxSize: data.max_size,
682
- minSize: data.min_size
680
+ interfaces: unmarshalArrayOfObject(data.interfaces, unmarshalServerTypeNetworkInterface),
681
+ ipv6Support: data.ipv6_support,
682
+ sumInternalBandwidth: data.sum_internal_bandwidth,
683
+ sumInternetBandwidth: data.sum_internet_bandwidth
683
684
  };
684
685
  };
685
686
  const unmarshalServerTypeVolumeConstraintsByType = data => {
@@ -687,7 +688,7 @@ const unmarshalServerTypeVolumeConstraintsByType = data => {
687
688
  throw new TypeError(`Unmarshalling the type 'ServerTypeVolumeConstraintsByType' failed as data isn't a dictionary.`);
688
689
  }
689
690
  return {
690
- lSsd: unmarshalServerTypeVolumeConstraintSizes(data.l_ssd)
691
+ lSsd: data.l_ssd ? unmarshalServerTypeVolumeConstraintSizes(data.l_ssd) : undefined
691
692
  };
692
693
  };
693
694
  const unmarshalServerType = data => {
@@ -698,16 +699,16 @@ const unmarshalServerType = data => {
698
699
  altNames: data.alt_names,
699
700
  arch: data.arch,
700
701
  baremetal: data.baremetal,
701
- capabilities: unmarshalServerTypeCapabilities(data.capabilities),
702
- gpu: data.gpu ? data.gpu : undefined,
702
+ capabilities: data.capabilities ? unmarshalServerTypeCapabilities(data.capabilities) : undefined,
703
+ gpu: data.gpu,
703
704
  hourlyPrice: data.hourly_price,
704
- monthlyPrice: data.monthly_price ? data.monthly_price : undefined,
705
+ monthlyPrice: data.monthly_price,
705
706
  ncpus: data.ncpus,
706
- network: unmarshalServerTypeNetwork(data.network),
707
- perVolumeConstraint: unmarshalServerTypeVolumeConstraintsByType(data.per_volume_constraint),
707
+ network: data.network ? unmarshalServerTypeNetwork(data.network) : undefined,
708
+ perVolumeConstraint: data.per_volume_constraint ? unmarshalServerTypeVolumeConstraintsByType(data.per_volume_constraint) : undefined,
708
709
  ram: data.ram,
709
- scratchStorageMaxSize: data.scratch_storage_max_size ? data.scratch_storage_max_size : undefined,
710
- volumesConstraint: unmarshalServerTypeVolumeConstraintSizes(data.volumes_constraint)
710
+ scratchStorageMaxSize: data.scratch_storage_max_size,
711
+ volumesConstraint: data.volumes_constraint ? unmarshalServerTypeVolumeConstraintSizes(data.volumes_constraint) : undefined
711
712
  };
712
713
  };
713
714
  const unmarshalListServersTypesResponse = data => {
@@ -737,21 +738,21 @@ const unmarshalListVolumesResponse = data => {
737
738
  volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
738
739
  };
739
740
  };
740
- const unmarshalVolumeTypeConstraints = data => {
741
+ const unmarshalVolumeTypeCapabilities = data => {
741
742
  if (!isJSONObject(data)) {
742
- throw new TypeError(`Unmarshalling the type 'VolumeTypeConstraints' failed as data isn't a dictionary.`);
743
+ throw new TypeError(`Unmarshalling the type 'VolumeTypeCapabilities' failed as data isn't a dictionary.`);
743
744
  }
744
745
  return {
745
- max: data.max,
746
- min: data.min
746
+ snapshot: data.snapshot
747
747
  };
748
748
  };
749
- const unmarshalVolumeTypeCapabilities = data => {
749
+ const unmarshalVolumeTypeConstraints = data => {
750
750
  if (!isJSONObject(data)) {
751
- throw new TypeError(`Unmarshalling the type 'VolumeTypeCapabilities' failed as data isn't a dictionary.`);
751
+ throw new TypeError(`Unmarshalling the type 'VolumeTypeConstraints' failed as data isn't a dictionary.`);
752
752
  }
753
753
  return {
754
- snapshot: data.snapshot
754
+ max: data.max,
755
+ min: data.min
755
756
  };
756
757
  };
757
758
  const unmarshalVolumeType = data => {
@@ -759,8 +760,8 @@ const unmarshalVolumeType = data => {
759
760
  throw new TypeError(`Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`);
760
761
  }
761
762
  return {
762
- capabilities: unmarshalVolumeTypeCapabilities(data.capabilities),
763
- constraints: unmarshalVolumeTypeConstraints(data.constraints),
763
+ capabilities: data.capabilities ? unmarshalVolumeTypeCapabilities(data.capabilities) : undefined,
764
+ constraints: data.constraints ? unmarshalVolumeTypeConstraints(data.constraints) : undefined,
764
765
  displayName: data.display_name
765
766
  };
766
767
  };
@@ -780,7 +781,7 @@ const unmarshalMigrationPlan = data => {
780
781
  return {
781
782
  snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
782
783
  validationKey: data.validation_key,
783
- volume: unmarshalVolume(data.volume)
784
+ volume: data.volume ? unmarshalVolume(data.volume) : undefined
784
785
  };
785
786
  };
786
787
  const unmarshalServerActionResponse = data => {
@@ -788,7 +789,7 @@ const unmarshalServerActionResponse = data => {
788
789
  throw new TypeError(`Unmarshalling the type 'ServerActionResponse' failed as data isn't a dictionary.`);
789
790
  }
790
791
  return {
791
- task: unmarshalTask(data.task)
792
+ task: data.task ? unmarshalTask(data.task) : undefined
792
793
  };
793
794
  };
794
795
  const unmarshalSetImageResponse = data => {
@@ -796,7 +797,7 @@ const unmarshalSetImageResponse = data => {
796
797
  throw new TypeError(`Unmarshalling the type 'SetImageResponse' failed as data isn't a dictionary.`);
797
798
  }
798
799
  return {
799
- image: unmarshalImage(data.image)
800
+ image: data.image ? unmarshalImage(data.image) : undefined
800
801
  };
801
802
  };
802
803
  const unmarshalSetPlacementGroupResponse = data => {
@@ -804,7 +805,7 @@ const unmarshalSetPlacementGroupResponse = data => {
804
805
  throw new TypeError(`Unmarshalling the type 'SetPlacementGroupResponse' failed as data isn't a dictionary.`);
805
806
  }
806
807
  return {
807
- placementGroup: unmarshalPlacementGroup(data.placement_group)
808
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined
808
809
  };
809
810
  };
810
811
  const unmarshalSetPlacementGroupServersResponse = data => {
@@ -820,7 +821,7 @@ const unmarshalSetSecurityGroupResponse = data => {
820
821
  throw new TypeError(`Unmarshalling the type 'SetSecurityGroupResponse' failed as data isn't a dictionary.`);
821
822
  }
822
823
  return {
823
- securityGroup: unmarshalSecurityGroup(data.security_group)
824
+ securityGroup: data.security_group ? unmarshalSecurityGroup(data.security_group) : undefined
824
825
  };
825
826
  };
826
827
  const unmarshalSetSecurityGroupRuleResponse = data => {
@@ -828,7 +829,7 @@ const unmarshalSetSecurityGroupRuleResponse = data => {
828
829
  throw new TypeError(`Unmarshalling the type 'SetSecurityGroupRuleResponse' failed as data isn't a dictionary.`);
829
830
  }
830
831
  return {
831
- rule: unmarshalSecurityGroupRule(data.rule)
832
+ rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined
832
833
  };
833
834
  };
834
835
  const unmarshalSetSecurityGroupRulesResponse = data => {
@@ -844,7 +845,7 @@ const unmarshalSetServerResponse = data => {
844
845
  throw new TypeError(`Unmarshalling the type 'SetServerResponse' failed as data isn't a dictionary.`);
845
846
  }
846
847
  return {
847
- server: unmarshalServer(data.server)
848
+ server: data.server ? unmarshalServer(data.server) : undefined
848
849
  };
849
850
  };
850
851
  const unmarshalSetSnapshotResponse = data => {
@@ -852,7 +853,7 @@ const unmarshalSetSnapshotResponse = data => {
852
853
  throw new TypeError(`Unmarshalling the type 'SetSnapshotResponse' failed as data isn't a dictionary.`);
853
854
  }
854
855
  return {
855
- snapshot: unmarshalSnapshot(data.snapshot)
856
+ snapshot: data.snapshot ? unmarshalSnapshot(data.snapshot) : undefined
856
857
  };
857
858
  };
858
859
  const unmarshalUpdateIpResponse = data => {
@@ -860,7 +861,7 @@ const unmarshalUpdateIpResponse = data => {
860
861
  throw new TypeError(`Unmarshalling the type 'UpdateIpResponse' failed as data isn't a dictionary.`);
861
862
  }
862
863
  return {
863
- ip: unmarshalIp(data.ip)
864
+ ip: data.ip ? unmarshalIp(data.ip) : undefined
864
865
  };
865
866
  };
866
867
  const unmarshalUpdatePlacementGroupResponse = data => {
@@ -868,7 +869,7 @@ const unmarshalUpdatePlacementGroupResponse = data => {
868
869
  throw new TypeError(`Unmarshalling the type 'UpdatePlacementGroupResponse' failed as data isn't a dictionary.`);
869
870
  }
870
871
  return {
871
- placementGroup: unmarshalPlacementGroup(data.placement_group)
872
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined
872
873
  };
873
874
  };
874
875
  const unmarshalUpdatePlacementGroupServersResponse = data => {
@@ -884,7 +885,7 @@ const unmarshalUpdateServerResponse = data => {
884
885
  throw new TypeError(`Unmarshalling the type 'UpdateServerResponse' failed as data isn't a dictionary.`);
885
886
  }
886
887
  return {
887
- server: unmarshalServer(data.server)
888
+ server: data.server ? unmarshalServer(data.server) : undefined
888
889
  };
889
890
  };
890
891
  const unmarshalUpdateVolumeResponse = data => {
@@ -892,31 +893,54 @@ const unmarshalUpdateVolumeResponse = data => {
892
893
  throw new TypeError(`Unmarshalling the type 'UpdateVolumeResponse' failed as data isn't a dictionary.`);
893
894
  }
894
895
  return {
895
- volume: unmarshalVolume(data.volume)
896
+ volume: data.volume ? unmarshalVolume(data.volume) : undefined
896
897
  };
897
898
  };
898
899
  const marshalApplyBlockMigrationRequest = (request, defaults) => ({
899
900
  validation_key: request.validationKey,
900
901
  ...resolveOneOf([{
902
+ param: 'volume_id',
903
+ value: request.volumeId
904
+ }, {
901
905
  param: 'snapshot_id',
902
906
  value: request.snapshotId
907
+ }])
908
+ });
909
+ const marshalVolumeTemplate = (request, defaults) => ({
910
+ id: request.id,
911
+ name: request.name,
912
+ size: request.size,
913
+ volume_type: request.volumeType,
914
+ ...resolveOneOf([{
915
+ default: defaults.defaultOrganizationId,
916
+ param: 'organization',
917
+ value: request.organization
903
918
  }, {
904
- param: 'volume_id',
905
- value: request.volumeId
919
+ default: defaults.defaultProjectId,
920
+ param: 'project',
921
+ value: request.project
906
922
  }])
907
923
  });
908
924
  const marshalCreateImageRequest = (request, defaults) => ({
909
925
  arch: request.arch,
910
926
  default_bootscript: request.defaultBootscript,
911
- extra_volumes: request.extraVolumes,
927
+ extra_volumes: request.extraVolumes !== undefined ? Object.entries(request.extraVolumes).reduce((acc, _ref) => {
928
+ let [key, value] = _ref;
929
+ return {
930
+ ...acc,
931
+ [key]: marshalVolumeTemplate(value, defaults)
932
+ };
933
+ }, {}) : undefined,
912
934
  name: request.name || randomName('img'),
913
935
  public: request.public,
914
936
  root_volume: request.rootVolume,
915
937
  tags: request.tags,
916
938
  ...resolveOneOf([{
939
+ default: defaults.defaultOrganizationId,
917
940
  param: 'organization',
918
941
  value: request.organization
919
942
  }, {
943
+ default: defaults.defaultProjectId,
920
944
  param: 'project',
921
945
  value: request.project
922
946
  }])
@@ -926,9 +950,11 @@ const marshalCreateIpRequest = (request, defaults) => ({
926
950
  tags: request.tags,
927
951
  type: request.type,
928
952
  ...resolveOneOf([{
953
+ default: defaults.defaultOrganizationId,
929
954
  param: 'organization',
930
955
  value: request.organization
931
956
  }, {
957
+ default: defaults.defaultProjectId,
932
958
  param: 'project',
933
959
  value: request.project
934
960
  }])
@@ -939,9 +965,11 @@ const marshalCreatePlacementGroupRequest = (request, defaults) => ({
939
965
  policy_type: request.policyType,
940
966
  tags: request.tags,
941
967
  ...resolveOneOf([{
968
+ default: defaults.defaultOrganizationId,
942
969
  param: 'organization',
943
970
  value: request.organization
944
971
  }, {
972
+ default: defaults.defaultProjectId,
945
973
  param: 'project',
946
974
  value: request.project
947
975
  }])
@@ -960,9 +988,11 @@ const marshalCreateSecurityGroupRequest = (request, defaults) => ({
960
988
  stateful: request.stateful,
961
989
  tags: request.tags,
962
990
  ...resolveOneOf([{
991
+ default: defaults.defaultOrganizationId,
963
992
  param: 'organization',
964
993
  value: request.organization
965
994
  }, {
995
+ default: defaults.defaultProjectId,
966
996
  param: 'project',
967
997
  value: request.project
968
998
  }]),
@@ -984,6 +1014,16 @@ const marshalCreateSecurityGroupRuleRequest = (request, defaults) => ({
984
1014
  position: request.position,
985
1015
  protocol: request.protocol
986
1016
  });
1017
+ const marshalVolumeServerTemplate = (request, defaults) => ({
1018
+ base_snapshot: request.baseSnapshot,
1019
+ boot: request.boot,
1020
+ id: request.id,
1021
+ name: request.name,
1022
+ organization: request.organization ?? defaults.defaultOrganizationId,
1023
+ project: request.project ?? defaults.defaultProjectId,
1024
+ size: request.size,
1025
+ volume_type: request.volumeType
1026
+ });
987
1027
  const marshalCreateServerRequest = (request, defaults) => ({
988
1028
  boot_type: request.bootType,
989
1029
  bootscript: request.bootscript,
@@ -998,11 +1038,19 @@ const marshalCreateServerRequest = (request, defaults) => ({
998
1038
  routed_ip_enabled: request.routedIpEnabled,
999
1039
  security_group: request.securityGroup,
1000
1040
  tags: request.tags,
1001
- volumes: request.volumes,
1041
+ volumes: request.volumes !== undefined ? Object.entries(request.volumes).reduce((acc, _ref2) => {
1042
+ let [key, value] = _ref2;
1043
+ return {
1044
+ ...acc,
1045
+ [key]: marshalVolumeServerTemplate(value, defaults)
1046
+ };
1047
+ }, {}) : undefined,
1002
1048
  ...resolveOneOf([{
1049
+ default: defaults.defaultOrganizationId,
1003
1050
  param: 'organization',
1004
1051
  value: request.organization
1005
1052
  }, {
1053
+ default: defaults.defaultProjectId,
1006
1054
  param: 'project',
1007
1055
  value: request.project
1008
1056
  }])
@@ -1016,9 +1064,11 @@ const marshalCreateSnapshotRequest = (request, defaults) => ({
1016
1064
  volume_id: request.volumeId,
1017
1065
  volume_type: request.volumeType,
1018
1066
  ...resolveOneOf([{
1067
+ default: defaults.defaultOrganizationId,
1019
1068
  param: 'organization',
1020
1069
  value: request.organization
1021
1070
  }, {
1071
+ default: defaults.defaultProjectId,
1022
1072
  param: 'project',
1023
1073
  value: request.project
1024
1074
  }])
@@ -1028,21 +1078,23 @@ const marshalCreateVolumeRequest = (request, defaults) => ({
1028
1078
  tags: request.tags,
1029
1079
  volume_type: request.volumeType,
1030
1080
  ...resolveOneOf([{
1081
+ default: defaults.defaultOrganizationId,
1031
1082
  param: 'organization',
1032
1083
  value: request.organization
1033
1084
  }, {
1085
+ default: defaults.defaultProjectId,
1034
1086
  param: 'project',
1035
1087
  value: request.project
1036
1088
  }]),
1037
1089
  ...resolveOneOf([{
1038
- param: 'base_snapshot',
1039
- value: request.baseSnapshot
1090
+ param: 'size',
1091
+ value: request.size
1040
1092
  }, {
1041
1093
  param: 'base_volume',
1042
1094
  value: request.baseVolume
1043
1095
  }, {
1044
- param: 'size',
1045
- value: request.size
1096
+ param: 'base_snapshot',
1097
+ value: request.baseSnapshot
1046
1098
  }])
1047
1099
  });
1048
1100
  const marshalExportSnapshotRequest = (request, defaults) => ({
@@ -1051,30 +1103,84 @@ const marshalExportSnapshotRequest = (request, defaults) => ({
1051
1103
  });
1052
1104
  const marshalPlanBlockMigrationRequest = (request, defaults) => ({
1053
1105
  ...resolveOneOf([{
1054
- param: 'snapshot_id',
1055
- value: request.snapshotId
1056
- }, {
1057
1106
  param: 'volume_id',
1058
1107
  value: request.volumeId
1108
+ }, {
1109
+ param: 'snapshot_id',
1110
+ value: request.snapshotId
1059
1111
  }])
1060
1112
  });
1113
+ const marshalServerActionRequestVolumeBackupTemplate = (request, defaults) => ({
1114
+ volume_type: request.volumeType
1115
+ });
1061
1116
  const marshalServerActionRequest = (request, defaults) => ({
1062
1117
  action: request.action,
1063
1118
  name: request.name,
1064
- volumes: request.volumes
1119
+ volumes: request.volumes !== undefined ? Object.entries(request.volumes).reduce((acc, _ref3) => {
1120
+ let [key, value] = _ref3;
1121
+ return {
1122
+ ...acc,
1123
+ [key]: marshalServerActionRequestVolumeBackupTemplate(value)
1124
+ };
1125
+ }, {}) : undefined
1126
+ });
1127
+ const marshalServerSummary = (request, defaults) => ({
1128
+ id: request.id,
1129
+ name: request.name
1130
+ });
1131
+ const marshalBootscript = (request, defaults) => ({
1132
+ arch: request.arch,
1133
+ bootcmdargs: request.bootcmdargs,
1134
+ default: request.default,
1135
+ dtb: request.dtb,
1136
+ id: request.id,
1137
+ initrd: request.initrd,
1138
+ kernel: request.kernel,
1139
+ organization: request.organization,
1140
+ project: request.project,
1141
+ public: request.public,
1142
+ title: request.title,
1143
+ zone: request.zone
1144
+ });
1145
+ const marshalVolume = (request, defaults) => ({
1146
+ creation_date: request.creationDate,
1147
+ export_uri: request.exportUri,
1148
+ id: request.id,
1149
+ modification_date: request.modificationDate,
1150
+ name: request.name,
1151
+ organization: request.organization,
1152
+ project: request.project,
1153
+ server: request.server !== undefined ? marshalServerSummary(request.server) : undefined,
1154
+ size: request.size,
1155
+ state: request.state,
1156
+ tags: request.tags,
1157
+ volume_type: request.volumeType,
1158
+ zone: request.zone
1159
+ });
1160
+ const marshalVolumeSummary = (request, defaults) => ({
1161
+ id: request.id,
1162
+ name: request.name,
1163
+ size: request.size,
1164
+ volume_type: request.volumeType
1065
1165
  });
1066
1166
  const marshalSetImageRequest = (request, defaults) => ({
1067
1167
  arch: request.arch,
1068
1168
  creation_date: request.creationDate,
1069
- default_bootscript: request.defaultBootscript,
1070
- extra_volumes: request.extraVolumes,
1169
+ default_bootscript: request.defaultBootscript !== undefined ? marshalBootscript(request.defaultBootscript) : undefined,
1170
+ extra_volumes: request.extraVolumes !== undefined ? Object.entries(request.extraVolumes).reduce((acc, _ref4) => {
1171
+ let [key, value] = _ref4;
1172
+ return {
1173
+ ...acc,
1174
+ [key]: marshalVolume(value)
1175
+ };
1176
+ }, {}) : undefined,
1071
1177
  from_server: request.fromServer,
1072
1178
  modification_date: request.modificationDate,
1073
1179
  name: request.name,
1074
1180
  organization: request.organization ?? defaults.defaultOrganizationId,
1075
1181
  project: request.project ?? defaults.defaultProjectId,
1076
1182
  public: request.public,
1077
- root_volume: request.rootVolume,
1183
+ root_volume: request.rootVolume !== undefined ? marshalVolumeSummary(request.rootVolume) : undefined,
1078
1184
  state: request.state,
1079
1185
  tags: request.tags
1080
1186
  });
@@ -1101,7 +1207,7 @@ const marshalSetSecurityGroupRequest = (request, defaults) => ({
1101
1207
  outbound_default_policy: request.outboundDefaultPolicy,
1102
1208
  project: request.project ?? defaults.defaultProjectId,
1103
1209
  project_default: request.projectDefault,
1104
- servers: request.servers,
1210
+ servers: request.servers !== undefined ? request.servers.map(elt => marshalServerSummary(elt)) : undefined,
1105
1211
  stateful: request.stateful,
1106
1212
  tags: request.tags
1107
1213
  });
@@ -1116,42 +1222,135 @@ const marshalSetSecurityGroupRuleRequest = (request, defaults) => ({
1116
1222
  position: request.position,
1117
1223
  protocol: request.protocol
1118
1224
  });
1225
+ const marshalSetSecurityGroupRulesRequestRule = (request, defaults) => ({
1226
+ action: request.action,
1227
+ dest_port_from: request.destPortFrom,
1228
+ dest_port_to: request.destPortTo,
1229
+ direction: request.direction,
1230
+ editable: request.editable,
1231
+ id: request.id,
1232
+ ip_range: request.ipRange,
1233
+ position: request.position,
1234
+ protocol: request.protocol,
1235
+ zone: request.zone ?? defaults.defaultZone
1236
+ });
1119
1237
  const marshalSetSecurityGroupRulesRequest = (request, defaults) => ({
1120
- rules: request.rules
1238
+ rules: request.rules !== undefined ? request.rules.map(elt => marshalSetSecurityGroupRulesRequestRule(elt, defaults)) : undefined
1239
+ });
1240
+ const marshalImage = (request, defaults) => ({
1241
+ arch: request.arch,
1242
+ creation_date: request.creationDate,
1243
+ default_bootscript: request.defaultBootscript !== undefined ? marshalBootscript(request.defaultBootscript) : undefined,
1244
+ extra_volumes: Object.entries(request.extraVolumes).reduce((acc, _ref5) => {
1245
+ let [key, value] = _ref5;
1246
+ return {
1247
+ ...acc,
1248
+ [key]: marshalVolume(value)
1249
+ };
1250
+ }, {}),
1251
+ from_server: request.fromServer,
1252
+ id: request.id,
1253
+ modification_date: request.modificationDate,
1254
+ name: request.name,
1255
+ organization: request.organization,
1256
+ project: request.project,
1257
+ public: request.public,
1258
+ root_volume: request.rootVolume !== undefined ? marshalVolumeSummary(request.rootVolume) : undefined,
1259
+ state: request.state,
1260
+ tags: request.tags,
1261
+ zone: request.zone
1262
+ });
1263
+ const marshalPlacementGroup = (request, defaults) => ({
1264
+ id: request.id,
1265
+ name: request.name,
1266
+ organization: request.organization,
1267
+ policy_mode: request.policyMode,
1268
+ policy_respected: request.policyRespected,
1269
+ policy_type: request.policyType,
1270
+ project: request.project,
1271
+ tags: request.tags,
1272
+ zone: request.zone
1273
+ });
1274
+ const marshalPrivateNIC = (request, defaults) => ({
1275
+ id: request.id,
1276
+ mac_address: request.macAddress,
1277
+ private_network_id: request.privateNetworkId,
1278
+ server_id: request.serverId,
1279
+ state: request.state,
1280
+ tags: request.tags
1281
+ });
1282
+ const marshalSecurityGroupSummary = (request, defaults) => ({
1283
+ id: request.id,
1284
+ name: request.name
1285
+ });
1286
+ const marshalServerIp = (request, defaults) => ({
1287
+ address: request.address,
1288
+ dynamic: request.dynamic,
1289
+ family: request.family,
1290
+ gateway: request.gateway,
1291
+ id: request.id,
1292
+ netmask: request.netmask,
1293
+ provisioning_mode: request.provisioningMode,
1294
+ tags: request.tags
1295
+ });
1296
+ const marshalServerIpv6 = (request, defaults) => ({
1297
+ address: request.address,
1298
+ gateway: request.gateway,
1299
+ netmask: request.netmask
1300
+ });
1301
+ const marshalServerLocation = (request, defaults) => ({
1302
+ cluster_id: request.clusterId,
1303
+ hypervisor_id: request.hypervisorId,
1304
+ node_id: request.nodeId,
1305
+ platform_id: request.platformId,
1306
+ zone_id: request.zoneId
1307
+ });
1308
+ const marshalServerMaintenance = (request, defaults) => ({
1309
+ reason: request.reason
1121
1310
  });
1122
1311
  const marshalSetServerRequest = (request, defaults) => ({
1123
- allowed_actions: request.allowedActions,
1312
+ allowed_actions: request.allowedActions !== undefined ? request.allowedActions : undefined,
1124
1313
  arch: request.arch,
1125
1314
  boot_type: request.bootType,
1126
- bootscript: request.bootscript,
1315
+ bootscript: request.bootscript !== undefined ? marshalBootscript(request.bootscript) : undefined,
1127
1316
  commercial_type: request.commercialType,
1128
1317
  creation_date: request.creationDate,
1129
1318
  dynamic_ip_required: request.dynamicIpRequired,
1130
1319
  enable_ipv6: request.enableIpv6,
1131
1320
  hostname: request.hostname,
1132
- image: request.image,
1133
- ipv6: request.ipv6,
1134
- location: request.location,
1135
- maintenances: request.maintenances,
1321
+ image: request.image !== undefined ? marshalImage(request.image) : undefined,
1322
+ ipv6: request.ipv6 !== undefined ? marshalServerIpv6(request.ipv6) : undefined,
1323
+ location: request.location !== undefined ? marshalServerLocation(request.location) : undefined,
1324
+ maintenances: request.maintenances !== undefined ? request.maintenances.map(elt => marshalServerMaintenance(elt)) : undefined,
1136
1325
  modification_date: request.modificationDate,
1137
1326
  name: request.name,
1138
1327
  organization: request.organization ?? defaults.defaultOrganizationId,
1139
- placement_group: request.placementGroup,
1328
+ placement_group: request.placementGroup !== undefined ? marshalPlacementGroup(request.placementGroup) : undefined,
1140
1329
  private_ip: request.privateIp,
1141
- private_nics: request.privateNics,
1330
+ private_nics: request.privateNics !== undefined ? request.privateNics.map(elt => marshalPrivateNIC(elt)) : undefined,
1142
1331
  project: request.project ?? defaults.defaultProjectId,
1143
1332
  protected: request.protected,
1144
- public_ip: request.publicIp,
1145
- public_ips: request.publicIps,
1333
+ public_ip: request.publicIp !== undefined ? marshalServerIp(request.publicIp) : undefined,
1334
+ public_ips: request.publicIps !== undefined ? request.publicIps.map(elt => marshalServerIp(elt)) : undefined,
1146
1335
  routed_ip_enabled: request.routedIpEnabled,
1147
- security_group: request.securityGroup,
1336
+ security_group: request.securityGroup !== undefined ? marshalSecurityGroupSummary(request.securityGroup) : undefined,
1148
1337
  state: request.state,
1149
1338
  state_detail: request.stateDetail,
1150
1339
  tags: request.tags,
1151
- volumes: request.volumes
1340
+ volumes: request.volumes !== undefined ? Object.entries(request.volumes).reduce((acc, _ref6) => {
1341
+ let [key, value] = _ref6;
1342
+ return {
1343
+ ...acc,
1344
+ [key]: marshalVolume(value)
1345
+ };
1346
+ }, {}) : undefined
1347
+ });
1348
+ const marshalSnapshotBaseVolume = (request, defaults) => ({
1349
+ id: request.id,
1350
+ name: request.name
1152
1351
  });
1153
1352
  const marshalSetSnapshotRequest = (request, defaults) => ({
1154
- base_volume: request.baseVolume,
1353
+ base_volume: request.baseVolume !== undefined ? marshalSnapshotBaseVolume(request.baseVolume) : undefined,
1155
1354
  creation_date: request.creationDate,
1156
1355
  id: request.id,
1157
1356
  modification_date: request.modificationDate,
@@ -1181,6 +1380,10 @@ const marshalUpdatePlacementGroupServersRequest = (request, defaults) => ({
1181
1380
  const marshalUpdatePrivateNICRequest = (request, defaults) => ({
1182
1381
  tags: request.tags
1183
1382
  });
1383
+ const marshalSecurityGroupTemplate = (request, defaults) => ({
1384
+ id: request.id,
1385
+ name: request.name
1386
+ });
1184
1387
  const marshalUpdateServerRequest = (request, defaults) => ({
1185
1388
  boot_type: request.bootType,
1186
1389
  bootscript: request.bootscript,
@@ -1193,9 +1396,15 @@ const marshalUpdateServerRequest = (request, defaults) => ({
1193
1396
  protected: request.protected,
1194
1397
  public_ips: request.publicIps,
1195
1398
  routed_ip_enabled: request.routedIpEnabled,
1196
- security_group: request.securityGroup,
1399
+ security_group: request.securityGroup !== undefined ? marshalSecurityGroupTemplate(request.securityGroup) : undefined,
1197
1400
  tags: request.tags,
1198
- volumes: request.volumes
1401
+ volumes: request.volumes !== undefined ? Object.entries(request.volumes).reduce((acc, _ref7) => {
1402
+ let [key, value] = _ref7;
1403
+ return {
1404
+ ...acc,
1405
+ [key]: marshalVolumeServerTemplate(value, defaults)
1406
+ };
1407
+ }, {}) : undefined
1199
1408
  });
1200
1409
  const marshalUpdateVolumeRequest = (request, defaults) => ({
1201
1410
  name: request.name,