@scaleway/sdk 2.0.0-alpha.13 → 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 (215) hide show
  1. package/dist/api/account/index.js +4 -0
  2. package/dist/api/account/v2/api.gen.js +147 -0
  3. package/dist/api/account/v2/index.gen.js +4 -0
  4. package/dist/api/account/v2/marshalling.gen.js +39 -0
  5. package/dist/api/account/v3/api.gen.js +129 -0
  6. package/dist/api/account/v3/index.gen.js +6 -0
  7. package/dist/api/account/v3/marshalling.gen.js +39 -0
  8. package/dist/api/account/v3/validation-rules.gen.js +39 -0
  9. package/dist/api/applesilicon/index.js +2 -0
  10. package/dist/api/applesilicon/v1alpha1/api.gen.js +220 -0
  11. package/dist/api/applesilicon/v1alpha1/content.gen.js +7 -0
  12. package/dist/api/applesilicon/v1alpha1/index.gen.js +5 -0
  13. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +113 -0
  14. package/dist/api/baremetal/index.js +2 -0
  15. package/dist/api/baremetal/v1/api.gen.js +523 -0
  16. package/dist/api/baremetal/v1/api.utils.js +27 -0
  17. package/dist/api/baremetal/v1/content.gen.js +13 -0
  18. package/dist/api/baremetal/v1/index.js +5 -0
  19. package/dist/api/baremetal/v1/marshalling.gen.js +406 -0
  20. package/dist/api/baremetal/v1/validation-rules.gen.js +109 -0
  21. package/dist/api/billing/index.js +2 -0
  22. package/dist/api/billing/v2alpha1/api.gen.js +80 -0
  23. package/dist/api/billing/v2alpha1/index.gen.js +4 -0
  24. package/dist/api/billing/v2alpha1/marshalling.gen.js +53 -0
  25. package/dist/api/block/index.js +2 -0
  26. package/dist/api/block/v1alpha1/api.gen.js +249 -0
  27. package/dist/api/block/v1alpha1/content.gen.js +13 -0
  28. package/dist/api/block/v1alpha1/index.gen.js +7 -0
  29. package/dist/api/block/v1alpha1/marshalling.gen.js +182 -0
  30. package/dist/api/block/v1alpha1/validation-rules.gen.js +52 -0
  31. package/dist/api/cockpit/index.js +2 -0
  32. package/dist/api/cockpit/v1beta1/api.gen.js +543 -0
  33. package/dist/api/cockpit/v1beta1/content.gen.js +7 -0
  34. package/dist/api/cockpit/v1beta1/index.gen.js +5 -0
  35. package/dist/api/cockpit/v1beta1/marshalling.gen.js +271 -0
  36. package/dist/api/container/index.js +2 -0
  37. package/dist/api/container/v1beta1/api.gen.js +549 -0
  38. package/dist/api/container/v1beta1/content.gen.js +22 -0
  39. package/dist/api/container/v1beta1/index.gen.js +7 -0
  40. package/dist/api/container/v1beta1/marshalling.gen.js +358 -0
  41. package/dist/api/container/v1beta1/validation-rules.gen.js +44 -0
  42. package/dist/api/document_db/index.js +2 -0
  43. package/dist/api/document_db/v1beta1/api.gen.js +830 -0
  44. package/dist/api/document_db/v1beta1/content.gen.js +19 -0
  45. package/dist/api/document_db/v1beta1/index.gen.js +7 -0
  46. package/dist/api/document_db/v1beta1/marshalling.gen.js +636 -0
  47. package/dist/api/document_db/v1beta1/validation-rules.gen.js +10 -0
  48. package/dist/api/domain/index.js +2 -0
  49. package/dist/api/domain/v2beta1/api.gen.js +867 -0
  50. package/dist/api/domain/v2beta1/content.gen.js +28 -0
  51. package/dist/api/domain/v2beta1/index.gen.js +5 -0
  52. package/dist/api/domain/v2beta1/marshalling.gen.js +1172 -0
  53. package/dist/api/flexibleip/index.js +2 -0
  54. package/dist/api/flexibleip/v1alpha1/api.gen.js +195 -0
  55. package/dist/api/flexibleip/v1alpha1/content.gen.js +10 -0
  56. package/dist/api/flexibleip/v1alpha1/index.gen.js +7 -0
  57. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +97 -0
  58. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +14 -0
  59. package/dist/api/function/index.js +2 -0
  60. package/dist/api/function/v1beta1/api.gen.js +560 -0
  61. package/dist/api/function/v1beta1/content.gen.js +22 -0
  62. package/dist/api/function/v1beta1/index.gen.js +7 -0
  63. package/dist/api/function/v1beta1/marshalling.gen.js +396 -0
  64. package/dist/api/function/v1beta1/validation-rules.gen.js +44 -0
  65. package/dist/api/iam/index.js +2 -0
  66. package/dist/api/iam/v1alpha1/api.gen.js +783 -0
  67. package/dist/api/iam/v1alpha1/index.gen.js +6 -0
  68. package/dist/api/iam/v1alpha1/marshalling.gen.js +384 -0
  69. package/dist/api/iam/v1alpha1/validation-rules.gen.js +207 -0
  70. package/dist/api/instance/index.js +2 -0
  71. package/dist/api/instance/v1/api.gen.js +1003 -0
  72. package/dist/api/instance/v1/api.utils.js +369 -0
  73. package/dist/api/instance/v1/content.gen.js +31 -0
  74. package/dist/api/instance/v1/index.js +2 -0
  75. package/dist/api/instance/v1/marshalling.gen.js +1415 -0
  76. package/dist/api/instance/v1/marshalling.utils.js +63 -0
  77. package/dist/api/iot/index.js +2 -0
  78. package/dist/api/iot/v1/api.gen.js +573 -0
  79. package/dist/api/iot/v1/content.gen.js +7 -0
  80. package/dist/api/iot/v1/index.gen.js +5 -0
  81. package/dist/api/iot/v1/marshalling.gen.js +439 -0
  82. package/dist/api/ipam/index.js +2 -0
  83. package/dist/api/ipam/v1/api.gen.js +113 -0
  84. package/dist/api/ipam/v1/index.gen.js +6 -0
  85. package/dist/api/ipam/v1/marshalling.gen.js +77 -0
  86. package/dist/api/ipam/v1/validation-rules.gen.js +11 -0
  87. package/dist/api/ipfs/index.js +2 -0
  88. package/dist/api/ipfs/v1alpha1/api.gen.js +314 -0
  89. package/dist/api/ipfs/v1alpha1/content.gen.js +10 -0
  90. package/dist/api/ipfs/v1alpha1/index.gen.js +5 -0
  91. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +180 -0
  92. package/dist/api/k8s/index.js +2 -0
  93. package/dist/api/k8s/v1/api.gen.js +454 -0
  94. package/dist/api/k8s/v1/api.utils.js +13 -0
  95. package/dist/api/k8s/v1/content.gen.js +13 -0
  96. package/dist/api/k8s/v1/index.js +4 -0
  97. package/dist/api/k8s/v1/marshalling.gen.js +421 -0
  98. package/dist/api/k8s/v1/validation-rules.gen.js +101 -0
  99. package/dist/api/lb/index.js +2 -0
  100. package/dist/api/lb/v1/api.gen.js +1669 -0
  101. package/dist/api/lb/v1/api.utils.js +81 -0
  102. package/dist/api/lb/v1/content.gen.js +16 -0
  103. package/dist/api/lb/v1/index.js +2 -0
  104. package/dist/api/lb/v1/marshalling.gen.js +1039 -0
  105. package/dist/api/marketplace/index.js +4 -0
  106. package/dist/api/marketplace/v1/api.gen.js +60 -0
  107. package/dist/api/marketplace/v1/index.gen.js +4 -0
  108. package/dist/api/marketplace/v1/marshalling.gen.js +92 -0
  109. package/dist/api/marketplace/v2/api.gen.js +162 -0
  110. package/dist/api/marketplace/v2/index.gen.js +4 -0
  111. package/dist/api/marketplace/v2/marshalling.gen.js +94 -0
  112. package/dist/api/mnq/index.js +4 -0
  113. package/dist/api/mnq/v1alpha1/api.gen.js +197 -0
  114. package/dist/api/mnq/v1alpha1/index.gen.js +4 -0
  115. package/dist/api/mnq/v1alpha1/marshalling.gen.js +126 -0
  116. package/dist/api/mnq/v1beta1/api.gen.js +529 -0
  117. package/dist/api/mnq/v1beta1/index.gen.js +6 -0
  118. package/dist/api/mnq/v1beta1/marshalling.gen.js +212 -0
  119. package/dist/api/mnq/v1beta1/validation-rules.gen.js +77 -0
  120. package/dist/api/rdb/index.js +2 -0
  121. package/dist/api/rdb/v1/api.gen.js +972 -0
  122. package/dist/api/rdb/v1/content.gen.js +22 -0
  123. package/dist/api/rdb/v1/index.gen.js +7 -0
  124. package/dist/api/rdb/v1/marshalling.gen.js +694 -0
  125. package/dist/api/rdb/v1/validation-rules.gen.js +10 -0
  126. package/dist/api/redis/index.js +2 -0
  127. package/dist/api/redis/v1/api.gen.js +389 -0
  128. package/dist/api/redis/v1/content.gen.js +7 -0
  129. package/dist/api/redis/v1/index.gen.js +5 -0
  130. package/dist/api/redis/v1/marshalling.gen.js +283 -0
  131. package/dist/api/registry/index.js +2 -0
  132. package/dist/api/registry/v1/api.gen.js +252 -0
  133. package/dist/api/registry/v1/content.gen.js +13 -0
  134. package/dist/api/registry/v1/index.gen.js +5 -0
  135. package/dist/api/registry/v1/marshalling.gen.js +108 -0
  136. package/dist/api/secret/index.js +2 -0
  137. package/dist/api/secret/v1alpha1/api.gen.js +415 -0
  138. package/dist/api/secret/v1alpha1/index.gen.js +4 -0
  139. package/dist/api/secret/v1alpha1/marshalling.gen.js +150 -0
  140. package/dist/api/tem/index.js +2 -0
  141. package/dist/api/tem/v1alpha1/api.gen.js +229 -0
  142. package/dist/api/tem/v1alpha1/content.gen.js +10 -0
  143. package/dist/api/tem/v1alpha1/index.gen.js +5 -0
  144. package/dist/api/tem/v1alpha1/marshalling.gen.js +168 -0
  145. package/dist/api/test/index.js +2 -0
  146. package/dist/api/test/v1/api.gen.js +152 -0
  147. package/dist/api/test/v1/content.gen.js +7 -0
  148. package/dist/api/test/v1/index.gen.js +5 -0
  149. package/dist/api/test/v1/marshalling.gen.js +81 -0
  150. package/dist/api/vpc/index.js +4 -0
  151. package/dist/api/vpc/v1/api.gen.js +110 -0
  152. package/dist/api/vpc/v1/index.gen.js +4 -0
  153. package/dist/api/vpc/v1/marshalling.gen.js +44 -0
  154. package/dist/api/vpc/v2/api.gen.js +276 -0
  155. package/dist/api/vpc/v2/index.gen.js +4 -0
  156. package/dist/api/vpc/v2/marshalling.gen.js +137 -0
  157. package/dist/api/vpcgw/index.js +2 -0
  158. package/dist/api/vpcgw/v1/api.gen.js +669 -0
  159. package/dist/api/vpcgw/v1/content.gen.js +10 -0
  160. package/dist/api/vpcgw/v1/index.gen.js +5 -0
  161. package/dist/api/vpcgw/v1/marshalling.gen.js +359 -0
  162. package/dist/api/webhosting/index.js +2 -0
  163. package/dist/api/webhosting/v1alpha1/api.gen.js +158 -0
  164. package/dist/api/webhosting/v1alpha1/content.gen.js +7 -0
  165. package/dist/api/webhosting/v1alpha1/index.gen.js +7 -0
  166. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +146 -0
  167. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +14 -0
  168. package/dist/helpers/is-browser.js +5 -0
  169. package/dist/helpers/is-response.js +10 -0
  170. package/dist/helpers/json.js +11 -0
  171. package/dist/helpers/marshalling.js +130 -0
  172. package/dist/index.cjs +26484 -0
  173. package/dist/index.d.ts +31184 -0
  174. package/dist/index.js +71 -0
  175. package/dist/internal/async/interval-retrier.js +105 -0
  176. package/dist/internal/async/sleep.js +13 -0
  177. package/dist/internal/interceptors/composer.js +46 -0
  178. package/dist/internal/interceptors/helpers.js +32 -0
  179. package/dist/internal/logger/console-logger.js +38 -0
  180. package/dist/internal/logger/index.js +41 -0
  181. package/dist/internal/logger/level-resolver.js +13 -0
  182. package/dist/internal/validations/string-validation.js +38 -0
  183. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js +13 -0
  184. package/dist/scw/api.js +12 -0
  185. package/dist/scw/auth.js +68 -0
  186. package/dist/scw/client-ini-factory.js +174 -0
  187. package/dist/scw/client-ini-profile.js +54 -0
  188. package/dist/scw/client-settings.js +78 -0
  189. package/dist/scw/client.js +98 -0
  190. package/dist/scw/constants.js +4 -0
  191. package/dist/scw/custom-marshalling.js +131 -0
  192. package/dist/scw/errors/error-parser.js +107 -0
  193. package/dist/scw/errors/non-standard/invalid-request-mapper.js +36 -0
  194. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +27 -0
  195. package/dist/scw/errors/scw-error.js +66 -0
  196. package/dist/scw/errors/standard/already-exists-error.js +26 -0
  197. package/dist/scw/errors/standard/denied-authentication-error.js +52 -0
  198. package/dist/scw/errors/standard/index.js +13 -0
  199. package/dist/scw/errors/standard/invalid-arguments-error.js +67 -0
  200. package/dist/scw/errors/standard/out-of-stock-error.js +22 -0
  201. package/dist/scw/errors/standard/permissions-denied-error.js +48 -0
  202. package/dist/scw/errors/standard/precondition-failed-error.js +42 -0
  203. package/dist/scw/errors/standard/quotas-exceeded-error.js +68 -0
  204. package/dist/scw/errors/standard/resource-expired-error.js +26 -0
  205. package/dist/scw/errors/standard/resource-locked-error.js +25 -0
  206. package/dist/scw/errors/standard/resource-not-found-error.js +25 -0
  207. package/dist/scw/errors/standard/too-many-requests-error.js +70 -0
  208. package/dist/scw/errors/standard/transient-state-error.js +26 -0
  209. package/dist/scw/errors/types.js +23 -0
  210. package/dist/scw/fetch/build-fetcher.js +72 -0
  211. package/dist/scw/fetch/http-dumper.js +54 -0
  212. package/dist/scw/fetch/http-interceptors.js +99 -0
  213. package/dist/scw/fetch/resource-paginator.js +84 -0
  214. package/dist/scw/fetch/response-parser.js +72 -0
  215. package/package.json +2 -2
@@ -0,0 +1,1415 @@
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js';
2
+ import { isJSONObject } from '../../../helpers/json.js';
3
+ import { unmarshalDate, unmarshalMapOfObject, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
4
+
5
+ // This file was automatically generated. DO NOT EDIT.
6
+ // If you have any remark or suggestion do not hesitate to open an issue.
7
+ const unmarshalPrivateNIC = data => {
8
+ if (!isJSONObject(data)) {
9
+ throw new TypeError(`Unmarshalling the type 'PrivateNIC' failed as data isn't a dictionary.`);
10
+ }
11
+ return {
12
+ id: data.id,
13
+ macAddress: data.mac_address,
14
+ privateNetworkId: data.private_network_id,
15
+ serverId: data.server_id,
16
+ state: data.state,
17
+ tags: data.tags
18
+ };
19
+ };
20
+ const unmarshalServerSummary = data => {
21
+ if (!isJSONObject(data)) {
22
+ throw new TypeError(`Unmarshalling the type 'ServerSummary' failed as data isn't a dictionary.`);
23
+ }
24
+ return {
25
+ id: data.id,
26
+ name: data.name
27
+ };
28
+ };
29
+ const unmarshalBootscript = data => {
30
+ if (!isJSONObject(data)) {
31
+ throw new TypeError(`Unmarshalling the type 'Bootscript' failed as data isn't a dictionary.`);
32
+ }
33
+ return {
34
+ arch: data.arch,
35
+ bootcmdargs: data.bootcmdargs,
36
+ default: data.default,
37
+ dtb: data.dtb,
38
+ id: data.id,
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
46
+ };
47
+ };
48
+ const unmarshalVolume = data => {
49
+ if (!isJSONObject(data)) {
50
+ throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
51
+ }
52
+ return {
53
+ creationDate: unmarshalDate(data.creation_date),
54
+ exportUri: data.export_uri,
55
+ id: data.id,
56
+ modificationDate: unmarshalDate(data.modification_date),
57
+ name: data.name,
58
+ organization: data.organization,
59
+ project: data.project,
60
+ server: data.server ? unmarshalServerSummary(data.server) : undefined,
61
+ size: data.size,
62
+ state: data.state,
63
+ tags: data.tags,
64
+ volumeType: data.volume_type,
65
+ zone: data.zone
66
+ };
67
+ };
68
+ const unmarshalVolumeSummary = data => {
69
+ if (!isJSONObject(data)) {
70
+ throw new TypeError(`Unmarshalling the type 'VolumeSummary' failed as data isn't a dictionary.`);
71
+ }
72
+ return {
73
+ id: data.id,
74
+ name: data.name,
75
+ size: data.size,
76
+ volumeType: data.volume_type
77
+ };
78
+ };
79
+ const unmarshalImage = data => {
80
+ if (!isJSONObject(data)) {
81
+ throw new TypeError(`Unmarshalling the type 'Image' failed as data isn't a dictionary.`);
82
+ }
83
+ return {
84
+ arch: data.arch,
85
+ creationDate: unmarshalDate(data.creation_date),
86
+ defaultBootscript: data.default_bootscript ? unmarshalBootscript(data.default_bootscript) : undefined,
87
+ extraVolumes: unmarshalMapOfObject(data.extra_volumes, unmarshalVolume),
88
+ fromServer: data.from_server,
89
+ id: data.id,
90
+ modificationDate: unmarshalDate(data.modification_date),
91
+ name: data.name,
92
+ organization: data.organization,
93
+ project: data.project,
94
+ public: data.public,
95
+ rootVolume: data.root_volume ? unmarshalVolumeSummary(data.root_volume) : undefined,
96
+ state: data.state,
97
+ tags: data.tags,
98
+ zone: data.zone
99
+ };
100
+ };
101
+ const unmarshalCreateImageResponse = data => {
102
+ if (!isJSONObject(data)) {
103
+ throw new TypeError(`Unmarshalling the type 'CreateImageResponse' failed as data isn't a dictionary.`);
104
+ }
105
+ return {
106
+ image: data.image ? unmarshalImage(data.image) : undefined
107
+ };
108
+ };
109
+ const unmarshalIp = data => {
110
+ if (!isJSONObject(data)) {
111
+ throw new TypeError(`Unmarshalling the type 'Ip' failed as data isn't a dictionary.`);
112
+ }
113
+ return {
114
+ address: data.address,
115
+ id: data.id,
116
+ organization: data.organization,
117
+ prefix: data.prefix,
118
+ project: data.project,
119
+ reverse: data.reverse,
120
+ server: data.server ? unmarshalServerSummary(data.server) : undefined,
121
+ state: data.state,
122
+ tags: data.tags,
123
+ type: data.type,
124
+ zone: data.zone
125
+ };
126
+ };
127
+ const unmarshalCreateIpResponse = data => {
128
+ if (!isJSONObject(data)) {
129
+ throw new TypeError(`Unmarshalling the type 'CreateIpResponse' failed as data isn't a dictionary.`);
130
+ }
131
+ return {
132
+ ip: data.ip ? unmarshalIp(data.ip) : undefined
133
+ };
134
+ };
135
+ const unmarshalPlacementGroup = data => {
136
+ if (!isJSONObject(data)) {
137
+ throw new TypeError(`Unmarshalling the type 'PlacementGroup' failed as data isn't a dictionary.`);
138
+ }
139
+ return {
140
+ id: data.id,
141
+ name: data.name,
142
+ organization: data.organization,
143
+ policyMode: data.policy_mode,
144
+ policyRespected: data.policy_respected,
145
+ policyType: data.policy_type,
146
+ project: data.project,
147
+ tags: data.tags,
148
+ zone: data.zone
149
+ };
150
+ };
151
+ const unmarshalCreatePlacementGroupResponse = data => {
152
+ if (!isJSONObject(data)) {
153
+ throw new TypeError(`Unmarshalling the type 'CreatePlacementGroupResponse' failed as data isn't a dictionary.`);
154
+ }
155
+ return {
156
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined
157
+ };
158
+ };
159
+ const unmarshalCreatePrivateNICResponse = data => {
160
+ if (!isJSONObject(data)) {
161
+ throw new TypeError(`Unmarshalling the type 'CreatePrivateNICResponse' failed as data isn't a dictionary.`);
162
+ }
163
+ return {
164
+ privateNic: data.private_nic ? unmarshalPrivateNIC(data.private_nic) : undefined
165
+ };
166
+ };
167
+ const unmarshalSecurityGroup = data => {
168
+ if (!isJSONObject(data)) {
169
+ throw new TypeError(`Unmarshalling the type 'SecurityGroup' failed as data isn't a dictionary.`);
170
+ }
171
+ return {
172
+ creationDate: unmarshalDate(data.creation_date),
173
+ description: data.description,
174
+ enableDefaultSecurity: data.enable_default_security,
175
+ id: data.id,
176
+ inboundDefaultPolicy: data.inbound_default_policy,
177
+ modificationDate: unmarshalDate(data.modification_date),
178
+ name: data.name,
179
+ organization: data.organization,
180
+ organizationDefault: data.organization_default,
181
+ outboundDefaultPolicy: data.outbound_default_policy,
182
+ project: data.project,
183
+ projectDefault: data.project_default,
184
+ servers: unmarshalArrayOfObject(data.servers, unmarshalServerSummary),
185
+ state: data.state,
186
+ stateful: data.stateful,
187
+ tags: data.tags,
188
+ zone: data.zone
189
+ };
190
+ };
191
+ const unmarshalCreateSecurityGroupResponse = data => {
192
+ if (!isJSONObject(data)) {
193
+ throw new TypeError(`Unmarshalling the type 'CreateSecurityGroupResponse' failed as data isn't a dictionary.`);
194
+ }
195
+ return {
196
+ securityGroup: data.security_group ? unmarshalSecurityGroup(data.security_group) : undefined
197
+ };
198
+ };
199
+ const unmarshalSecurityGroupRule = data => {
200
+ if (!isJSONObject(data)) {
201
+ throw new TypeError(`Unmarshalling the type 'SecurityGroupRule' failed as data isn't a dictionary.`);
202
+ }
203
+ return {
204
+ action: data.action,
205
+ destPortFrom: data.dest_port_from,
206
+ destPortTo: data.dest_port_to,
207
+ direction: data.direction,
208
+ editable: data.editable,
209
+ id: data.id,
210
+ ipRange: data.ip_range,
211
+ position: data.position,
212
+ protocol: data.protocol,
213
+ zone: data.zone
214
+ };
215
+ };
216
+ const unmarshalCreateSecurityGroupRuleResponse = data => {
217
+ if (!isJSONObject(data)) {
218
+ throw new TypeError(`Unmarshalling the type 'CreateSecurityGroupRuleResponse' failed as data isn't a dictionary.`);
219
+ }
220
+ return {
221
+ rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined
222
+ };
223
+ };
224
+ const unmarshalSecurityGroupSummary = data => {
225
+ if (!isJSONObject(data)) {
226
+ throw new TypeError(`Unmarshalling the type 'SecurityGroupSummary' failed as data isn't a dictionary.`);
227
+ }
228
+ return {
229
+ id: data.id,
230
+ name: data.name
231
+ };
232
+ };
233
+ const unmarshalServerIp = data => {
234
+ if (!isJSONObject(data)) {
235
+ throw new TypeError(`Unmarshalling the type 'ServerIp' failed as data isn't a dictionary.`);
236
+ }
237
+ return {
238
+ address: data.address,
239
+ dynamic: data.dynamic,
240
+ family: data.family,
241
+ gateway: data.gateway,
242
+ id: data.id,
243
+ netmask: data.netmask,
244
+ provisioningMode: data.provisioning_mode,
245
+ tags: data.tags
246
+ };
247
+ };
248
+ const unmarshalServerIpv6 = data => {
249
+ if (!isJSONObject(data)) {
250
+ throw new TypeError(`Unmarshalling the type 'ServerIpv6' failed as data isn't a dictionary.`);
251
+ }
252
+ return {
253
+ address: data.address,
254
+ gateway: data.gateway,
255
+ netmask: data.netmask
256
+ };
257
+ };
258
+ const unmarshalServerLocation = data => {
259
+ if (!isJSONObject(data)) {
260
+ throw new TypeError(`Unmarshalling the type 'ServerLocation' failed as data isn't a dictionary.`);
261
+ }
262
+ return {
263
+ clusterId: data.cluster_id,
264
+ hypervisorId: data.hypervisor_id,
265
+ nodeId: data.node_id,
266
+ platformId: data.platform_id,
267
+ zoneId: data.zone_id
268
+ };
269
+ };
270
+ const unmarshalServerMaintenance = data => {
271
+ if (!isJSONObject(data)) {
272
+ throw new TypeError(`Unmarshalling the type 'ServerMaintenance' failed as data isn't a dictionary.`);
273
+ }
274
+ return {
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,
286
+ id: data.id,
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
296
+ };
297
+ };
298
+ const unmarshalServer = data => {
299
+ if (!isJSONObject(data)) {
300
+ throw new TypeError(`Unmarshalling the type 'Server' failed as data isn't a dictionary.`);
301
+ }
302
+ return {
303
+ allowedActions: data.allowed_actions,
304
+ arch: data.arch,
305
+ bootType: data.boot_type,
306
+ bootscript: data.bootscript ? unmarshalBootscript(data.bootscript) : undefined,
307
+ commercialType: data.commercial_type,
308
+ creationDate: unmarshalDate(data.creation_date),
309
+ dynamicIpRequired: data.dynamic_ip_required,
310
+ enableIpv6: data.enable_ipv6,
311
+ hostname: data.hostname,
312
+ id: data.id,
313
+ image: data.image ? unmarshalImage(data.image) : undefined,
314
+ ipv6: data.ipv6 ? unmarshalServerIpv6(data.ipv6) : undefined,
315
+ location: data.location ? unmarshalServerLocation(data.location) : undefined,
316
+ macAddress: data.mac_address,
317
+ maintenances: unmarshalArrayOfObject(data.maintenances, unmarshalServerMaintenance),
318
+ modificationDate: unmarshalDate(data.modification_date),
319
+ name: data.name,
320
+ organization: data.organization,
321
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined,
322
+ privateIp: data.private_ip,
323
+ privateNics: unmarshalArrayOfObject(data.private_nics, unmarshalPrivateNIC),
324
+ project: data.project,
325
+ protected: data.protected,
326
+ publicIp: data.public_ip ? unmarshalServerIp(data.public_ip) : undefined,
327
+ publicIps: unmarshalArrayOfObject(data.public_ips, unmarshalServerIp),
328
+ routedIpEnabled: data.routed_ip_enabled,
329
+ securityGroup: data.security_group ? unmarshalSecurityGroupSummary(data.security_group) : undefined,
330
+ state: data.state,
331
+ stateDetail: data.state_detail,
332
+ tags: data.tags,
333
+ volumes: unmarshalMapOfObject(data.volumes, unmarshalVolumeServer),
334
+ zone: data.zone
335
+ };
336
+ };
337
+ const unmarshalCreateServerResponse = data => {
338
+ if (!isJSONObject(data)) {
339
+ throw new TypeError(`Unmarshalling the type 'CreateServerResponse' failed as data isn't a dictionary.`);
340
+ }
341
+ return {
342
+ server: data.server ? unmarshalServer(data.server) : undefined
343
+ };
344
+ };
345
+ const unmarshalSnapshotBaseVolume = data => {
346
+ if (!isJSONObject(data)) {
347
+ throw new TypeError(`Unmarshalling the type 'SnapshotBaseVolume' failed as data isn't a dictionary.`);
348
+ }
349
+ return {
350
+ id: data.id,
351
+ name: data.name
352
+ };
353
+ };
354
+ const unmarshalSnapshot = data => {
355
+ if (!isJSONObject(data)) {
356
+ throw new TypeError(`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`);
357
+ }
358
+ return {
359
+ baseVolume: data.base_volume ? unmarshalSnapshotBaseVolume(data.base_volume) : undefined,
360
+ creationDate: unmarshalDate(data.creation_date),
361
+ errorReason: data.error_reason,
362
+ id: data.id,
363
+ modificationDate: unmarshalDate(data.modification_date),
364
+ name: data.name,
365
+ organization: data.organization,
366
+ project: data.project,
367
+ size: data.size,
368
+ state: data.state,
369
+ tags: data.tags,
370
+ volumeType: data.volume_type,
371
+ zone: data.zone
372
+ };
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
+ };
390
+ const unmarshalCreateSnapshotResponse = data => {
391
+ if (!isJSONObject(data)) {
392
+ throw new TypeError(`Unmarshalling the type 'CreateSnapshotResponse' failed as data isn't a dictionary.`);
393
+ }
394
+ return {
395
+ snapshot: data.snapshot ? unmarshalSnapshot(data.snapshot) : undefined,
396
+ task: data.task ? unmarshalTask(data.task) : undefined
397
+ };
398
+ };
399
+ const unmarshalCreateVolumeResponse = data => {
400
+ if (!isJSONObject(data)) {
401
+ throw new TypeError(`Unmarshalling the type 'CreateVolumeResponse' failed as data isn't a dictionary.`);
402
+ }
403
+ return {
404
+ volume: data.volume ? unmarshalVolume(data.volume) : undefined
405
+ };
406
+ };
407
+ const unmarshalExportSnapshotResponse = data => {
408
+ if (!isJSONObject(data)) {
409
+ throw new TypeError(`Unmarshalling the type 'ExportSnapshotResponse' failed as data isn't a dictionary.`);
410
+ }
411
+ return {
412
+ task: data.task ? unmarshalTask(data.task) : undefined
413
+ };
414
+ };
415
+ const unmarshalGetBootscriptResponse = data => {
416
+ if (!isJSONObject(data)) {
417
+ throw new TypeError(`Unmarshalling the type 'GetBootscriptResponse' failed as data isn't a dictionary.`);
418
+ }
419
+ return {
420
+ bootscript: data.bootscript ? unmarshalBootscript(data.bootscript) : undefined
421
+ };
422
+ };
423
+ const unmarshalDashboard = data => {
424
+ if (!isJSONObject(data)) {
425
+ throw new TypeError(`Unmarshalling the type 'Dashboard' failed as data isn't a dictionary.`);
426
+ }
427
+ return {
428
+ imagesCount: data.images_count,
429
+ ipsCount: data.ips_count,
430
+ ipsUnused: data.ips_unused,
431
+ placementGroupsCount: data.placement_groups_count,
432
+ privateNicsCount: data.private_nics_count,
433
+ runningServersCount: data.running_servers_count,
434
+ securityGroupsCount: data.security_groups_count,
435
+ serversByTypes: data.servers_by_types,
436
+ serversCount: data.servers_count,
437
+ snapshotsCount: data.snapshots_count,
438
+ volumesBSsdCount: data.volumes_b_ssd_count,
439
+ volumesBSsdTotalSize: data.volumes_b_ssd_total_size,
440
+ volumesCount: data.volumes_count,
441
+ volumesLSsdCount: data.volumes_l_ssd_count,
442
+ volumesLSsdTotalSize: data.volumes_l_ssd_total_size
443
+ };
444
+ };
445
+ const unmarshalGetDashboardResponse = data => {
446
+ if (!isJSONObject(data)) {
447
+ throw new TypeError(`Unmarshalling the type 'GetDashboardResponse' failed as data isn't a dictionary.`);
448
+ }
449
+ return {
450
+ dashboard: data.dashboard ? unmarshalDashboard(data.dashboard) : undefined
451
+ };
452
+ };
453
+ const unmarshalGetImageResponse = data => {
454
+ if (!isJSONObject(data)) {
455
+ throw new TypeError(`Unmarshalling the type 'GetImageResponse' failed as data isn't a dictionary.`);
456
+ }
457
+ return {
458
+ image: data.image ? unmarshalImage(data.image) : undefined
459
+ };
460
+ };
461
+ const unmarshalGetIpResponse = data => {
462
+ if (!isJSONObject(data)) {
463
+ throw new TypeError(`Unmarshalling the type 'GetIpResponse' failed as data isn't a dictionary.`);
464
+ }
465
+ return {
466
+ ip: data.ip ? unmarshalIp(data.ip) : undefined
467
+ };
468
+ };
469
+ const unmarshalGetPlacementGroupResponse = data => {
470
+ if (!isJSONObject(data)) {
471
+ throw new TypeError(`Unmarshalling the type 'GetPlacementGroupResponse' failed as data isn't a dictionary.`);
472
+ }
473
+ return {
474
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined
475
+ };
476
+ };
477
+ const unmarshalPlacementGroupServer = data => {
478
+ if (!isJSONObject(data)) {
479
+ throw new TypeError(`Unmarshalling the type 'PlacementGroupServer' failed as data isn't a dictionary.`);
480
+ }
481
+ return {
482
+ id: data.id,
483
+ name: data.name,
484
+ policyRespected: data.policy_respected
485
+ };
486
+ };
487
+ const unmarshalGetPlacementGroupServersResponse = data => {
488
+ if (!isJSONObject(data)) {
489
+ throw new TypeError(`Unmarshalling the type 'GetPlacementGroupServersResponse' failed as data isn't a dictionary.`);
490
+ }
491
+ return {
492
+ servers: unmarshalArrayOfObject(data.servers, unmarshalPlacementGroupServer)
493
+ };
494
+ };
495
+ const unmarshalGetPrivateNICResponse = data => {
496
+ if (!isJSONObject(data)) {
497
+ throw new TypeError(`Unmarshalling the type 'GetPrivateNICResponse' failed as data isn't a dictionary.`);
498
+ }
499
+ return {
500
+ privateNic: data.private_nic ? unmarshalPrivateNIC(data.private_nic) : undefined
501
+ };
502
+ };
503
+ const unmarshalGetSecurityGroupResponse = data => {
504
+ if (!isJSONObject(data)) {
505
+ throw new TypeError(`Unmarshalling the type 'GetSecurityGroupResponse' failed as data isn't a dictionary.`);
506
+ }
507
+ return {
508
+ securityGroup: data.security_group ? unmarshalSecurityGroup(data.security_group) : undefined
509
+ };
510
+ };
511
+ const unmarshalGetSecurityGroupRuleResponse = data => {
512
+ if (!isJSONObject(data)) {
513
+ throw new TypeError(`Unmarshalling the type 'GetSecurityGroupRuleResponse' failed as data isn't a dictionary.`);
514
+ }
515
+ return {
516
+ rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined
517
+ };
518
+ };
519
+ const unmarshalGetServerResponse = data => {
520
+ if (!isJSONObject(data)) {
521
+ throw new TypeError(`Unmarshalling the type 'GetServerResponse' failed as data isn't a dictionary.`);
522
+ }
523
+ return {
524
+ server: data.server ? unmarshalServer(data.server) : undefined
525
+ };
526
+ };
527
+ const unmarshalGetServerTypesAvailabilityResponseAvailability = data => {
528
+ if (!isJSONObject(data)) {
529
+ throw new TypeError(`Unmarshalling the type 'GetServerTypesAvailabilityResponseAvailability' failed as data isn't a dictionary.`);
530
+ }
531
+ return {
532
+ availability: data.availability
533
+ };
534
+ };
535
+ const unmarshalGetServerTypesAvailabilityResponse = data => {
536
+ if (!isJSONObject(data)) {
537
+ throw new TypeError(`Unmarshalling the type 'GetServerTypesAvailabilityResponse' failed as data isn't a dictionary.`);
538
+ }
539
+ return {
540
+ servers: unmarshalMapOfObject(data.servers, unmarshalGetServerTypesAvailabilityResponseAvailability),
541
+ totalCount: data.total_count
542
+ };
543
+ };
544
+ const unmarshalGetSnapshotResponse = data => {
545
+ if (!isJSONObject(data)) {
546
+ throw new TypeError(`Unmarshalling the type 'GetSnapshotResponse' failed as data isn't a dictionary.`);
547
+ }
548
+ return {
549
+ snapshot: data.snapshot ? unmarshalSnapshot(data.snapshot) : undefined
550
+ };
551
+ };
552
+ const unmarshalGetVolumeResponse = data => {
553
+ if (!isJSONObject(data)) {
554
+ throw new TypeError(`Unmarshalling the type 'GetVolumeResponse' failed as data isn't a dictionary.`);
555
+ }
556
+ return {
557
+ volume: data.volume ? unmarshalVolume(data.volume) : undefined
558
+ };
559
+ };
560
+ const unmarshalListBootscriptsResponse = data => {
561
+ if (!isJSONObject(data)) {
562
+ throw new TypeError(`Unmarshalling the type 'ListBootscriptsResponse' failed as data isn't a dictionary.`);
563
+ }
564
+ return {
565
+ bootscripts: unmarshalArrayOfObject(data.bootscripts, unmarshalBootscript),
566
+ totalCount: data.total_count
567
+ };
568
+ };
569
+ const unmarshalListImagesResponse = data => {
570
+ if (!isJSONObject(data)) {
571
+ throw new TypeError(`Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`);
572
+ }
573
+ return {
574
+ images: unmarshalArrayOfObject(data.images, unmarshalImage),
575
+ totalCount: data.total_count
576
+ };
577
+ };
578
+ const unmarshalListIpsResponse = data => {
579
+ if (!isJSONObject(data)) {
580
+ throw new TypeError(`Unmarshalling the type 'ListIpsResponse' failed as data isn't a dictionary.`);
581
+ }
582
+ return {
583
+ ips: unmarshalArrayOfObject(data.ips, unmarshalIp),
584
+ totalCount: data.total_count
585
+ };
586
+ };
587
+ const unmarshalListPlacementGroupsResponse = data => {
588
+ if (!isJSONObject(data)) {
589
+ throw new TypeError(`Unmarshalling the type 'ListPlacementGroupsResponse' failed as data isn't a dictionary.`);
590
+ }
591
+ return {
592
+ placementGroups: unmarshalArrayOfObject(data.placement_groups, unmarshalPlacementGroup),
593
+ totalCount: data.total_count
594
+ };
595
+ };
596
+ const unmarshalListPrivateNICsResponse = data => {
597
+ if (!isJSONObject(data)) {
598
+ throw new TypeError(`Unmarshalling the type 'ListPrivateNICsResponse' failed as data isn't a dictionary.`);
599
+ }
600
+ return {
601
+ privateNics: unmarshalArrayOfObject(data.private_nics, unmarshalPrivateNIC),
602
+ totalCount: data.total_count
603
+ };
604
+ };
605
+ const unmarshalListSecurityGroupRulesResponse = data => {
606
+ if (!isJSONObject(data)) {
607
+ throw new TypeError(`Unmarshalling the type 'ListSecurityGroupRulesResponse' failed as data isn't a dictionary.`);
608
+ }
609
+ return {
610
+ rules: unmarshalArrayOfObject(data.rules, unmarshalSecurityGroupRule),
611
+ totalCount: data.total_count
612
+ };
613
+ };
614
+ const unmarshalListSecurityGroupsResponse = data => {
615
+ if (!isJSONObject(data)) {
616
+ throw new TypeError(`Unmarshalling the type 'ListSecurityGroupsResponse' failed as data isn't a dictionary.`);
617
+ }
618
+ return {
619
+ securityGroups: unmarshalArrayOfObject(data.security_groups, unmarshalSecurityGroup),
620
+ totalCount: data.total_count
621
+ };
622
+ };
623
+ const unmarshalListServerActionsResponse = data => {
624
+ if (!isJSONObject(data)) {
625
+ throw new TypeError(`Unmarshalling the type 'ListServerActionsResponse' failed as data isn't a dictionary.`);
626
+ }
627
+ return {
628
+ actions: data.actions
629
+ };
630
+ };
631
+ const unmarshalListServerUserDataResponse = data => {
632
+ if (!isJSONObject(data)) {
633
+ throw new TypeError(`Unmarshalling the type 'ListServerUserDataResponse' failed as data isn't a dictionary.`);
634
+ }
635
+ return {
636
+ userData: data.user_data
637
+ };
638
+ };
639
+ const unmarshalListServersResponse = data => {
640
+ if (!isJSONObject(data)) {
641
+ throw new TypeError(`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`);
642
+ }
643
+ return {
644
+ servers: unmarshalArrayOfObject(data.servers, unmarshalServer),
645
+ totalCount: data.total_count
646
+ };
647
+ };
648
+ const unmarshalServerTypeNetworkInterface = data => {
649
+ if (!isJSONObject(data)) {
650
+ throw new TypeError(`Unmarshalling the type 'ServerTypeNetworkInterface' failed as data isn't a dictionary.`);
651
+ }
652
+ return {
653
+ internalBandwidth: data.internal_bandwidth,
654
+ internetBandwidth: data.internet_bandwidth
655
+ };
656
+ };
657
+ const unmarshalServerTypeVolumeConstraintSizes = data => {
658
+ if (!isJSONObject(data)) {
659
+ throw new TypeError(`Unmarshalling the type 'ServerTypeVolumeConstraintSizes' failed as data isn't a dictionary.`);
660
+ }
661
+ return {
662
+ maxSize: data.max_size,
663
+ minSize: data.min_size
664
+ };
665
+ };
666
+ const unmarshalServerTypeCapabilities = data => {
667
+ if (!isJSONObject(data)) {
668
+ throw new TypeError(`Unmarshalling the type 'ServerTypeCapabilities' failed as data isn't a dictionary.`);
669
+ }
670
+ return {
671
+ blockStorage: data.block_storage,
672
+ bootTypes: data.boot_types
673
+ };
674
+ };
675
+ const unmarshalServerTypeNetwork = data => {
676
+ if (!isJSONObject(data)) {
677
+ throw new TypeError(`Unmarshalling the type 'ServerTypeNetwork' failed as data isn't a dictionary.`);
678
+ }
679
+ return {
680
+ interfaces: unmarshalArrayOfObject(data.interfaces, unmarshalServerTypeNetworkInterface),
681
+ ipv6Support: data.ipv6_support,
682
+ sumInternalBandwidth: data.sum_internal_bandwidth,
683
+ sumInternetBandwidth: data.sum_internet_bandwidth
684
+ };
685
+ };
686
+ const unmarshalServerTypeVolumeConstraintsByType = data => {
687
+ if (!isJSONObject(data)) {
688
+ throw new TypeError(`Unmarshalling the type 'ServerTypeVolumeConstraintsByType' failed as data isn't a dictionary.`);
689
+ }
690
+ return {
691
+ lSsd: data.l_ssd ? unmarshalServerTypeVolumeConstraintSizes(data.l_ssd) : undefined
692
+ };
693
+ };
694
+ const unmarshalServerType = data => {
695
+ if (!isJSONObject(data)) {
696
+ throw new TypeError(`Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`);
697
+ }
698
+ return {
699
+ altNames: data.alt_names,
700
+ arch: data.arch,
701
+ baremetal: data.baremetal,
702
+ capabilities: data.capabilities ? unmarshalServerTypeCapabilities(data.capabilities) : undefined,
703
+ gpu: data.gpu,
704
+ hourlyPrice: data.hourly_price,
705
+ monthlyPrice: data.monthly_price,
706
+ ncpus: data.ncpus,
707
+ network: data.network ? unmarshalServerTypeNetwork(data.network) : undefined,
708
+ perVolumeConstraint: data.per_volume_constraint ? unmarshalServerTypeVolumeConstraintsByType(data.per_volume_constraint) : undefined,
709
+ ram: data.ram,
710
+ scratchStorageMaxSize: data.scratch_storage_max_size,
711
+ volumesConstraint: data.volumes_constraint ? unmarshalServerTypeVolumeConstraintSizes(data.volumes_constraint) : undefined
712
+ };
713
+ };
714
+ const unmarshalListServersTypesResponse = data => {
715
+ if (!isJSONObject(data)) {
716
+ throw new TypeError(`Unmarshalling the type 'ListServersTypesResponse' failed as data isn't a dictionary.`);
717
+ }
718
+ return {
719
+ servers: unmarshalMapOfObject(data.servers, unmarshalServerType),
720
+ totalCount: data.total_count
721
+ };
722
+ };
723
+ const unmarshalListSnapshotsResponse = data => {
724
+ if (!isJSONObject(data)) {
725
+ throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
726
+ }
727
+ return {
728
+ snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
729
+ totalCount: data.total_count
730
+ };
731
+ };
732
+ const unmarshalListVolumesResponse = data => {
733
+ if (!isJSONObject(data)) {
734
+ throw new TypeError(`Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`);
735
+ }
736
+ return {
737
+ totalCount: data.total_count,
738
+ volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
739
+ };
740
+ };
741
+ const unmarshalVolumeTypeCapabilities = data => {
742
+ if (!isJSONObject(data)) {
743
+ throw new TypeError(`Unmarshalling the type 'VolumeTypeCapabilities' failed as data isn't a dictionary.`);
744
+ }
745
+ return {
746
+ snapshot: data.snapshot
747
+ };
748
+ };
749
+ const unmarshalVolumeTypeConstraints = data => {
750
+ if (!isJSONObject(data)) {
751
+ throw new TypeError(`Unmarshalling the type 'VolumeTypeConstraints' failed as data isn't a dictionary.`);
752
+ }
753
+ return {
754
+ max: data.max,
755
+ min: data.min
756
+ };
757
+ };
758
+ const unmarshalVolumeType = data => {
759
+ if (!isJSONObject(data)) {
760
+ throw new TypeError(`Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`);
761
+ }
762
+ return {
763
+ capabilities: data.capabilities ? unmarshalVolumeTypeCapabilities(data.capabilities) : undefined,
764
+ constraints: data.constraints ? unmarshalVolumeTypeConstraints(data.constraints) : undefined,
765
+ displayName: data.display_name
766
+ };
767
+ };
768
+ const unmarshalListVolumesTypesResponse = data => {
769
+ if (!isJSONObject(data)) {
770
+ throw new TypeError(`Unmarshalling the type 'ListVolumesTypesResponse' failed as data isn't a dictionary.`);
771
+ }
772
+ return {
773
+ totalCount: data.total_count,
774
+ volumes: unmarshalMapOfObject(data.volumes, unmarshalVolumeType)
775
+ };
776
+ };
777
+ const unmarshalMigrationPlan = data => {
778
+ if (!isJSONObject(data)) {
779
+ throw new TypeError(`Unmarshalling the type 'MigrationPlan' failed as data isn't a dictionary.`);
780
+ }
781
+ return {
782
+ snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
783
+ validationKey: data.validation_key,
784
+ volume: data.volume ? unmarshalVolume(data.volume) : undefined
785
+ };
786
+ };
787
+ const unmarshalServerActionResponse = data => {
788
+ if (!isJSONObject(data)) {
789
+ throw new TypeError(`Unmarshalling the type 'ServerActionResponse' failed as data isn't a dictionary.`);
790
+ }
791
+ return {
792
+ task: data.task ? unmarshalTask(data.task) : undefined
793
+ };
794
+ };
795
+ const unmarshalSetImageResponse = data => {
796
+ if (!isJSONObject(data)) {
797
+ throw new TypeError(`Unmarshalling the type 'SetImageResponse' failed as data isn't a dictionary.`);
798
+ }
799
+ return {
800
+ image: data.image ? unmarshalImage(data.image) : undefined
801
+ };
802
+ };
803
+ const unmarshalSetPlacementGroupResponse = data => {
804
+ if (!isJSONObject(data)) {
805
+ throw new TypeError(`Unmarshalling the type 'SetPlacementGroupResponse' failed as data isn't a dictionary.`);
806
+ }
807
+ return {
808
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined
809
+ };
810
+ };
811
+ const unmarshalSetPlacementGroupServersResponse = data => {
812
+ if (!isJSONObject(data)) {
813
+ throw new TypeError(`Unmarshalling the type 'SetPlacementGroupServersResponse' failed as data isn't a dictionary.`);
814
+ }
815
+ return {
816
+ servers: unmarshalArrayOfObject(data.servers, unmarshalPlacementGroupServer)
817
+ };
818
+ };
819
+ const unmarshalSetSecurityGroupResponse = data => {
820
+ if (!isJSONObject(data)) {
821
+ throw new TypeError(`Unmarshalling the type 'SetSecurityGroupResponse' failed as data isn't a dictionary.`);
822
+ }
823
+ return {
824
+ securityGroup: data.security_group ? unmarshalSecurityGroup(data.security_group) : undefined
825
+ };
826
+ };
827
+ const unmarshalSetSecurityGroupRuleResponse = data => {
828
+ if (!isJSONObject(data)) {
829
+ throw new TypeError(`Unmarshalling the type 'SetSecurityGroupRuleResponse' failed as data isn't a dictionary.`);
830
+ }
831
+ return {
832
+ rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined
833
+ };
834
+ };
835
+ const unmarshalSetSecurityGroupRulesResponse = data => {
836
+ if (!isJSONObject(data)) {
837
+ throw new TypeError(`Unmarshalling the type 'SetSecurityGroupRulesResponse' failed as data isn't a dictionary.`);
838
+ }
839
+ return {
840
+ rules: unmarshalArrayOfObject(data.rules, unmarshalSecurityGroupRule)
841
+ };
842
+ };
843
+ const unmarshalSetServerResponse = data => {
844
+ if (!isJSONObject(data)) {
845
+ throw new TypeError(`Unmarshalling the type 'SetServerResponse' failed as data isn't a dictionary.`);
846
+ }
847
+ return {
848
+ server: data.server ? unmarshalServer(data.server) : undefined
849
+ };
850
+ };
851
+ const unmarshalSetSnapshotResponse = data => {
852
+ if (!isJSONObject(data)) {
853
+ throw new TypeError(`Unmarshalling the type 'SetSnapshotResponse' failed as data isn't a dictionary.`);
854
+ }
855
+ return {
856
+ snapshot: data.snapshot ? unmarshalSnapshot(data.snapshot) : undefined
857
+ };
858
+ };
859
+ const unmarshalUpdateIpResponse = data => {
860
+ if (!isJSONObject(data)) {
861
+ throw new TypeError(`Unmarshalling the type 'UpdateIpResponse' failed as data isn't a dictionary.`);
862
+ }
863
+ return {
864
+ ip: data.ip ? unmarshalIp(data.ip) : undefined
865
+ };
866
+ };
867
+ const unmarshalUpdatePlacementGroupResponse = data => {
868
+ if (!isJSONObject(data)) {
869
+ throw new TypeError(`Unmarshalling the type 'UpdatePlacementGroupResponse' failed as data isn't a dictionary.`);
870
+ }
871
+ return {
872
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined
873
+ };
874
+ };
875
+ const unmarshalUpdatePlacementGroupServersResponse = data => {
876
+ if (!isJSONObject(data)) {
877
+ throw new TypeError(`Unmarshalling the type 'UpdatePlacementGroupServersResponse' failed as data isn't a dictionary.`);
878
+ }
879
+ return {
880
+ servers: unmarshalArrayOfObject(data.servers, unmarshalPlacementGroupServer)
881
+ };
882
+ };
883
+ const unmarshalUpdateServerResponse = data => {
884
+ if (!isJSONObject(data)) {
885
+ throw new TypeError(`Unmarshalling the type 'UpdateServerResponse' failed as data isn't a dictionary.`);
886
+ }
887
+ return {
888
+ server: data.server ? unmarshalServer(data.server) : undefined
889
+ };
890
+ };
891
+ const unmarshalUpdateVolumeResponse = data => {
892
+ if (!isJSONObject(data)) {
893
+ throw new TypeError(`Unmarshalling the type 'UpdateVolumeResponse' failed as data isn't a dictionary.`);
894
+ }
895
+ return {
896
+ volume: data.volume ? unmarshalVolume(data.volume) : undefined
897
+ };
898
+ };
899
+ const marshalApplyBlockMigrationRequest = (request, defaults) => ({
900
+ validation_key: request.validationKey,
901
+ ...resolveOneOf([{
902
+ param: 'volume_id',
903
+ value: request.volumeId
904
+ }, {
905
+ param: 'snapshot_id',
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
918
+ }, {
919
+ default: defaults.defaultProjectId,
920
+ param: 'project',
921
+ value: request.project
922
+ }])
923
+ });
924
+ const marshalCreateImageRequest = (request, defaults) => ({
925
+ arch: request.arch,
926
+ default_bootscript: request.defaultBootscript,
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,
934
+ name: request.name || randomName('img'),
935
+ public: request.public,
936
+ root_volume: request.rootVolume,
937
+ tags: request.tags,
938
+ ...resolveOneOf([{
939
+ default: defaults.defaultOrganizationId,
940
+ param: 'organization',
941
+ value: request.organization
942
+ }, {
943
+ default: defaults.defaultProjectId,
944
+ param: 'project',
945
+ value: request.project
946
+ }])
947
+ });
948
+ const marshalCreateIpRequest = (request, defaults) => ({
949
+ server: request.server,
950
+ tags: request.tags,
951
+ type: request.type,
952
+ ...resolveOneOf([{
953
+ default: defaults.defaultOrganizationId,
954
+ param: 'organization',
955
+ value: request.organization
956
+ }, {
957
+ default: defaults.defaultProjectId,
958
+ param: 'project',
959
+ value: request.project
960
+ }])
961
+ });
962
+ const marshalCreatePlacementGroupRequest = (request, defaults) => ({
963
+ name: request.name || randomName('pg'),
964
+ policy_mode: request.policyMode,
965
+ policy_type: request.policyType,
966
+ tags: request.tags,
967
+ ...resolveOneOf([{
968
+ default: defaults.defaultOrganizationId,
969
+ param: 'organization',
970
+ value: request.organization
971
+ }, {
972
+ default: defaults.defaultProjectId,
973
+ param: 'project',
974
+ value: request.project
975
+ }])
976
+ });
977
+ const marshalCreatePrivateNICRequest = (request, defaults) => ({
978
+ ip_ids: request.ipIds,
979
+ private_network_id: request.privateNetworkId,
980
+ tags: request.tags
981
+ });
982
+ const marshalCreateSecurityGroupRequest = (request, defaults) => ({
983
+ description: request.description,
984
+ enable_default_security: request.enableDefaultSecurity,
985
+ inbound_default_policy: request.inboundDefaultPolicy,
986
+ name: request.name || randomName('sg'),
987
+ outbound_default_policy: request.outboundDefaultPolicy,
988
+ stateful: request.stateful,
989
+ tags: request.tags,
990
+ ...resolveOneOf([{
991
+ default: defaults.defaultOrganizationId,
992
+ param: 'organization',
993
+ value: request.organization
994
+ }, {
995
+ default: defaults.defaultProjectId,
996
+ param: 'project',
997
+ value: request.project
998
+ }]),
999
+ ...resolveOneOf([{
1000
+ param: 'organization_default',
1001
+ value: request.organizationDefault
1002
+ }, {
1003
+ param: 'project_default',
1004
+ value: request.projectDefault
1005
+ }])
1006
+ });
1007
+ const marshalCreateSecurityGroupRuleRequest = (request, defaults) => ({
1008
+ action: request.action,
1009
+ dest_port_from: request.destPortFrom,
1010
+ dest_port_to: request.destPortTo,
1011
+ direction: request.direction,
1012
+ editable: request.editable,
1013
+ ip_range: request.ipRange,
1014
+ position: request.position,
1015
+ protocol: request.protocol
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
+ });
1027
+ const marshalCreateServerRequest = (request, defaults) => ({
1028
+ boot_type: request.bootType,
1029
+ bootscript: request.bootscript,
1030
+ commercial_type: request.commercialType,
1031
+ dynamic_ip_required: request.dynamicIpRequired,
1032
+ enable_ipv6: request.enableIpv6,
1033
+ image: request.image,
1034
+ name: request.name || randomName('srv'),
1035
+ placement_group: request.placementGroup,
1036
+ public_ip: request.publicIp,
1037
+ public_ips: request.publicIps,
1038
+ routed_ip_enabled: request.routedIpEnabled,
1039
+ security_group: request.securityGroup,
1040
+ tags: request.tags,
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,
1048
+ ...resolveOneOf([{
1049
+ default: defaults.defaultOrganizationId,
1050
+ param: 'organization',
1051
+ value: request.organization
1052
+ }, {
1053
+ default: defaults.defaultProjectId,
1054
+ param: 'project',
1055
+ value: request.project
1056
+ }])
1057
+ });
1058
+ const marshalCreateSnapshotRequest = (request, defaults) => ({
1059
+ bucket: request.bucket,
1060
+ key: request.key,
1061
+ name: request.name || randomName('snp'),
1062
+ size: request.size,
1063
+ tags: request.tags,
1064
+ volume_id: request.volumeId,
1065
+ volume_type: request.volumeType,
1066
+ ...resolveOneOf([{
1067
+ default: defaults.defaultOrganizationId,
1068
+ param: 'organization',
1069
+ value: request.organization
1070
+ }, {
1071
+ default: defaults.defaultProjectId,
1072
+ param: 'project',
1073
+ value: request.project
1074
+ }])
1075
+ });
1076
+ const marshalCreateVolumeRequest = (request, defaults) => ({
1077
+ name: request.name || randomName('vol'),
1078
+ tags: request.tags,
1079
+ volume_type: request.volumeType,
1080
+ ...resolveOneOf([{
1081
+ default: defaults.defaultOrganizationId,
1082
+ param: 'organization',
1083
+ value: request.organization
1084
+ }, {
1085
+ default: defaults.defaultProjectId,
1086
+ param: 'project',
1087
+ value: request.project
1088
+ }]),
1089
+ ...resolveOneOf([{
1090
+ param: 'size',
1091
+ value: request.size
1092
+ }, {
1093
+ param: 'base_volume',
1094
+ value: request.baseVolume
1095
+ }, {
1096
+ param: 'base_snapshot',
1097
+ value: request.baseSnapshot
1098
+ }])
1099
+ });
1100
+ const marshalExportSnapshotRequest = (request, defaults) => ({
1101
+ bucket: request.bucket,
1102
+ key: request.key
1103
+ });
1104
+ const marshalPlanBlockMigrationRequest = (request, defaults) => ({
1105
+ ...resolveOneOf([{
1106
+ param: 'volume_id',
1107
+ value: request.volumeId
1108
+ }, {
1109
+ param: 'snapshot_id',
1110
+ value: request.snapshotId
1111
+ }])
1112
+ });
1113
+ const marshalServerActionRequestVolumeBackupTemplate = (request, defaults) => ({
1114
+ volume_type: request.volumeType
1115
+ });
1116
+ const marshalServerActionRequest = (request, defaults) => ({
1117
+ action: request.action,
1118
+ name: request.name,
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
1165
+ });
1166
+ const marshalSetImageRequest = (request, defaults) => ({
1167
+ arch: request.arch,
1168
+ creation_date: request.creationDate,
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,
1177
+ from_server: request.fromServer,
1178
+ modification_date: request.modificationDate,
1179
+ name: request.name,
1180
+ organization: request.organization ?? defaults.defaultOrganizationId,
1181
+ project: request.project ?? defaults.defaultProjectId,
1182
+ public: request.public,
1183
+ root_volume: request.rootVolume !== undefined ? marshalVolumeSummary(request.rootVolume) : undefined,
1184
+ state: request.state,
1185
+ tags: request.tags
1186
+ });
1187
+ const marshalSetPlacementGroupRequest = (request, defaults) => ({
1188
+ name: request.name,
1189
+ organization: request.organization ?? defaults.defaultOrganizationId,
1190
+ policy_mode: request.policyMode,
1191
+ policy_type: request.policyType,
1192
+ project: request.project ?? defaults.defaultProjectId,
1193
+ tags: request.tags
1194
+ });
1195
+ const marshalSetPlacementGroupServersRequest = (request, defaults) => ({
1196
+ servers: request.servers
1197
+ });
1198
+ const marshalSetSecurityGroupRequest = (request, defaults) => ({
1199
+ creation_date: request.creationDate,
1200
+ description: request.description,
1201
+ enable_default_security: request.enableDefaultSecurity,
1202
+ inbound_default_policy: request.inboundDefaultPolicy,
1203
+ modification_date: request.modificationDate,
1204
+ name: request.name,
1205
+ organization: request.organization ?? defaults.defaultOrganizationId,
1206
+ organization_default: request.organizationDefault,
1207
+ outbound_default_policy: request.outboundDefaultPolicy,
1208
+ project: request.project ?? defaults.defaultProjectId,
1209
+ project_default: request.projectDefault,
1210
+ servers: request.servers !== undefined ? request.servers.map(elt => marshalServerSummary(elt)) : undefined,
1211
+ stateful: request.stateful,
1212
+ tags: request.tags
1213
+ });
1214
+ const marshalSetSecurityGroupRuleRequest = (request, defaults) => ({
1215
+ action: request.action,
1216
+ dest_port_from: request.destPortFrom,
1217
+ dest_port_to: request.destPortTo,
1218
+ direction: request.direction,
1219
+ editable: request.editable,
1220
+ id: request.id,
1221
+ ip_range: request.ipRange,
1222
+ position: request.position,
1223
+ protocol: request.protocol
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
+ });
1237
+ const marshalSetSecurityGroupRulesRequest = (request, defaults) => ({
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
1310
+ });
1311
+ const marshalSetServerRequest = (request, defaults) => ({
1312
+ allowed_actions: request.allowedActions !== undefined ? request.allowedActions : undefined,
1313
+ arch: request.arch,
1314
+ boot_type: request.bootType,
1315
+ bootscript: request.bootscript !== undefined ? marshalBootscript(request.bootscript) : undefined,
1316
+ commercial_type: request.commercialType,
1317
+ creation_date: request.creationDate,
1318
+ dynamic_ip_required: request.dynamicIpRequired,
1319
+ enable_ipv6: request.enableIpv6,
1320
+ hostname: request.hostname,
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,
1325
+ modification_date: request.modificationDate,
1326
+ name: request.name,
1327
+ organization: request.organization ?? defaults.defaultOrganizationId,
1328
+ placement_group: request.placementGroup !== undefined ? marshalPlacementGroup(request.placementGroup) : undefined,
1329
+ private_ip: request.privateIp,
1330
+ private_nics: request.privateNics !== undefined ? request.privateNics.map(elt => marshalPrivateNIC(elt)) : undefined,
1331
+ project: request.project ?? defaults.defaultProjectId,
1332
+ protected: request.protected,
1333
+ public_ip: request.publicIp !== undefined ? marshalServerIp(request.publicIp) : undefined,
1334
+ public_ips: request.publicIps !== undefined ? request.publicIps.map(elt => marshalServerIp(elt)) : undefined,
1335
+ routed_ip_enabled: request.routedIpEnabled,
1336
+ security_group: request.securityGroup !== undefined ? marshalSecurityGroupSummary(request.securityGroup) : undefined,
1337
+ state: request.state,
1338
+ state_detail: request.stateDetail,
1339
+ tags: request.tags,
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
1351
+ });
1352
+ const marshalSetSnapshotRequest = (request, defaults) => ({
1353
+ base_volume: request.baseVolume !== undefined ? marshalSnapshotBaseVolume(request.baseVolume) : undefined,
1354
+ creation_date: request.creationDate,
1355
+ id: request.id,
1356
+ modification_date: request.modificationDate,
1357
+ name: request.name,
1358
+ organization: request.organization ?? defaults.defaultOrganizationId,
1359
+ project: request.project ?? defaults.defaultProjectId,
1360
+ size: request.size,
1361
+ state: request.state,
1362
+ tags: request.tags,
1363
+ volume_type: request.volumeType
1364
+ });
1365
+ const marshalUpdateIpRequest = (request, defaults) => ({
1366
+ reverse: request.reverse,
1367
+ server: request.server,
1368
+ tags: request.tags,
1369
+ type: request.type
1370
+ });
1371
+ const marshalUpdatePlacementGroupRequest = (request, defaults) => ({
1372
+ name: request.name,
1373
+ policy_mode: request.policyMode,
1374
+ policy_type: request.policyType,
1375
+ tags: request.tags
1376
+ });
1377
+ const marshalUpdatePlacementGroupServersRequest = (request, defaults) => ({
1378
+ servers: request.servers
1379
+ });
1380
+ const marshalUpdatePrivateNICRequest = (request, defaults) => ({
1381
+ tags: request.tags
1382
+ });
1383
+ const marshalSecurityGroupTemplate = (request, defaults) => ({
1384
+ id: request.id,
1385
+ name: request.name
1386
+ });
1387
+ const marshalUpdateServerRequest = (request, defaults) => ({
1388
+ boot_type: request.bootType,
1389
+ bootscript: request.bootscript,
1390
+ commercial_type: request.commercialType,
1391
+ dynamic_ip_required: request.dynamicIpRequired,
1392
+ enable_ipv6: request.enableIpv6,
1393
+ name: request.name,
1394
+ placement_group: request.placementGroup,
1395
+ private_nics: request.privateNics,
1396
+ protected: request.protected,
1397
+ public_ips: request.publicIps,
1398
+ routed_ip_enabled: request.routedIpEnabled,
1399
+ security_group: request.securityGroup !== undefined ? marshalSecurityGroupTemplate(request.securityGroup) : undefined,
1400
+ tags: request.tags,
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
1408
+ });
1409
+ const marshalUpdateVolumeRequest = (request, defaults) => ({
1410
+ name: request.name,
1411
+ size: request.size,
1412
+ tags: request.tags
1413
+ });
1414
+
1415
+ export { marshalApplyBlockMigrationRequest, marshalCreateImageRequest, marshalCreateIpRequest, marshalCreatePlacementGroupRequest, marshalCreatePrivateNICRequest, marshalCreateSecurityGroupRequest, marshalCreateSecurityGroupRuleRequest, marshalCreateServerRequest, marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalExportSnapshotRequest, marshalPlanBlockMigrationRequest, marshalServerActionRequest, marshalSetImageRequest, marshalSetPlacementGroupRequest, marshalSetPlacementGroupServersRequest, marshalSetSecurityGroupRequest, marshalSetSecurityGroupRuleRequest, marshalSetSecurityGroupRulesRequest, marshalSetServerRequest, marshalSetSnapshotRequest, marshalUpdateIpRequest, marshalUpdatePlacementGroupRequest, marshalUpdatePlacementGroupServersRequest, marshalUpdatePrivateNICRequest, marshalUpdateServerRequest, marshalUpdateVolumeRequest, unmarshalCreateImageResponse, unmarshalCreateIpResponse, unmarshalCreatePlacementGroupResponse, unmarshalCreatePrivateNICResponse, unmarshalCreateSecurityGroupResponse, unmarshalCreateSecurityGroupRuleResponse, unmarshalCreateServerResponse, unmarshalCreateSnapshotResponse, unmarshalCreateVolumeResponse, unmarshalExportSnapshotResponse, unmarshalGetBootscriptResponse, unmarshalGetDashboardResponse, unmarshalGetImageResponse, unmarshalGetIpResponse, unmarshalGetPlacementGroupResponse, unmarshalGetPlacementGroupServersResponse, unmarshalGetPrivateNICResponse, unmarshalGetSecurityGroupResponse, unmarshalGetSecurityGroupRuleResponse, unmarshalGetServerResponse, unmarshalGetServerTypesAvailabilityResponse, unmarshalGetSnapshotResponse, unmarshalGetVolumeResponse, unmarshalListBootscriptsResponse, unmarshalListImagesResponse, unmarshalListIpsResponse, unmarshalListPlacementGroupsResponse, unmarshalListPrivateNICsResponse, unmarshalListSecurityGroupRulesResponse, unmarshalListSecurityGroupsResponse, unmarshalListServerActionsResponse, unmarshalListServerUserDataResponse, unmarshalListServersResponse, unmarshalListServersTypesResponse, unmarshalListSnapshotsResponse, unmarshalListVolumesResponse, unmarshalListVolumesTypesResponse, unmarshalMigrationPlan, unmarshalPrivateNIC, unmarshalServerActionResponse, unmarshalSetImageResponse, unmarshalSetPlacementGroupResponse, unmarshalSetPlacementGroupServersResponse, unmarshalSetSecurityGroupResponse, unmarshalSetSecurityGroupRuleResponse, unmarshalSetSecurityGroupRulesResponse, unmarshalSetServerResponse, unmarshalSetSnapshotResponse, unmarshalUpdateIpResponse, unmarshalUpdatePlacementGroupResponse, unmarshalUpdatePlacementGroupServersResponse, unmarshalUpdateServerResponse, unmarshalUpdateVolumeResponse };