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