@scaleway/sdk 2.0.0-alpha.13 → 2.0.0-alpha.15

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,439 @@
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 { unmarshalTimeSeries } from '../../../scw/custom-marshalling.js';
4
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.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
+ const unmarshalDeviceMessageFiltersRule = data => {
9
+ if (!isJSONObject(data)) {
10
+ throw new TypeError(`Unmarshalling the type 'DeviceMessageFiltersRule' failed as data isn't a dictionary.`);
11
+ }
12
+ return {
13
+ policy: data.policy,
14
+ topics: data.topics
15
+ };
16
+ };
17
+ const unmarshalDeviceMessageFilters = data => {
18
+ if (!isJSONObject(data)) {
19
+ throw new TypeError(`Unmarshalling the type 'DeviceMessageFilters' failed as data isn't a dictionary.`);
20
+ }
21
+ return {
22
+ publish: data.publish ? unmarshalDeviceMessageFiltersRule(data.publish) : undefined,
23
+ subscribe: data.subscribe ? unmarshalDeviceMessageFiltersRule(data.subscribe) : undefined
24
+ };
25
+ };
26
+ const unmarshalDevice = data => {
27
+ if (!isJSONObject(data)) {
28
+ throw new TypeError(`Unmarshalling the type 'Device' failed as data isn't a dictionary.`);
29
+ }
30
+ return {
31
+ allowInsecure: data.allow_insecure,
32
+ allowMultipleConnections: data.allow_multiple_connections,
33
+ createdAt: unmarshalDate(data.created_at),
34
+ description: data.description,
35
+ hasCustomCertificate: data.has_custom_certificate,
36
+ hubId: data.hub_id,
37
+ id: data.id,
38
+ isConnected: data.is_connected,
39
+ lastActivityAt: unmarshalDate(data.last_activity_at),
40
+ messageFilters: data.message_filters ? unmarshalDeviceMessageFilters(data.message_filters) : undefined,
41
+ name: data.name,
42
+ status: data.status,
43
+ updatedAt: unmarshalDate(data.updated_at)
44
+ };
45
+ };
46
+ const unmarshalNetwork = data => {
47
+ if (!isJSONObject(data)) {
48
+ throw new TypeError(`Unmarshalling the type 'Network' failed as data isn't a dictionary.`);
49
+ }
50
+ return {
51
+ createdAt: unmarshalDate(data.created_at),
52
+ endpoint: data.endpoint,
53
+ hubId: data.hub_id,
54
+ id: data.id,
55
+ name: data.name,
56
+ topicPrefix: data.topic_prefix,
57
+ type: data.type
58
+ };
59
+ };
60
+ const unmarshalHubTwinsGraphiteConfig = data => {
61
+ if (!isJSONObject(data)) {
62
+ throw new TypeError(`Unmarshalling the type 'HubTwinsGraphiteConfig' failed as data isn't a dictionary.`);
63
+ }
64
+ return {
65
+ pushUri: data.push_uri
66
+ };
67
+ };
68
+ const unmarshalHub = data => {
69
+ if (!isJSONObject(data)) {
70
+ throw new TypeError(`Unmarshalling the type 'Hub' failed as data isn't a dictionary.`);
71
+ }
72
+ return {
73
+ connectedDeviceCount: data.connected_device_count,
74
+ createdAt: unmarshalDate(data.created_at),
75
+ deviceCount: data.device_count,
76
+ disableEvents: data.disable_events,
77
+ enableDeviceAutoProvisioning: data.enable_device_auto_provisioning,
78
+ enabled: data.enabled,
79
+ endpoint: data.endpoint,
80
+ eventsTopicPrefix: data.events_topic_prefix,
81
+ hasCustomCa: data.has_custom_ca,
82
+ id: data.id,
83
+ name: data.name,
84
+ organizationId: data.organization_id,
85
+ productPlan: data.product_plan,
86
+ projectId: data.project_id,
87
+ region: data.region,
88
+ status: data.status,
89
+ twinsGraphiteConfig: data.twins_graphite_config ? unmarshalHubTwinsGraphiteConfig(data.twins_graphite_config) : undefined,
90
+ updatedAt: unmarshalDate(data.updated_at)
91
+ };
92
+ };
93
+ const unmarshalCertificate = data => {
94
+ if (!isJSONObject(data)) {
95
+ throw new TypeError(`Unmarshalling the type 'Certificate' failed as data isn't a dictionary.`);
96
+ }
97
+ return {
98
+ crt: data.crt,
99
+ key: data.key
100
+ };
101
+ };
102
+ const unmarshalCreateDeviceResponse = data => {
103
+ if (!isJSONObject(data)) {
104
+ throw new TypeError(`Unmarshalling the type 'CreateDeviceResponse' failed as data isn't a dictionary.`);
105
+ }
106
+ return {
107
+ certificate: data.certificate ? unmarshalCertificate(data.certificate) : undefined,
108
+ device: data.device ? unmarshalDevice(data.device) : undefined
109
+ };
110
+ };
111
+ const unmarshalCreateNetworkResponse = data => {
112
+ if (!isJSONObject(data)) {
113
+ throw new TypeError(`Unmarshalling the type 'CreateNetworkResponse' failed as data isn't a dictionary.`);
114
+ }
115
+ return {
116
+ network: data.network ? unmarshalNetwork(data.network) : undefined,
117
+ secret: data.secret
118
+ };
119
+ };
120
+ const unmarshalGetDeviceCertificateResponse = data => {
121
+ if (!isJSONObject(data)) {
122
+ throw new TypeError(`Unmarshalling the type 'GetDeviceCertificateResponse' failed as data isn't a dictionary.`);
123
+ }
124
+ return {
125
+ certificatePem: data.certificate_pem,
126
+ device: data.device ? unmarshalDevice(data.device) : undefined
127
+ };
128
+ };
129
+ const unmarshalGetDeviceMetricsResponse = data => {
130
+ if (!isJSONObject(data)) {
131
+ throw new TypeError(`Unmarshalling the type 'GetDeviceMetricsResponse' failed as data isn't a dictionary.`);
132
+ }
133
+ return {
134
+ metrics: unmarshalArrayOfObject(data.metrics, unmarshalTimeSeries)
135
+ };
136
+ };
137
+ const unmarshalGetHubCAResponse = data => {
138
+ if (!isJSONObject(data)) {
139
+ throw new TypeError(`Unmarshalling the type 'GetHubCAResponse' failed as data isn't a dictionary.`);
140
+ }
141
+ return {
142
+ caCertPem: data.ca_cert_pem
143
+ };
144
+ };
145
+ const unmarshalGetHubMetricsResponse = data => {
146
+ if (!isJSONObject(data)) {
147
+ throw new TypeError(`Unmarshalling the type 'GetHubMetricsResponse' failed as data isn't a dictionary.`);
148
+ }
149
+ return {
150
+ metrics: unmarshalArrayOfObject(data.metrics, unmarshalTimeSeries)
151
+ };
152
+ };
153
+ const unmarshalListDevicesResponse = data => {
154
+ if (!isJSONObject(data)) {
155
+ throw new TypeError(`Unmarshalling the type 'ListDevicesResponse' failed as data isn't a dictionary.`);
156
+ }
157
+ return {
158
+ devices: unmarshalArrayOfObject(data.devices, unmarshalDevice),
159
+ totalCount: data.total_count
160
+ };
161
+ };
162
+ const unmarshalListHubsResponse = data => {
163
+ if (!isJSONObject(data)) {
164
+ throw new TypeError(`Unmarshalling the type 'ListHubsResponse' failed as data isn't a dictionary.`);
165
+ }
166
+ return {
167
+ hubs: unmarshalArrayOfObject(data.hubs, unmarshalHub),
168
+ totalCount: data.total_count
169
+ };
170
+ };
171
+ const unmarshalListNetworksResponse = data => {
172
+ if (!isJSONObject(data)) {
173
+ throw new TypeError(`Unmarshalling the type 'ListNetworksResponse' failed as data isn't a dictionary.`);
174
+ }
175
+ return {
176
+ networks: unmarshalArrayOfObject(data.networks, unmarshalNetwork),
177
+ totalCount: data.total_count
178
+ };
179
+ };
180
+ const unmarshalRouteSummary = data => {
181
+ if (!isJSONObject(data)) {
182
+ throw new TypeError(`Unmarshalling the type 'RouteSummary' failed as data isn't a dictionary.`);
183
+ }
184
+ return {
185
+ createdAt: unmarshalDate(data.created_at),
186
+ hubId: data.hub_id,
187
+ id: data.id,
188
+ name: data.name,
189
+ topic: data.topic,
190
+ type: data.type,
191
+ updatedAt: unmarshalDate(data.updated_at)
192
+ };
193
+ };
194
+ const unmarshalListRoutesResponse = data => {
195
+ if (!isJSONObject(data)) {
196
+ throw new TypeError(`Unmarshalling the type 'ListRoutesResponse' failed as data isn't a dictionary.`);
197
+ }
198
+ return {
199
+ routes: unmarshalArrayOfObject(data.routes, unmarshalRouteSummary),
200
+ totalCount: data.total_count
201
+ };
202
+ };
203
+ const unmarshalListTwinDocumentsResponseDocumentSummary = data => {
204
+ if (!isJSONObject(data)) {
205
+ throw new TypeError(`Unmarshalling the type 'ListTwinDocumentsResponseDocumentSummary' failed as data isn't a dictionary.`);
206
+ }
207
+ return {
208
+ documentName: data.document_name
209
+ };
210
+ };
211
+ const unmarshalListTwinDocumentsResponse = data => {
212
+ if (!isJSONObject(data)) {
213
+ throw new TypeError(`Unmarshalling the type 'ListTwinDocumentsResponse' failed as data isn't a dictionary.`);
214
+ }
215
+ return {
216
+ documents: unmarshalArrayOfObject(data.documents, unmarshalListTwinDocumentsResponseDocumentSummary)
217
+ };
218
+ };
219
+ const unmarshalRenewDeviceCertificateResponse = data => {
220
+ if (!isJSONObject(data)) {
221
+ throw new TypeError(`Unmarshalling the type 'RenewDeviceCertificateResponse' failed as data isn't a dictionary.`);
222
+ }
223
+ return {
224
+ certificate: data.certificate ? unmarshalCertificate(data.certificate) : undefined,
225
+ device: data.device ? unmarshalDevice(data.device) : undefined
226
+ };
227
+ };
228
+ const unmarshalRouteDatabaseConfig = data => {
229
+ if (!isJSONObject(data)) {
230
+ throw new TypeError(`Unmarshalling the type 'RouteDatabaseConfig' failed as data isn't a dictionary.`);
231
+ }
232
+ return {
233
+ dbname: data.dbname,
234
+ engine: data.engine,
235
+ host: data.host,
236
+ password: data.password,
237
+ port: data.port,
238
+ query: data.query,
239
+ username: data.username
240
+ };
241
+ };
242
+ const unmarshalRouteRestConfig = data => {
243
+ if (!isJSONObject(data)) {
244
+ throw new TypeError(`Unmarshalling the type 'RouteRestConfig' failed as data isn't a dictionary.`);
245
+ }
246
+ return {
247
+ headers: data.headers,
248
+ uri: data.uri,
249
+ verb: data.verb
250
+ };
251
+ };
252
+ const unmarshalRouteS3Config = data => {
253
+ if (!isJSONObject(data)) {
254
+ throw new TypeError(`Unmarshalling the type 'RouteS3Config' failed as data isn't a dictionary.`);
255
+ }
256
+ return {
257
+ bucketName: data.bucket_name,
258
+ bucketRegion: data.bucket_region,
259
+ objectPrefix: data.object_prefix,
260
+ strategy: data.strategy
261
+ };
262
+ };
263
+ const unmarshalRoute = data => {
264
+ if (!isJSONObject(data)) {
265
+ throw new TypeError(`Unmarshalling the type 'Route' failed as data isn't a dictionary.`);
266
+ }
267
+ return {
268
+ createdAt: unmarshalDate(data.created_at),
269
+ dbConfig: data.db_config ? unmarshalRouteDatabaseConfig(data.db_config) : undefined,
270
+ hubId: data.hub_id,
271
+ id: data.id,
272
+ name: data.name,
273
+ restConfig: data.rest_config ? unmarshalRouteRestConfig(data.rest_config) : undefined,
274
+ s3Config: data.s3_config ? unmarshalRouteS3Config(data.s3_config) : undefined,
275
+ topic: data.topic,
276
+ type: data.type,
277
+ updatedAt: unmarshalDate(data.updated_at)
278
+ };
279
+ };
280
+ const unmarshalSetDeviceCertificateResponse = data => {
281
+ if (!isJSONObject(data)) {
282
+ throw new TypeError(`Unmarshalling the type 'SetDeviceCertificateResponse' failed as data isn't a dictionary.`);
283
+ }
284
+ return {
285
+ certificatePem: data.certificate_pem,
286
+ device: data.device ? unmarshalDevice(data.device) : undefined
287
+ };
288
+ };
289
+ const unmarshalTwinDocument = data => {
290
+ if (!isJSONObject(data)) {
291
+ throw new TypeError(`Unmarshalling the type 'TwinDocument' failed as data isn't a dictionary.`);
292
+ }
293
+ return {
294
+ data: data.data,
295
+ documentName: data.document_name,
296
+ twinId: data.twin_id,
297
+ version: data.version
298
+ };
299
+ };
300
+ const marshalDeviceMessageFiltersRule = (request, defaults) => ({
301
+ policy: request.policy,
302
+ topics: request.topics
303
+ });
304
+ const marshalDeviceMessageFilters = (request, defaults) => ({
305
+ publish: request.publish !== undefined ? marshalDeviceMessageFiltersRule(request.publish) : undefined,
306
+ subscribe: request.subscribe !== undefined ? marshalDeviceMessageFiltersRule(request.subscribe) : undefined
307
+ });
308
+ const marshalCreateDeviceRequest = (request, defaults) => ({
309
+ allow_insecure: request.allowInsecure,
310
+ allow_multiple_connections: request.allowMultipleConnections,
311
+ description: request.description,
312
+ hub_id: request.hubId,
313
+ message_filters: request.messageFilters !== undefined ? marshalDeviceMessageFilters(request.messageFilters) : undefined,
314
+ name: request.name || randomName('device')
315
+ });
316
+ const marshalHubTwinsGraphiteConfig = (request, defaults) => ({
317
+ push_uri: request.pushUri
318
+ });
319
+ const marshalCreateHubRequest = (request, defaults) => ({
320
+ disable_events: request.disableEvents,
321
+ events_topic_prefix: request.eventsTopicPrefix,
322
+ name: request.name || randomName('hub'),
323
+ product_plan: request.productPlan,
324
+ project_id: request.projectId ?? defaults.defaultProjectId,
325
+ ...resolveOneOf([{
326
+ param: 'twins_graphite_config',
327
+ value: request.twinsGraphiteConfig !== undefined ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig) : undefined
328
+ }])
329
+ });
330
+ const marshalCreateNetworkRequest = (request, defaults) => ({
331
+ hub_id: request.hubId,
332
+ name: request.name || randomName('network'),
333
+ topic_prefix: request.topicPrefix,
334
+ type: request.type
335
+ });
336
+ const marshalCreateRouteRequestDatabaseConfig = (request, defaults) => ({
337
+ dbname: request.dbname,
338
+ engine: request.engine,
339
+ host: request.host,
340
+ password: request.password,
341
+ port: request.port,
342
+ query: request.query,
343
+ username: request.username
344
+ });
345
+ const marshalCreateRouteRequestRestConfig = (request, defaults) => ({
346
+ headers: request.headers,
347
+ uri: request.uri,
348
+ verb: request.verb
349
+ });
350
+ const marshalCreateRouteRequestS3Config = (request, defaults) => ({
351
+ bucket_name: request.bucketName,
352
+ bucket_region: request.bucketRegion,
353
+ object_prefix: request.objectPrefix,
354
+ strategy: request.strategy
355
+ });
356
+ const marshalCreateRouteRequest = (request, defaults) => ({
357
+ hub_id: request.hubId,
358
+ name: request.name || randomName('route'),
359
+ topic: request.topic,
360
+ ...resolveOneOf([{
361
+ param: 's3_config',
362
+ value: request.s3Config !== undefined ? marshalCreateRouteRequestS3Config(request.s3Config) : undefined
363
+ }, {
364
+ param: 'db_config',
365
+ value: request.dbConfig !== undefined ? marshalCreateRouteRequestDatabaseConfig(request.dbConfig) : undefined
366
+ }, {
367
+ param: 'rest_config',
368
+ value: request.restConfig !== undefined ? marshalCreateRouteRequestRestConfig(request.restConfig) : undefined
369
+ }])
370
+ });
371
+ const marshalPatchTwinDocumentRequest = (request, defaults) => ({
372
+ data: request.data,
373
+ version: request.version
374
+ });
375
+ const marshalPutTwinDocumentRequest = (request, defaults) => ({
376
+ data: request.data,
377
+ version: request.version
378
+ });
379
+ const marshalSetDeviceCertificateRequest = (request, defaults) => ({
380
+ certificate_pem: request.certificatePem
381
+ });
382
+ const marshalSetHubCARequest = (request, defaults) => ({
383
+ ca_cert_pem: request.caCertPem,
384
+ challenge_cert_pem: request.challengeCertPem
385
+ });
386
+ const marshalUpdateDeviceRequest = (request, defaults) => ({
387
+ allow_insecure: request.allowInsecure,
388
+ allow_multiple_connections: request.allowMultipleConnections,
389
+ description: request.description,
390
+ hub_id: request.hubId,
391
+ message_filters: request.messageFilters !== undefined ? marshalDeviceMessageFilters(request.messageFilters) : undefined
392
+ });
393
+ const marshalUpdateHubRequest = (request, defaults) => ({
394
+ disable_events: request.disableEvents,
395
+ enable_device_auto_provisioning: request.enableDeviceAutoProvisioning,
396
+ events_topic_prefix: request.eventsTopicPrefix,
397
+ name: request.name,
398
+ product_plan: request.productPlan,
399
+ ...resolveOneOf([{
400
+ param: 'twins_graphite_config',
401
+ value: request.twinsGraphiteConfig !== undefined ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig) : undefined
402
+ }])
403
+ });
404
+ const marshalUpdateRouteRequestDatabaseConfig = (request, defaults) => ({
405
+ dbname: request.dbname,
406
+ engine: request.engine,
407
+ host: request.host,
408
+ password: request.password,
409
+ port: request.port,
410
+ query: request.query,
411
+ username: request.username
412
+ });
413
+ const marshalUpdateRouteRequestRestConfig = (request, defaults) => ({
414
+ headers: request.headers,
415
+ uri: request.uri,
416
+ verb: request.verb
417
+ });
418
+ const marshalUpdateRouteRequestS3Config = (request, defaults) => ({
419
+ bucket_name: request.bucketName,
420
+ bucket_region: request.bucketRegion,
421
+ object_prefix: request.objectPrefix,
422
+ strategy: request.strategy
423
+ });
424
+ const marshalUpdateRouteRequest = (request, defaults) => ({
425
+ name: request.name,
426
+ topic: request.topic,
427
+ ...resolveOneOf([{
428
+ param: 's3_config',
429
+ value: request.s3Config !== undefined ? marshalUpdateRouteRequestS3Config(request.s3Config) : undefined
430
+ }, {
431
+ param: 'db_config',
432
+ value: request.dbConfig !== undefined ? marshalUpdateRouteRequestDatabaseConfig(request.dbConfig) : undefined
433
+ }, {
434
+ param: 'rest_config',
435
+ value: request.restConfig !== undefined ? marshalUpdateRouteRequestRestConfig(request.restConfig) : undefined
436
+ }])
437
+ });
438
+
439
+ export { marshalCreateDeviceRequest, marshalCreateHubRequest, marshalCreateNetworkRequest, marshalCreateRouteRequest, marshalPatchTwinDocumentRequest, marshalPutTwinDocumentRequest, marshalSetDeviceCertificateRequest, marshalSetHubCARequest, marshalUpdateDeviceRequest, marshalUpdateHubRequest, marshalUpdateRouteRequest, unmarshalCreateDeviceResponse, unmarshalCreateNetworkResponse, unmarshalDevice, unmarshalGetDeviceCertificateResponse, unmarshalGetDeviceMetricsResponse, unmarshalGetHubCAResponse, unmarshalGetHubMetricsResponse, unmarshalHub, unmarshalListDevicesResponse, unmarshalListHubsResponse, unmarshalListNetworksResponse, unmarshalListRoutesResponse, unmarshalListTwinDocumentsResponse, unmarshalNetwork, unmarshalRenewDeviceCertificateResponse, unmarshalRoute, unmarshalSetDeviceCertificateResponse, unmarshalTwinDocument };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1/index.gen.js';
2
+ export { index_gen as v1 };
@@ -0,0 +1,113 @@
1
+ import { API as API$1 } from '../../../scw/api.js';
2
+ import { validatePathParam, urlParams, resolveOneOf } from '../../../helpers/marshalling.js';
3
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
+ import { marshalBookIPRequest, unmarshalIP, marshalUpdateIPRequest, unmarshalListIPsResponse } 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
+ const jsonContentHeaders = {
9
+ 'Content-Type': 'application/json; charset=utf-8'
10
+ };
11
+
12
+ /**
13
+ * IPAM API.
14
+ *
15
+ * This API allows you to manage IP addresses with Scaleway's IP Address
16
+ * Management tool.
17
+ */
18
+ class API extends API$1 {
19
+ /** Lists the available regions of the API. */
20
+ static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
21
+
22
+ /**
23
+ * Book a new IP. Book a new IP from the specified source. Currently IPs can
24
+ * only be booked from a Private Network.
25
+ *
26
+ * @param request - The request {@link BookIPRequest}
27
+ * @returns A Promise of IP
28
+ */
29
+ bookIP = request => this.client.fetch({
30
+ body: JSON.stringify(marshalBookIPRequest(request, this.client.settings)),
31
+ headers: jsonContentHeaders,
32
+ method: 'POST',
33
+ path: `/ipam/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/ips`
34
+ }, unmarshalIP);
35
+
36
+ /**
37
+ * Release an IP. Release an IP not currently attached to a resource, and
38
+ * returns it to the available IP pool.
39
+ *
40
+ * @param request - The request {@link ReleaseIPRequest}
41
+ */
42
+ releaseIP = request => this.client.fetch({
43
+ body: '{}',
44
+ headers: jsonContentHeaders,
45
+ method: 'DELETE',
46
+ path: `/ipam/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam('ipId', request.ipId)}`
47
+ });
48
+
49
+ /**
50
+ * Get an IP. Retrieve details of an existing IP, specified by its IP ID.
51
+ *
52
+ * @param request - The request {@link GetIPRequest}
53
+ * @returns A Promise of IP
54
+ */
55
+ getIP = request => this.client.fetch({
56
+ method: 'GET',
57
+ path: `/ipam/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam('ipId', request.ipId)}`
58
+ }, unmarshalIP);
59
+
60
+ /**
61
+ * Update an IP. Update parameters including tags of the specified IP.
62
+ *
63
+ * @param request - The request {@link UpdateIPRequest}
64
+ * @returns A Promise of IP
65
+ */
66
+ updateIP = request => this.client.fetch({
67
+ body: JSON.stringify(marshalUpdateIPRequest(request, this.client.settings)),
68
+ headers: jsonContentHeaders,
69
+ method: 'PATCH',
70
+ path: `/ipam/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam('ipId', request.ipId)}`
71
+ }, unmarshalIP);
72
+ pageOfListIPs = (() => {
73
+ var _this = this;
74
+ return function (request) {
75
+ if (request === void 0) {
76
+ request = {};
77
+ }
78
+ return _this.client.fetch({
79
+ method: 'GET',
80
+ path: `/ipam/v1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/ips`,
81
+ urlParams: urlParams(['attached', request.attached], ['is_ipv6', request.isIpv6], ['mac_address', request.macAddress], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId], ['resource_id', request.resourceId], ['resource_name', request.resourceName], ['resource_type', request.resourceType], ['tags', request.tags], ...Object.entries(resolveOneOf([{
82
+ param: 'zonal',
83
+ value: request.zonal
84
+ }, {
85
+ param: 'private_network_id',
86
+ value: request.privateNetworkId
87
+ }])))
88
+ }, unmarshalListIPsResponse);
89
+ };
90
+ })();
91
+
92
+ /**
93
+ * List existing IPs. List existing IPs in the specified region using various
94
+ * filters. For example, you can filter for IPs within a specified Private
95
+ * Network, or for public IPs within a specified Project. By default, the IPs
96
+ * returned in the list are ordered by creation date in ascending order,
97
+ * though this can be modified via the order_by field.
98
+ *
99
+ * @param request - The request {@link ListIPsRequest}
100
+ * @returns A Promise of ListIPsResponse
101
+ */
102
+ listIPs = (() => {
103
+ var _this2 = this;
104
+ return function (request) {
105
+ if (request === void 0) {
106
+ request = {};
107
+ }
108
+ return enrichForPagination('ips', _this2.pageOfListIPs, request);
109
+ };
110
+ })();
111
+ }
112
+
113
+ export { API };
@@ -0,0 +1,6 @@
1
+ export { API } from './api.gen.js';
2
+ import * as validationRules_gen from './validation-rules.gen.js';
3
+ export { validationRules_gen as ValidationRules };
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.
@@ -0,0 +1,77 @@
1
+ import { isJSONObject } from '../../../helpers/json.js';
2
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
5
+ // If you have any remark or suggestion do not hesitate to open an issue.
6
+ const unmarshalResource = data => {
7
+ if (!isJSONObject(data)) {
8
+ throw new TypeError(`Unmarshalling the type 'Resource' failed as data isn't a dictionary.`);
9
+ }
10
+ return {
11
+ id: data.id,
12
+ macAddress: data.mac_address,
13
+ name: data.name,
14
+ type: data.type
15
+ };
16
+ };
17
+ const unmarshalSource = data => {
18
+ if (!isJSONObject(data)) {
19
+ throw new TypeError(`Unmarshalling the type 'Source' failed as data isn't a dictionary.`);
20
+ }
21
+ return {
22
+ privateNetworkId: data.private_network_id,
23
+ subnetId: data.subnet_id,
24
+ zonal: data.zonal
25
+ };
26
+ };
27
+ const unmarshalIP = data => {
28
+ if (!isJSONObject(data)) {
29
+ throw new TypeError(`Unmarshalling the type 'IP' failed as data isn't a dictionary.`);
30
+ }
31
+ return {
32
+ address: data.address,
33
+ createdAt: unmarshalDate(data.created_at),
34
+ id: data.id,
35
+ isIpv6: data.is_ipv6,
36
+ projectId: data.project_id,
37
+ region: data.region,
38
+ resource: data.resource ? unmarshalResource(data.resource) : undefined,
39
+ source: unmarshalSource(data.source),
40
+ tags: data.tags,
41
+ updatedAt: unmarshalDate(data.updated_at),
42
+ zone: data.zone
43
+ };
44
+ };
45
+ const unmarshalListIPsResponse = data => {
46
+ if (!isJSONObject(data)) {
47
+ throw new TypeError(`Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`);
48
+ }
49
+ return {
50
+ ips: unmarshalArrayOfObject(data.ips, unmarshalIP),
51
+ totalCount: data.total_count
52
+ };
53
+ };
54
+ const marshalSource = (request, defaults) => ({
55
+ ...resolveOneOf([{
56
+ param: 'zonal',
57
+ value: request.zonal
58
+ }, {
59
+ param: 'private_network_id',
60
+ value: request.privateNetworkId
61
+ }, {
62
+ param: 'subnet_id',
63
+ value: request.subnetId
64
+ }])
65
+ });
66
+ const marshalBookIPRequest = (request, defaults) => ({
67
+ address: request.address,
68
+ is_ipv6: request.isIpv6,
69
+ project_id: request.projectId ?? defaults.defaultProjectId,
70
+ source: marshalSource(request.source),
71
+ tags: request.tags
72
+ });
73
+ const marshalUpdateIPRequest = (request, defaults) => ({
74
+ tags: request.tags
75
+ });
76
+
77
+ export { marshalBookIPRequest, marshalUpdateIPRequest, unmarshalIP, unmarshalListIPsResponse };
@@ -0,0 +1,11 @@
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 ListIPsRequest = {
5
+ resourceName: {
6
+ maxLength: 63,
7
+ minLength: 2
8
+ }
9
+ };
10
+
11
+ export { ListIPsRequest };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };