@scaleway/sdk 3.0.0-alpha.0 → 3.1.1

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