@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,5 @@
1
+ export { BaremetalV1UtilsAPI as API } from './api.utils.js';
2
+ export { PrivateNetworkAPI } from './api.gen.js';
3
+ export { SERVER_INSTALL_TRANSIENT_STATUSES, SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES, SERVER_TRANSIENT_STATUSES } from './content.gen.js';
4
+ import * as validationRules_gen from './validation-rules.gen.js';
5
+ export { validationRules_gen as ValidationRules };
@@ -0,0 +1,406 @@
1
+ import { isJSONObject } from '../../../helpers/json.js';
2
+ import { unmarshalMoney, unmarshalTimeSeries } from '../../../scw/custom-marshalling.js';
3
+ import { unmarshalDate, 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 unmarshalIP = data => {
8
+ if (!isJSONObject(data)) {
9
+ throw new TypeError(`Unmarshalling the type 'IP' failed as data isn't a dictionary.`);
10
+ }
11
+ return {
12
+ address: data.address,
13
+ id: data.id,
14
+ reverse: data.reverse,
15
+ reverseStatus: data.reverse_status,
16
+ reverseStatusMessage: data.reverse_status_message,
17
+ version: data.version
18
+ };
19
+ };
20
+ const unmarshalOSOSField = data => {
21
+ if (!isJSONObject(data)) {
22
+ throw new TypeError(`Unmarshalling the type 'OSOSField' failed as data isn't a dictionary.`);
23
+ }
24
+ return {
25
+ defaultValue: data.default_value,
26
+ editable: data.editable,
27
+ required: data.required
28
+ };
29
+ };
30
+ const unmarshalOS = data => {
31
+ if (!isJSONObject(data)) {
32
+ throw new TypeError(`Unmarshalling the type 'OS' failed as data isn't a dictionary.`);
33
+ }
34
+ return {
35
+ allowed: data.allowed,
36
+ enabled: data.enabled,
37
+ id: data.id,
38
+ licenseRequired: data.license_required,
39
+ logoUrl: data.logo_url,
40
+ name: data.name,
41
+ password: data.password ? unmarshalOSOSField(data.password) : undefined,
42
+ servicePassword: data.service_password ? unmarshalOSOSField(data.service_password) : undefined,
43
+ serviceUser: data.service_user ? unmarshalOSOSField(data.service_user) : undefined,
44
+ ssh: data.ssh ? unmarshalOSOSField(data.ssh) : undefined,
45
+ user: data.user ? unmarshalOSOSField(data.user) : undefined,
46
+ version: data.version
47
+ };
48
+ };
49
+ const unmarshalCPU = data => {
50
+ if (!isJSONObject(data)) {
51
+ throw new TypeError(`Unmarshalling the type 'CPU' failed as data isn't a dictionary.`);
52
+ }
53
+ return {
54
+ benchmark: data.benchmark,
55
+ coreCount: data.core_count,
56
+ frequency: data.frequency,
57
+ name: data.name,
58
+ threadCount: data.thread_count
59
+ };
60
+ };
61
+ const unmarshalDisk = data => {
62
+ if (!isJSONObject(data)) {
63
+ throw new TypeError(`Unmarshalling the type 'Disk' failed as data isn't a dictionary.`);
64
+ }
65
+ return {
66
+ capacity: data.capacity,
67
+ type: data.type
68
+ };
69
+ };
70
+ const unmarshalMemory = data => {
71
+ if (!isJSONObject(data)) {
72
+ throw new TypeError(`Unmarshalling the type 'Memory' failed as data isn't a dictionary.`);
73
+ }
74
+ return {
75
+ capacity: data.capacity,
76
+ frequency: data.frequency,
77
+ isEcc: data.is_ecc,
78
+ type: data.type
79
+ };
80
+ };
81
+ const unmarshalOfferOptionOffer = data => {
82
+ if (!isJSONObject(data)) {
83
+ throw new TypeError(`Unmarshalling the type 'OfferOptionOffer' failed as data isn't a dictionary.`);
84
+ }
85
+ return {
86
+ enabled: data.enabled,
87
+ id: data.id,
88
+ manageable: data.manageable,
89
+ name: data.name,
90
+ osId: data.os_id,
91
+ price: data.price ? unmarshalMoney(data.price) : undefined,
92
+ subscriptionPeriod: data.subscription_period
93
+ };
94
+ };
95
+ const unmarshalPersistentMemory = data => {
96
+ if (!isJSONObject(data)) {
97
+ throw new TypeError(`Unmarshalling the type 'PersistentMemory' failed as data isn't a dictionary.`);
98
+ }
99
+ return {
100
+ capacity: data.capacity,
101
+ frequency: data.frequency,
102
+ type: data.type
103
+ };
104
+ };
105
+ const unmarshalRaidController = data => {
106
+ if (!isJSONObject(data)) {
107
+ throw new TypeError(`Unmarshalling the type 'RaidController' failed as data isn't a dictionary.`);
108
+ }
109
+ return {
110
+ model: data.model,
111
+ raidLevel: data.raid_level
112
+ };
113
+ };
114
+ const unmarshalOffer = data => {
115
+ if (!isJSONObject(data)) {
116
+ throw new TypeError(`Unmarshalling the type 'Offer' failed as data isn't a dictionary.`);
117
+ }
118
+ return {
119
+ bandwidth: data.bandwidth,
120
+ commercialRange: data.commercial_range,
121
+ cpus: unmarshalArrayOfObject(data.cpus, unmarshalCPU),
122
+ disks: unmarshalArrayOfObject(data.disks, unmarshalDisk),
123
+ enable: data.enable,
124
+ fee: data.fee ? unmarshalMoney(data.fee) : undefined,
125
+ id: data.id,
126
+ incompatibleOsIds: data.incompatible_os_ids,
127
+ memories: unmarshalArrayOfObject(data.memories, unmarshalMemory),
128
+ name: data.name,
129
+ operationPath: data.operation_path,
130
+ options: unmarshalArrayOfObject(data.options, unmarshalOfferOptionOffer),
131
+ persistentMemories: unmarshalArrayOfObject(data.persistent_memories, unmarshalPersistentMemory),
132
+ pricePerHour: data.price_per_hour ? unmarshalMoney(data.price_per_hour) : undefined,
133
+ pricePerMonth: data.price_per_month ? unmarshalMoney(data.price_per_month) : undefined,
134
+ privateBandwidth: data.private_bandwidth,
135
+ quotaName: data.quota_name,
136
+ raidControllers: unmarshalArrayOfObject(data.raid_controllers, unmarshalRaidController),
137
+ sharedBandwidth: data.shared_bandwidth,
138
+ stock: data.stock,
139
+ subscriptionPeriod: data.subscription_period,
140
+ tags: data.tags
141
+ };
142
+ };
143
+ const unmarshalOption = data => {
144
+ if (!isJSONObject(data)) {
145
+ throw new TypeError(`Unmarshalling the type 'Option' failed as data isn't a dictionary.`);
146
+ }
147
+ return {
148
+ id: data.id,
149
+ manageable: data.manageable,
150
+ name: data.name
151
+ };
152
+ };
153
+ const unmarshalServerPrivateNetwork = data => {
154
+ if (!isJSONObject(data)) {
155
+ throw new TypeError(`Unmarshalling the type 'ServerPrivateNetwork' failed as data isn't a dictionary.`);
156
+ }
157
+ return {
158
+ createdAt: unmarshalDate(data.created_at),
159
+ id: data.id,
160
+ privateNetworkId: data.private_network_id,
161
+ projectId: data.project_id,
162
+ serverId: data.server_id,
163
+ status: data.status,
164
+ updatedAt: unmarshalDate(data.updated_at),
165
+ vlan: data.vlan
166
+ };
167
+ };
168
+ const unmarshalServerInstall = data => {
169
+ if (!isJSONObject(data)) {
170
+ throw new TypeError(`Unmarshalling the type 'ServerInstall' failed as data isn't a dictionary.`);
171
+ }
172
+ return {
173
+ hostname: data.hostname,
174
+ osId: data.os_id,
175
+ serviceUrl: data.service_url,
176
+ serviceUser: data.service_user,
177
+ sshKeyIds: data.ssh_key_ids,
178
+ status: data.status,
179
+ user: data.user
180
+ };
181
+ };
182
+ const unmarshalServerOption = data => {
183
+ if (!isJSONObject(data)) {
184
+ throw new TypeError(`Unmarshalling the type 'ServerOption' failed as data isn't a dictionary.`);
185
+ }
186
+ return {
187
+ expiresAt: unmarshalDate(data.expires_at),
188
+ id: data.id,
189
+ manageable: data.manageable,
190
+ name: data.name,
191
+ status: data.status
192
+ };
193
+ };
194
+ const unmarshalServerRescueServer = data => {
195
+ if (!isJSONObject(data)) {
196
+ throw new TypeError(`Unmarshalling the type 'ServerRescueServer' failed as data isn't a dictionary.`);
197
+ }
198
+ return {
199
+ password: data.password,
200
+ user: data.user
201
+ };
202
+ };
203
+ const unmarshalServer = data => {
204
+ if (!isJSONObject(data)) {
205
+ throw new TypeError(`Unmarshalling the type 'Server' failed as data isn't a dictionary.`);
206
+ }
207
+ return {
208
+ bootType: data.boot_type,
209
+ createdAt: unmarshalDate(data.created_at),
210
+ description: data.description,
211
+ domain: data.domain,
212
+ id: data.id,
213
+ install: data.install ? unmarshalServerInstall(data.install) : undefined,
214
+ ips: unmarshalArrayOfObject(data.ips, unmarshalIP),
215
+ name: data.name,
216
+ offerId: data.offer_id,
217
+ offerName: data.offer_name,
218
+ options: unmarshalArrayOfObject(data.options, unmarshalServerOption),
219
+ organizationId: data.organization_id,
220
+ pingStatus: data.ping_status,
221
+ projectId: data.project_id,
222
+ rescueServer: data.rescue_server ? unmarshalServerRescueServer(data.rescue_server) : undefined,
223
+ status: data.status,
224
+ tags: data.tags,
225
+ updatedAt: unmarshalDate(data.updated_at),
226
+ zone: data.zone
227
+ };
228
+ };
229
+ const unmarshalSetting = data => {
230
+ if (!isJSONObject(data)) {
231
+ throw new TypeError(`Unmarshalling the type 'Setting' failed as data isn't a dictionary.`);
232
+ }
233
+ return {
234
+ enabled: data.enabled,
235
+ id: data.id,
236
+ projectId: data.project_id,
237
+ type: data.type
238
+ };
239
+ };
240
+ const unmarshalBMCAccess = data => {
241
+ if (!isJSONObject(data)) {
242
+ throw new TypeError(`Unmarshalling the type 'BMCAccess' failed as data isn't a dictionary.`);
243
+ }
244
+ return {
245
+ expiresAt: unmarshalDate(data.expires_at),
246
+ login: data.login,
247
+ password: data.password,
248
+ url: data.url
249
+ };
250
+ };
251
+ const unmarshalGetServerMetricsResponse = data => {
252
+ if (!isJSONObject(data)) {
253
+ throw new TypeError(`Unmarshalling the type 'GetServerMetricsResponse' failed as data isn't a dictionary.`);
254
+ }
255
+ return {
256
+ pings: data.pings ? unmarshalTimeSeries(data.pings) : undefined
257
+ };
258
+ };
259
+ const unmarshalListOSResponse = data => {
260
+ if (!isJSONObject(data)) {
261
+ throw new TypeError(`Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`);
262
+ }
263
+ return {
264
+ os: unmarshalArrayOfObject(data.os, unmarshalOS),
265
+ totalCount: data.total_count
266
+ };
267
+ };
268
+ const unmarshalListOffersResponse = data => {
269
+ if (!isJSONObject(data)) {
270
+ throw new TypeError(`Unmarshalling the type 'ListOffersResponse' failed as data isn't a dictionary.`);
271
+ }
272
+ return {
273
+ offers: unmarshalArrayOfObject(data.offers, unmarshalOffer),
274
+ totalCount: data.total_count
275
+ };
276
+ };
277
+ const unmarshalListOptionsResponse = data => {
278
+ if (!isJSONObject(data)) {
279
+ throw new TypeError(`Unmarshalling the type 'ListOptionsResponse' failed as data isn't a dictionary.`);
280
+ }
281
+ return {
282
+ options: unmarshalArrayOfObject(data.options, unmarshalOption),
283
+ totalCount: data.total_count
284
+ };
285
+ };
286
+ const unmarshalServerEvent = data => {
287
+ if (!isJSONObject(data)) {
288
+ throw new TypeError(`Unmarshalling the type 'ServerEvent' failed as data isn't a dictionary.`);
289
+ }
290
+ return {
291
+ action: data.action,
292
+ createdAt: unmarshalDate(data.created_at),
293
+ id: data.id,
294
+ updatedAt: unmarshalDate(data.updated_at)
295
+ };
296
+ };
297
+ const unmarshalListServerEventsResponse = data => {
298
+ if (!isJSONObject(data)) {
299
+ throw new TypeError(`Unmarshalling the type 'ListServerEventsResponse' failed as data isn't a dictionary.`);
300
+ }
301
+ return {
302
+ events: unmarshalArrayOfObject(data.events, unmarshalServerEvent),
303
+ totalCount: data.total_count
304
+ };
305
+ };
306
+ const unmarshalListServerPrivateNetworksResponse = data => {
307
+ if (!isJSONObject(data)) {
308
+ throw new TypeError(`Unmarshalling the type 'ListServerPrivateNetworksResponse' failed as data isn't a dictionary.`);
309
+ }
310
+ return {
311
+ serverPrivateNetworks: unmarshalArrayOfObject(data.server_private_networks, unmarshalServerPrivateNetwork),
312
+ totalCount: data.total_count
313
+ };
314
+ };
315
+ const unmarshalListServersResponse = data => {
316
+ if (!isJSONObject(data)) {
317
+ throw new TypeError(`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`);
318
+ }
319
+ return {
320
+ servers: unmarshalArrayOfObject(data.servers, unmarshalServer),
321
+ totalCount: data.total_count
322
+ };
323
+ };
324
+ const unmarshalListSettingsResponse = data => {
325
+ if (!isJSONObject(data)) {
326
+ throw new TypeError(`Unmarshalling the type 'ListSettingsResponse' failed as data isn't a dictionary.`);
327
+ }
328
+ return {
329
+ settings: unmarshalArrayOfObject(data.settings, unmarshalSetting),
330
+ totalCount: data.total_count
331
+ };
332
+ };
333
+ const unmarshalSetServerPrivateNetworksResponse = data => {
334
+ if (!isJSONObject(data)) {
335
+ throw new TypeError(`Unmarshalling the type 'SetServerPrivateNetworksResponse' failed as data isn't a dictionary.`);
336
+ }
337
+ return {
338
+ serverPrivateNetworks: unmarshalArrayOfObject(data.server_private_networks, unmarshalServerPrivateNetwork)
339
+ };
340
+ };
341
+ const marshalAddOptionServerRequest = (request, defaults) => ({
342
+ expires_at: request.expiresAt
343
+ });
344
+ const marshalCreateServerRequestInstall = (request, defaults) => ({
345
+ hostname: request.hostname,
346
+ os_id: request.osId,
347
+ password: request.password,
348
+ service_password: request.servicePassword,
349
+ service_user: request.serviceUser,
350
+ ssh_key_ids: request.sshKeyIds,
351
+ user: request.user
352
+ });
353
+ const marshalCreateServerRequest = (request, defaults) => ({
354
+ description: request.description,
355
+ install: request.install !== undefined ? marshalCreateServerRequestInstall(request.install) : undefined,
356
+ name: request.name,
357
+ offer_id: request.offerId,
358
+ option_ids: request.optionIds,
359
+ tags: request.tags,
360
+ ...resolveOneOf([{
361
+ default: defaults.defaultOrganizationId,
362
+ param: 'organization_id',
363
+ value: request.organizationId
364
+ }, {
365
+ default: defaults.defaultProjectId,
366
+ param: 'project_id',
367
+ value: request.projectId
368
+ }])
369
+ });
370
+ const marshalInstallServerRequest = (request, defaults) => ({
371
+ hostname: request.hostname,
372
+ os_id: request.osId,
373
+ password: request.password,
374
+ service_password: request.servicePassword,
375
+ service_user: request.serviceUser,
376
+ ssh_key_ids: request.sshKeyIds,
377
+ user: request.user
378
+ });
379
+ const marshalPrivateNetworkApiAddServerPrivateNetworkRequest = (request, defaults) => ({
380
+ private_network_id: request.privateNetworkId
381
+ });
382
+ const marshalPrivateNetworkApiSetServerPrivateNetworksRequest = (request, defaults) => ({
383
+ private_network_ids: request.privateNetworkIds
384
+ });
385
+ const marshalRebootServerRequest = (request, defaults) => ({
386
+ boot_type: request.bootType
387
+ });
388
+ const marshalStartBMCAccessRequest = (request, defaults) => ({
389
+ ip: request.ip
390
+ });
391
+ const marshalStartServerRequest = (request, defaults) => ({
392
+ boot_type: request.bootType
393
+ });
394
+ const marshalUpdateIPRequest = (request, defaults) => ({
395
+ reverse: request.reverse
396
+ });
397
+ const marshalUpdateServerRequest = (request, defaults) => ({
398
+ description: request.description,
399
+ name: request.name,
400
+ tags: request.tags
401
+ });
402
+ const marshalUpdateSettingRequest = (request, defaults) => ({
403
+ enabled: request.enabled
404
+ });
405
+
406
+ export { marshalAddOptionServerRequest, marshalCreateServerRequest, marshalInstallServerRequest, marshalPrivateNetworkApiAddServerPrivateNetworkRequest, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, marshalRebootServerRequest, marshalStartBMCAccessRequest, marshalStartServerRequest, marshalUpdateIPRequest, marshalUpdateServerRequest, marshalUpdateSettingRequest, unmarshalBMCAccess, unmarshalGetServerMetricsResponse, unmarshalIP, unmarshalListOSResponse, unmarshalListOffersResponse, unmarshalListOptionsResponse, unmarshalListServerEventsResponse, unmarshalListServerPrivateNetworksResponse, unmarshalListServersResponse, unmarshalListSettingsResponse, unmarshalOS, unmarshalOffer, unmarshalOption, unmarshalServer, unmarshalServerPrivateNetwork, unmarshalSetServerPrivateNetworksResponse, unmarshalSetting };
@@ -0,0 +1,109 @@
1
+ // This file was automatically generated. DO NOT EDIT.
2
+ // If you have any remark or suggestion do not hesitate to open an issue.
3
+
4
+ const CreateServerRequest = {
5
+ description: {
6
+ maxLength: 255
7
+ },
8
+ name: {
9
+ minLength: 1
10
+ }
11
+ };
12
+ const CreateServerRequestInstall = {
13
+ hostname: {
14
+ maxLength: 255
15
+ },
16
+ password: {
17
+ maxLength: 255
18
+ },
19
+ servicePassword: {
20
+ maxLength: 255
21
+ },
22
+ serviceUser: {
23
+ maxLength: 255
24
+ },
25
+ user: {
26
+ maxLength: 255
27
+ }
28
+ };
29
+ const InstallServerRequest = {
30
+ hostname: {
31
+ maxLength: 255
32
+ },
33
+ password: {
34
+ maxLength: 255
35
+ },
36
+ servicePassword: {
37
+ maxLength: 255
38
+ },
39
+ serviceUser: {
40
+ maxLength: 255
41
+ },
42
+ user: {
43
+ maxLength: 255
44
+ }
45
+ };
46
+ const ListOSRequest = {
47
+ page: {
48
+ greaterThan: 0
49
+ },
50
+ pageSize: {
51
+ greaterThan: 0,
52
+ lessThanOrEqual: 100
53
+ }
54
+ };
55
+ const ListOffersRequest = {
56
+ page: {
57
+ greaterThan: 0
58
+ },
59
+ pageSize: {
60
+ greaterThan: 0,
61
+ lessThanOrEqual: 100
62
+ }
63
+ };
64
+ const ListOptionsRequest = {
65
+ page: {
66
+ greaterThan: 0
67
+ },
68
+ pageSize: {
69
+ greaterThan: 0,
70
+ lessThanOrEqual: 100
71
+ }
72
+ };
73
+ const ListServerEventsRequest = {
74
+ page: {
75
+ greaterThan: 0
76
+ },
77
+ pageSize: {
78
+ greaterThan: 0,
79
+ lessThanOrEqual: 100
80
+ }
81
+ };
82
+ const ListServersRequest = {
83
+ page: {
84
+ greaterThan: 0
85
+ },
86
+ pageSize: {
87
+ greaterThan: 0,
88
+ lessThanOrEqual: 100
89
+ }
90
+ };
91
+ const ListSettingsRequest = {
92
+ page: {
93
+ greaterThan: 0
94
+ },
95
+ pageSize: {
96
+ greaterThan: 0,
97
+ lessThanOrEqual: 100
98
+ }
99
+ };
100
+ const UpdateServerRequest = {
101
+ description: {
102
+ maxLength: 255
103
+ },
104
+ name: {
105
+ maxLength: 255
106
+ }
107
+ };
108
+
109
+ export { CreateServerRequest, CreateServerRequestInstall, InstallServerRequest, ListOSRequest, ListOffersRequest, ListOptionsRequest, ListServerEventsRequest, ListServersRequest, ListSettingsRequest, UpdateServerRequest };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v2alpha1/index.gen.js';
2
+ export { index_gen as v2alpha1 };
@@ -0,0 +1,80 @@
1
+ import { API as API$1 } from '../../../scw/api.js';
2
+ import { urlParams, validatePathParam } from '../../../helpers/marshalling.js';
3
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
+ import { unmarshalGetConsumptionResponse, unmarshalListInvoicesResponse } from './marshalling.gen.js';
5
+
6
+ // This file was automatically generated. DO NOT EDIT.
7
+ // If you have any remark or suggestion do not hesitate to open an issue.
8
+ /**
9
+ * Billing API.
10
+ *
11
+ * This API allows you to query your consumption.
12
+ */
13
+ class API extends API$1 {
14
+ /**
15
+ * Get current month's consumption. The consumption reflects the amount of
16
+ * money you have spent for the products you have used. The consumption value
17
+ * is monetary and is not computed in real time.
18
+ *
19
+ * @param request - The request {@link GetConsumptionRequest}
20
+ * @returns A Promise of GetConsumptionResponse
21
+ */
22
+ getConsumption = (() => {
23
+ var _this = this;
24
+ return function (request) {
25
+ if (request === void 0) {
26
+ request = {};
27
+ }
28
+ return _this.client.fetch({
29
+ method: 'GET',
30
+ path: `/billing/v2alpha1/consumption`,
31
+ urlParams: urlParams(['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId])
32
+ }, unmarshalGetConsumptionResponse);
33
+ };
34
+ })();
35
+ pageOfListInvoices = (() => {
36
+ var _this2 = this;
37
+ return function (request) {
38
+ if (request === void 0) {
39
+ request = {};
40
+ }
41
+ return _this2.client.fetch({
42
+ method: 'GET',
43
+ path: `/billing/v2alpha1/invoices`,
44
+ urlParams: urlParams(['invoice_type', request.invoiceType], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this2.client.settings.defaultPageSize], ['started_after', request.startedAfter], ['started_before', request.startedBefore])
45
+ }, unmarshalListInvoicesResponse);
46
+ };
47
+ })();
48
+
49
+ /**
50
+ * List invoices. List all your invoices, filtering by `start_date` and
51
+ * `invoice_type`. Each invoice has its own ID.
52
+ *
53
+ * @param request - The request {@link ListInvoicesRequest}
54
+ * @returns A Promise of ListInvoicesResponse
55
+ */
56
+ listInvoices = (() => {
57
+ var _this3 = this;
58
+ return function (request) {
59
+ if (request === void 0) {
60
+ request = {};
61
+ }
62
+ return enrichForPagination('invoices', _this3.pageOfListInvoices, request);
63
+ };
64
+ })();
65
+
66
+ /**
67
+ * Download an invoice. Download a specific invoice, specified by its ID.
68
+ *
69
+ * @param request - The request {@link DownloadInvoiceRequest}
70
+ * @returns A Promise of Blob
71
+ */
72
+ downloadInvoice = request => this.client.fetch({
73
+ method: 'GET',
74
+ path: `/billing/v2alpha1/invoices/${validatePathParam('invoiceId', request.invoiceId)}/download`,
75
+ urlParams: urlParams(['dl', 1], ['file_type', request.fileType]),
76
+ responseType: 'blob'
77
+ });
78
+ }
79
+
80
+ export { API };
@@ -0,0 +1,4 @@
1
+ export { API } from './api.gen.js';
2
+
3
+ // This file was automatically generated. DO NOT EDIT.
4
+ // If you have any remark or suggestion do not hesitate to open an issue.
@@ -0,0 +1,53 @@
1
+ import { isJSONObject } from '../../../helpers/json.js';
2
+ import { unmarshalMoney } from '../../../scw/custom-marshalling.js';
3
+ import { unmarshalArrayOfObject, unmarshalDate } 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 unmarshalGetConsumptionResponseConsumption = data => {
8
+ if (!isJSONObject(data)) {
9
+ throw new TypeError(`Unmarshalling the type 'GetConsumptionResponseConsumption' failed as data isn't a dictionary.`);
10
+ }
11
+ return {
12
+ category: data.category,
13
+ description: data.description,
14
+ operationPath: data.operation_path,
15
+ projectId: data.project_id,
16
+ value: data.value ? unmarshalMoney(data.value) : undefined
17
+ };
18
+ };
19
+ const unmarshalGetConsumptionResponse = data => {
20
+ if (!isJSONObject(data)) {
21
+ throw new TypeError(`Unmarshalling the type 'GetConsumptionResponse' failed as data isn't a dictionary.`);
22
+ }
23
+ return {
24
+ consumptions: unmarshalArrayOfObject(data.consumptions, unmarshalGetConsumptionResponseConsumption),
25
+ updatedAt: unmarshalDate(data.updated_at)
26
+ };
27
+ };
28
+ const unmarshalInvoice = data => {
29
+ if (!isJSONObject(data)) {
30
+ throw new TypeError(`Unmarshalling the type 'Invoice' failed as data isn't a dictionary.`);
31
+ }
32
+ return {
33
+ dueDate: unmarshalDate(data.due_date),
34
+ id: data.id,
35
+ invoiceType: data.invoice_type,
36
+ issuedDate: unmarshalDate(data.issued_date),
37
+ number: data.number,
38
+ startDate: unmarshalDate(data.start_date),
39
+ totalTaxed: data.total_taxed ? unmarshalMoney(data.total_taxed) : undefined,
40
+ totalUntaxed: data.total_untaxed ? unmarshalMoney(data.total_untaxed) : undefined
41
+ };
42
+ };
43
+ const unmarshalListInvoicesResponse = data => {
44
+ if (!isJSONObject(data)) {
45
+ throw new TypeError(`Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`);
46
+ }
47
+ return {
48
+ invoices: unmarshalArrayOfObject(data.invoices, unmarshalInvoice),
49
+ totalCount: data.total_count
50
+ };
51
+ };
52
+
53
+ export { unmarshalGetConsumptionResponse, unmarshalListInvoicesResponse };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };