@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,395 +0,0 @@
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 ? data.default_value : undefined,
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: unmarshalOSOSField(data.password),
42
- servicePassword: unmarshalOSOSField(data.service_password),
43
- serviceUser: unmarshalOSOSField(data.service_user),
44
- ssh: unmarshalOSOSField(data.ssh),
45
- user: unmarshalOSOSField(data.user),
46
- version: data.version
47
- };
48
- };
49
- const unmarshalOfferOptionOffer = data => {
50
- if (!isJSONObject(data)) {
51
- throw new TypeError(`Unmarshalling the type 'OfferOptionOffer' failed as data isn't a dictionary.`);
52
- }
53
- return {
54
- enabled: data.enabled,
55
- id: data.id,
56
- manageable: data.manageable,
57
- name: data.name,
58
- osId: data.os_id ? data.os_id : undefined,
59
- price: data.price ? unmarshalMoney(data.price) : undefined,
60
- subscriptionPeriod: data.subscription_period
61
- };
62
- };
63
- const unmarshalRaidController = data => {
64
- if (!isJSONObject(data)) {
65
- throw new TypeError(`Unmarshalling the type 'RaidController' failed as data isn't a dictionary.`);
66
- }
67
- return {
68
- model: data.model,
69
- raidLevel: data.raid_level
70
- };
71
- };
72
- const unmarshalPersistentMemory = data => {
73
- if (!isJSONObject(data)) {
74
- throw new TypeError(`Unmarshalling the type 'PersistentMemory' failed as data isn't a dictionary.`);
75
- }
76
- return {
77
- capacity: data.capacity,
78
- frequency: data.frequency,
79
- type: data.type
80
- };
81
- };
82
- const unmarshalMemory = data => {
83
- if (!isJSONObject(data)) {
84
- throw new TypeError(`Unmarshalling the type 'Memory' failed as data isn't a dictionary.`);
85
- }
86
- return {
87
- capacity: data.capacity,
88
- frequency: data.frequency,
89
- isEcc: data.is_ecc,
90
- type: data.type
91
- };
92
- };
93
- const unmarshalCPU = data => {
94
- if (!isJSONObject(data)) {
95
- throw new TypeError(`Unmarshalling the type 'CPU' failed as data isn't a dictionary.`);
96
- }
97
- return {
98
- benchmark: data.benchmark,
99
- coreCount: data.core_count,
100
- frequency: data.frequency,
101
- name: data.name,
102
- threadCount: data.thread_count
103
- };
104
- };
105
- const unmarshalDisk = data => {
106
- if (!isJSONObject(data)) {
107
- throw new TypeError(`Unmarshalling the type 'Disk' failed as data isn't a dictionary.`);
108
- }
109
- return {
110
- capacity: data.capacity,
111
- type: data.type
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 ? data.vlan : undefined
166
- };
167
- };
168
- const unmarshalServerRescueServer = data => {
169
- if (!isJSONObject(data)) {
170
- throw new TypeError(`Unmarshalling the type 'ServerRescueServer' failed as data isn't a dictionary.`);
171
- }
172
- return {
173
- password: data.password,
174
- user: data.user
175
- };
176
- };
177
- const unmarshalServerOption = data => {
178
- if (!isJSONObject(data)) {
179
- throw new TypeError(`Unmarshalling the type 'ServerOption' failed as data isn't a dictionary.`);
180
- }
181
- return {
182
- expiresAt: unmarshalDate(data.expires_at),
183
- id: data.id,
184
- manageable: data.manageable,
185
- name: data.name,
186
- status: data.status
187
- };
188
- };
189
- const unmarshalServerInstall = data => {
190
- if (!isJSONObject(data)) {
191
- throw new TypeError(`Unmarshalling the type 'ServerInstall' failed as data isn't a dictionary.`);
192
- }
193
- return {
194
- hostname: data.hostname,
195
- osId: data.os_id,
196
- serviceUrl: data.service_url,
197
- serviceUser: data.service_user,
198
- sshKeyIds: data.ssh_key_ids,
199
- status: data.status,
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: unmarshalServerInstall(data.install),
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: unmarshalServerRescueServer(data.rescue_server),
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 marshalCreateServerRequest = (request, defaults) => ({
345
- description: request.description,
346
- install: request.install,
347
- name: request.name,
348
- offer_id: request.offerId,
349
- option_ids: request.optionIds,
350
- tags: request.tags,
351
- ...resolveOneOf([{
352
- param: 'organization_id',
353
- value: request.organizationId
354
- }, {
355
- param: 'project_id',
356
- value: request.projectId
357
- }])
358
- });
359
- const marshalInstallServerRequest = (request, defaults) => ({
360
- hostname: request.hostname,
361
- os_id: request.osId,
362
- password: request.password,
363
- service_password: request.servicePassword,
364
- service_user: request.serviceUser,
365
- ssh_key_ids: request.sshKeyIds,
366
- user: request.user
367
- });
368
- const marshalPrivateNetworkApiAddServerPrivateNetworkRequest = (request, defaults) => ({
369
- private_network_id: request.privateNetworkId
370
- });
371
- const marshalPrivateNetworkApiSetServerPrivateNetworksRequest = (request, defaults) => ({
372
- private_network_ids: request.privateNetworkIds
373
- });
374
- const marshalRebootServerRequest = (request, defaults) => ({
375
- boot_type: request.bootType
376
- });
377
- const marshalStartBMCAccessRequest = (request, defaults) => ({
378
- ip: request.ip
379
- });
380
- const marshalStartServerRequest = (request, defaults) => ({
381
- boot_type: request.bootType
382
- });
383
- const marshalUpdateIPRequest = (request, defaults) => ({
384
- reverse: request.reverse
385
- });
386
- const marshalUpdateServerRequest = (request, defaults) => ({
387
- description: request.description,
388
- name: request.name,
389
- tags: request.tags
390
- });
391
- const marshalUpdateSettingRequest = (request, defaults) => ({
392
- enabled: request.enabled
393
- });
394
-
395
- 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 };
@@ -1,109 +0,0 @@
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 };
@@ -1,2 +0,0 @@
1
- import * as index_gen from './v2alpha1/index.gen.js';
2
- export { index_gen as v2alpha1 };
@@ -1,80 +0,0 @@
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 };
@@ -1,4 +0,0 @@
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.
@@ -1,53 +0,0 @@
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 };
@@ -1,2 +0,0 @@
1
- import * as index_gen from './v1alpha1/index.gen.js';
2
- export { index_gen as v1alpha1 };