@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,63 @@
1
+ const marshalVolumeSummary = (request, defaults) => ({
2
+ id: request.id,
3
+ name: request.name,
4
+ size: request.size,
5
+ volume_type: request.volumeType
6
+ });
7
+ const marshalServerSummary = (request, defaults) => ({
8
+ id: request.id,
9
+ name: request.name
10
+ });
11
+ const marshalBootscript = (request, defaults) => ({
12
+ arch: request.arch,
13
+ bootcmdargs: request.bootcmdargs,
14
+ default: request.default,
15
+ dtb: request.dtb,
16
+ id: request.id,
17
+ initrd: request.initrd,
18
+ kernel: request.kernel,
19
+ organization: request.organization,
20
+ project: request.project,
21
+ public: request.public,
22
+ title: request.title,
23
+ zone: request.zone
24
+ });
25
+ const marshalVolume = (request, defaults) => ({
26
+ creation_date: request.creationDate,
27
+ export_uri: request.exportUri,
28
+ id: request.id,
29
+ modification_date: request.modificationDate,
30
+ name: request.name,
31
+ organization: request.organization,
32
+ project: request.project,
33
+ server: request.server ? marshalServerSummary(request.server) : undefined,
34
+ size: request.size,
35
+ state: request.state,
36
+ tags: request.tags,
37
+ volume_type: request.volumeType,
38
+ zone: request.zone
39
+ });
40
+ const marshalSetImageRequestWithID = (request, defaults) => ({
41
+ arch: request.arch,
42
+ creation_date: request.creationDate,
43
+ default_bootscript: request.defaultBootscript ? marshalBootscript(request.defaultBootscript) : undefined,
44
+ extra_volumes: request.extraVolumes ? Object.entries(request.extraVolumes).reduce((acc, _ref) => {
45
+ let [key, value] = _ref;
46
+ return {
47
+ ...acc,
48
+ [key]: marshalVolume(value)
49
+ };
50
+ }, {}) : undefined,
51
+ from_server: request.fromServer,
52
+ modification_date: request.modificationDate,
53
+ id: request.id,
54
+ name: request.name,
55
+ organization: request.organization,
56
+ project: request.project,
57
+ public: request.public,
58
+ root_volume: request.rootVolume ? marshalVolumeSummary(request.rootVolume) : undefined,
59
+ state: request.state,
60
+ tags: request.tags
61
+ });
62
+
63
+ export { marshalSetImageRequestWithID };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1/index.gen.js';
2
+ export { index_gen as v1 };
@@ -0,0 +1,573 @@
1
+ import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
+ import { API as API$1 } from '../../../scw/api.js';
3
+ import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
+ import { HUB_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { unmarshalListHubsResponse, marshalCreateHubRequest, unmarshalHub, marshalUpdateHubRequest, unmarshalGetHubMetricsResponse, marshalSetHubCARequest, unmarshalGetHubCAResponse, unmarshalListDevicesResponse, marshalCreateDeviceRequest, unmarshalCreateDeviceResponse, unmarshalDevice, marshalUpdateDeviceRequest, unmarshalRenewDeviceCertificateResponse, marshalSetDeviceCertificateRequest, unmarshalSetDeviceCertificateResponse, unmarshalGetDeviceCertificateResponse, unmarshalGetDeviceMetricsResponse, unmarshalListRoutesResponse, marshalCreateRouteRequest, unmarshalRoute, marshalUpdateRouteRequest, unmarshalListNetworksResponse, marshalCreateNetworkRequest, unmarshalCreateNetworkResponse, unmarshalNetwork, unmarshalTwinDocument, marshalPutTwinDocumentRequest, marshalPatchTwinDocumentRequest, unmarshalListTwinDocumentsResponse } from './marshalling.gen.js';
7
+
8
+ // This file was automatically generated. DO NOT EDIT.
9
+ // If you have any remark or suggestion do not hesitate to open an issue.
10
+ const jsonContentHeaders = {
11
+ 'Content-Type': 'application/json; charset=utf-8'
12
+ };
13
+
14
+ /**
15
+ * IoT Hub API.
16
+ *
17
+ * This API allows you to manage IoT hubs and devices.
18
+ */
19
+ class API extends API$1 {
20
+ /** Lists the available regions of the API. */
21
+ static LOCALITIES = ['fr-par'];
22
+ pageOfListHubs = (() => {
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: `/iot/v1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/hubs`,
31
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId])
32
+ }, unmarshalListHubsResponse);
33
+ };
34
+ })();
35
+
36
+ /**
37
+ * List hubs. List all Hubs in the specified zone. By default, returned Hubs
38
+ * are ordered by creation date in ascending order, though this can be
39
+ * modified via the `order_by` field.
40
+ *
41
+ * @param request - The request {@link ListHubsRequest}
42
+ * @returns A Promise of ListHubsResponse
43
+ */
44
+ listHubs = (() => {
45
+ var _this2 = this;
46
+ return function (request) {
47
+ if (request === void 0) {
48
+ request = {};
49
+ }
50
+ return enrichForPagination('hubs', _this2.pageOfListHubs, request);
51
+ };
52
+ })();
53
+
54
+ /**
55
+ * Create a hub. Create a new Hub in the targeted region, specifying its
56
+ * configuration including name and product plan.
57
+ *
58
+ * @param request - The request {@link CreateHubRequest}
59
+ * @returns A Promise of Hub
60
+ */
61
+ createHub = request => this.client.fetch({
62
+ body: JSON.stringify(marshalCreateHubRequest(request, this.client.settings)),
63
+ headers: jsonContentHeaders,
64
+ method: 'POST',
65
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs`
66
+ }, unmarshalHub);
67
+
68
+ /**
69
+ * Get a hub. Retrieve information about an existing IoT Hub, specified by its
70
+ * Hub ID. Its full details, including name, status and endpoint, are returned
71
+ * in the response object.
72
+ *
73
+ * @param request - The request {@link GetHubRequest}
74
+ * @returns A Promise of Hub
75
+ */
76
+ getHub = request => this.client.fetch({
77
+ method: 'GET',
78
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam('hubId', request.hubId)}`
79
+ }, unmarshalHub);
80
+
81
+ /**
82
+ * Waits for {@link Hub} to be in a final state.
83
+ *
84
+ * @param request - The request {@link GetHubRequest}
85
+ * @param options - The waiting options
86
+ * @returns A Promise of Hub
87
+ */
88
+ waitForHub = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!HUB_TRANSIENT_STATUSES.includes(res.status))), this.getHub, request, options);
89
+
90
+ /**
91
+ * Update a hub. Update the parameters of an existing IoT Hub, specified by
92
+ * its Hub ID.
93
+ *
94
+ * @param request - The request {@link UpdateHubRequest}
95
+ * @returns A Promise of Hub
96
+ */
97
+ updateHub = request => this.client.fetch({
98
+ body: JSON.stringify(marshalUpdateHubRequest(request, this.client.settings)),
99
+ headers: jsonContentHeaders,
100
+ method: 'PATCH',
101
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam('hubId', request.hubId)}`
102
+ }, unmarshalHub);
103
+
104
+ /**
105
+ * Enable a hub. Enable an existing IoT Hub, specified by its Hub ID.
106
+ *
107
+ * @param request - The request {@link EnableHubRequest}
108
+ * @returns A Promise of Hub
109
+ */
110
+ enableHub = request => this.client.fetch({
111
+ body: '{}',
112
+ headers: jsonContentHeaders,
113
+ method: 'POST',
114
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam('hubId', request.hubId)}/enable`
115
+ }, unmarshalHub);
116
+
117
+ /**
118
+ * Disable a hub. Disable an existing IoT Hub, specified by its Hub ID.
119
+ *
120
+ * @param request - The request {@link DisableHubRequest}
121
+ * @returns A Promise of Hub
122
+ */
123
+ disableHub = request => this.client.fetch({
124
+ body: '{}',
125
+ headers: jsonContentHeaders,
126
+ method: 'POST',
127
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam('hubId', request.hubId)}/disable`
128
+ }, unmarshalHub);
129
+
130
+ /**
131
+ * Delete a hub. Delete an existing IoT Hub, specified by its Hub ID. Deleting
132
+ * a Hub is permanent, and cannot be undone.
133
+ *
134
+ * @param request - The request {@link DeleteHubRequest}
135
+ */
136
+ deleteHub = request => this.client.fetch({
137
+ method: 'DELETE',
138
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam('hubId', request.hubId)}`,
139
+ urlParams: urlParams(['delete_devices', request.deleteDevices])
140
+ });
141
+
142
+ /**
143
+ * Get a hub's metrics. Get the metrics of an existing IoT Hub, specified by
144
+ * its Hub ID.
145
+ *
146
+ * @deprecated
147
+ * @param request - The request {@link GetHubMetricsRequest}
148
+ * @returns A Promise of GetHubMetricsResponse
149
+ */
150
+ getHubMetrics = request => this.client.fetch({
151
+ method: 'GET',
152
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam('hubId', request.hubId)}/metrics`,
153
+ urlParams: urlParams(['start_date', request.startDate])
154
+ }, unmarshalGetHubMetricsResponse);
155
+
156
+ /**
157
+ * Set the certificate authority of a hub. Set a particular PEM-encoded
158
+ * certificate, specified by the Hub ID.
159
+ *
160
+ * @param request - The request {@link SetHubCARequest}
161
+ * @returns A Promise of Hub
162
+ */
163
+ setHubCA = request => this.client.fetch({
164
+ body: JSON.stringify(marshalSetHubCARequest(request, this.client.settings)),
165
+ headers: jsonContentHeaders,
166
+ method: 'POST',
167
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam('hubId', request.hubId)}/ca`
168
+ }, unmarshalHub);
169
+
170
+ /**
171
+ * Get the certificate authority of a hub. Get information for a particular
172
+ * PEM-encoded certificate, specified by the Hub ID.
173
+ *
174
+ * @param request - The request {@link GetHubCARequest}
175
+ * @returns A Promise of GetHubCAResponse
176
+ */
177
+ getHubCA = request => this.client.fetch({
178
+ method: 'GET',
179
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam('hubId', request.hubId)}/ca`
180
+ }, unmarshalGetHubCAResponse);
181
+ pageOfListDevices = (() => {
182
+ var _this3 = this;
183
+ return function (request) {
184
+ if (request === void 0) {
185
+ request = {};
186
+ }
187
+ return _this3.client.fetch({
188
+ method: 'GET',
189
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/devices`,
190
+ urlParams: urlParams(['allow_insecure', request.allowInsecure], ['hub_id', request.hubId], ['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['status', request.status])
191
+ }, unmarshalListDevicesResponse);
192
+ };
193
+ })();
194
+
195
+ /**
196
+ * List devices. List all devices in the specified region. By default,
197
+ * returned devices are ordered by creation date in ascending order, though
198
+ * this can be modified via the `order_by` field.
199
+ *
200
+ * @param request - The request {@link ListDevicesRequest}
201
+ * @returns A Promise of ListDevicesResponse
202
+ */
203
+ listDevices = (() => {
204
+ var _this4 = this;
205
+ return function (request) {
206
+ if (request === void 0) {
207
+ request = {};
208
+ }
209
+ return enrichForPagination('devices', _this4.pageOfListDevices, request);
210
+ };
211
+ })();
212
+
213
+ /**
214
+ * Add a device. Attach a device to a given Hub.
215
+ *
216
+ * @param request - The request {@link CreateDeviceRequest}
217
+ * @returns A Promise of CreateDeviceResponse
218
+ */
219
+ createDevice = request => this.client.fetch({
220
+ body: JSON.stringify(marshalCreateDeviceRequest(request, this.client.settings)),
221
+ headers: jsonContentHeaders,
222
+ method: 'POST',
223
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/devices`
224
+ }, unmarshalCreateDeviceResponse);
225
+
226
+ /**
227
+ * Get a device. Retrieve information about an existing device, specified by
228
+ * its device ID. Its full details, including name, status and ID, are
229
+ * returned in the response object.
230
+ *
231
+ * @param request - The request {@link GetDeviceRequest}
232
+ * @returns A Promise of Device
233
+ */
234
+ getDevice = request => this.client.fetch({
235
+ method: 'GET',
236
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam('deviceId', request.deviceId)}`
237
+ }, unmarshalDevice);
238
+
239
+ /**
240
+ * Update a device. Update the parameters of an existing device, specified by
241
+ * its device ID.
242
+ *
243
+ * @param request - The request {@link UpdateDeviceRequest}
244
+ * @returns A Promise of Device
245
+ */
246
+ updateDevice = request => this.client.fetch({
247
+ body: JSON.stringify(marshalUpdateDeviceRequest(request, this.client.settings)),
248
+ headers: jsonContentHeaders,
249
+ method: 'PATCH',
250
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam('deviceId', request.deviceId)}`
251
+ }, unmarshalDevice);
252
+
253
+ /**
254
+ * Enable a device. Enable a specific device, specified by its device ID.
255
+ *
256
+ * @param request - The request {@link EnableDeviceRequest}
257
+ * @returns A Promise of Device
258
+ */
259
+ enableDevice = request => this.client.fetch({
260
+ body: '{}',
261
+ headers: jsonContentHeaders,
262
+ method: 'POST',
263
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam('deviceId', request.deviceId)}/enable`
264
+ }, unmarshalDevice);
265
+
266
+ /**
267
+ * Disable a device. Disable an existing device, specified by its device ID.
268
+ *
269
+ * @param request - The request {@link DisableDeviceRequest}
270
+ * @returns A Promise of Device
271
+ */
272
+ disableDevice = request => this.client.fetch({
273
+ body: '{}',
274
+ headers: jsonContentHeaders,
275
+ method: 'POST',
276
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam('deviceId', request.deviceId)}/disable`
277
+ }, unmarshalDevice);
278
+
279
+ /**
280
+ * Renew a device certificate. Renew the certificate of an existing device,
281
+ * specified by its device ID.
282
+ *
283
+ * @param request - The request {@link RenewDeviceCertificateRequest}
284
+ * @returns A Promise of RenewDeviceCertificateResponse
285
+ */
286
+ renewDeviceCertificate = request => this.client.fetch({
287
+ body: '{}',
288
+ headers: jsonContentHeaders,
289
+ method: 'POST',
290
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam('deviceId', request.deviceId)}/renew-certificate`
291
+ }, unmarshalRenewDeviceCertificateResponse);
292
+
293
+ /**
294
+ * Set a custom certificate on a device. Switch the existing certificate of a
295
+ * given device with an EM-encoded custom certificate.
296
+ *
297
+ * @param request - The request {@link SetDeviceCertificateRequest}
298
+ * @returns A Promise of SetDeviceCertificateResponse
299
+ */
300
+ setDeviceCertificate = request => this.client.fetch({
301
+ body: JSON.stringify(marshalSetDeviceCertificateRequest(request, this.client.settings)),
302
+ headers: jsonContentHeaders,
303
+ method: 'PUT',
304
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam('deviceId', request.deviceId)}/certificate`
305
+ }, unmarshalSetDeviceCertificateResponse);
306
+
307
+ /**
308
+ * Get a device's certificate. Get information for a particular PEM-encoded
309
+ * certificate, specified by the device ID. The response returns full details
310
+ * of the device, including its type of certificate.
311
+ *
312
+ * @param request - The request {@link GetDeviceCertificateRequest}
313
+ * @returns A Promise of GetDeviceCertificateResponse
314
+ */
315
+ getDeviceCertificate = request => this.client.fetch({
316
+ method: 'GET',
317
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam('deviceId', request.deviceId)}/certificate`
318
+ }, unmarshalGetDeviceCertificateResponse);
319
+
320
+ /**
321
+ * Remove a device. Remove a specific device from the specific Hub it is
322
+ * attached to.
323
+ *
324
+ * @param request - The request {@link DeleteDeviceRequest}
325
+ */
326
+ deleteDevice = request => this.client.fetch({
327
+ method: 'DELETE',
328
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam('deviceId', request.deviceId)}`
329
+ });
330
+
331
+ /**
332
+ * Get a device's metrics. Get the metrics of an existing device, specified by
333
+ * its device ID.
334
+ *
335
+ * @deprecated
336
+ * @param request - The request {@link GetDeviceMetricsRequest}
337
+ * @returns A Promise of GetDeviceMetricsResponse
338
+ */
339
+ getDeviceMetrics = request => this.client.fetch({
340
+ method: 'GET',
341
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam('deviceId', request.deviceId)}/metrics`,
342
+ urlParams: urlParams(['start_date', request.startDate])
343
+ }, unmarshalGetDeviceMetricsResponse);
344
+ pageOfListRoutes = (() => {
345
+ var _this5 = this;
346
+ return function (request) {
347
+ if (request === void 0) {
348
+ request = {};
349
+ }
350
+ return _this5.client.fetch({
351
+ method: 'GET',
352
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? _this5.client.settings.defaultRegion)}/routes`,
353
+ urlParams: urlParams(['hub_id', request.hubId], ['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this5.client.settings.defaultPageSize])
354
+ }, unmarshalListRoutesResponse);
355
+ };
356
+ })();
357
+
358
+ /**
359
+ * List routes. List all routes in the specified region. By default, returned
360
+ * routes are ordered by creation date in ascending order, though this can be
361
+ * modified via the `order_by` field.
362
+ *
363
+ * @param request - The request {@link ListRoutesRequest}
364
+ * @returns A Promise of ListRoutesResponse
365
+ */
366
+ listRoutes = (() => {
367
+ var _this6 = this;
368
+ return function (request) {
369
+ if (request === void 0) {
370
+ request = {};
371
+ }
372
+ return enrichForPagination('routes', _this6.pageOfListRoutes, request);
373
+ };
374
+ })();
375
+
376
+ /**
377
+ * Create a route. Multiple kinds of routes can be created, such as:
378
+ *
379
+ * - Database Route Create a route that will record subscribed MQTT messages
380
+ * into your database. <b>You need to manage the database by yourself</b>.
381
+ * - REST Route. Create a route that will call a REST API on received subscribed
382
+ * MQTT messages.
383
+ * - S3 Routes. Create a route that will put subscribed MQTT messages into an S3
384
+ * bucket. You need to create the bucket yourself and grant write access.
385
+ * Granting can be done with s3cmd (`s3cmd setacl s3://<my-bucket>
386
+ * --acl-grant=write:555c69c3-87d0-4bf8-80f1-99a2f757d031:555c69c3-87d0-4bf8-80f1-99a2f757d031`).
387
+ *
388
+ * @param request - The request {@link CreateRouteRequest}
389
+ * @returns A Promise of Route
390
+ */
391
+ createRoute = request => this.client.fetch({
392
+ body: JSON.stringify(marshalCreateRouteRequest(request, this.client.settings)),
393
+ headers: jsonContentHeaders,
394
+ method: 'POST',
395
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/routes`
396
+ }, unmarshalRoute);
397
+
398
+ /**
399
+ * Update a route. Update the parameters of an existing route, specified by
400
+ * its route ID.
401
+ *
402
+ * @param request - The request {@link UpdateRouteRequest}
403
+ * @returns A Promise of Route
404
+ */
405
+ updateRoute = request => this.client.fetch({
406
+ body: JSON.stringify(marshalUpdateRouteRequest(request, this.client.settings)),
407
+ headers: jsonContentHeaders,
408
+ method: 'PATCH',
409
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam('routeId', request.routeId)}`
410
+ }, unmarshalRoute);
411
+
412
+ /**
413
+ * Get a route. Get information for a particular route, specified by the route
414
+ * ID. The response returns full details of the route, including its type, the
415
+ * topic it subscribes to and its configuration.
416
+ *
417
+ * @param request - The request {@link GetRouteRequest}
418
+ * @returns A Promise of Route
419
+ */
420
+ getRoute = request => this.client.fetch({
421
+ method: 'GET',
422
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam('routeId', request.routeId)}`
423
+ }, unmarshalRoute);
424
+
425
+ /**
426
+ * Delete a route. Delete an existing route, specified by its route ID.
427
+ * Deleting a route is permanent, and cannot be undone.
428
+ *
429
+ * @param request - The request {@link DeleteRouteRequest}
430
+ */
431
+ deleteRoute = request => this.client.fetch({
432
+ method: 'DELETE',
433
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam('routeId', request.routeId)}`
434
+ });
435
+ pageOfListNetworks = (() => {
436
+ var _this7 = this;
437
+ return function (request) {
438
+ if (request === void 0) {
439
+ request = {};
440
+ }
441
+ return _this7.client.fetch({
442
+ method: 'GET',
443
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? _this7.client.settings.defaultRegion)}/networks`,
444
+ urlParams: urlParams(['hub_id', request.hubId], ['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this7.client.settings.defaultPageSize], ['topic_prefix', request.topicPrefix])
445
+ }, unmarshalListNetworksResponse);
446
+ };
447
+ })();
448
+
449
+ /**
450
+ * List the networks.
451
+ *
452
+ * @param request - The request {@link ListNetworksRequest}
453
+ * @returns A Promise of ListNetworksResponse
454
+ */
455
+ listNetworks = (() => {
456
+ var _this8 = this;
457
+ return function (request) {
458
+ if (request === void 0) {
459
+ request = {};
460
+ }
461
+ return enrichForPagination('networks', _this8.pageOfListNetworks, request);
462
+ };
463
+ })();
464
+
465
+ /**
466
+ * Create a new network. Create a new network for an existing hub. Beside the
467
+ * default network, you can add networks for different data providers.
468
+ * Possible network types are Sigfox and REST.
469
+ *
470
+ * @param request - The request {@link CreateNetworkRequest}
471
+ * @returns A Promise of CreateNetworkResponse
472
+ */
473
+ createNetwork = request => this.client.fetch({
474
+ body: JSON.stringify(marshalCreateNetworkRequest(request, this.client.settings)),
475
+ headers: jsonContentHeaders,
476
+ method: 'POST',
477
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/networks`
478
+ }, unmarshalCreateNetworkResponse);
479
+
480
+ /**
481
+ * Retrieve a specific network. Retrieve an existing network, specified by its
482
+ * network ID. The response returns full details of the network, including its
483
+ * type, the topic prefix and its endpoint.
484
+ *
485
+ * @param request - The request {@link GetNetworkRequest}
486
+ * @returns A Promise of Network
487
+ */
488
+ getNetwork = request => this.client.fetch({
489
+ method: 'GET',
490
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/networks/${validatePathParam('networkId', request.networkId)}`
491
+ }, unmarshalNetwork);
492
+
493
+ /**
494
+ * Delete a Network. Delete an existing network, specified by its network ID.
495
+ * Deleting a network is permanent, and cannot be undone.
496
+ *
497
+ * @param request - The request {@link DeleteNetworkRequest}
498
+ */
499
+ deleteNetwork = request => this.client.fetch({
500
+ method: 'DELETE',
501
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/networks/${validatePathParam('networkId', request.networkId)}`
502
+ });
503
+
504
+ /**
505
+ * BETA - Get a Cloud Twin Document.
506
+ *
507
+ * @param request - The request {@link GetTwinDocumentRequest}
508
+ * @returns A Promise of TwinDocument
509
+ */
510
+ getTwinDocument = request => this.client.fetch({
511
+ method: 'GET',
512
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam('twinId', request.twinId)}/documents/${validatePathParam('documentName', request.documentName)}`
513
+ }, unmarshalTwinDocument);
514
+
515
+ /**
516
+ * BETA - Update a Cloud Twin Document.
517
+ *
518
+ * @param request - The request {@link PutTwinDocumentRequest}
519
+ * @returns A Promise of TwinDocument
520
+ */
521
+ putTwinDocument = request => this.client.fetch({
522
+ body: JSON.stringify(marshalPutTwinDocumentRequest(request, this.client.settings)),
523
+ headers: jsonContentHeaders,
524
+ method: 'PUT',
525
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam('twinId', request.twinId)}/documents/${validatePathParam('documentName', request.documentName)}`
526
+ }, unmarshalTwinDocument);
527
+
528
+ /**
529
+ * BETA - Patch a Cloud Twin Document.
530
+ *
531
+ * @param request - The request {@link PatchTwinDocumentRequest}
532
+ * @returns A Promise of TwinDocument
533
+ */
534
+ patchTwinDocument = request => this.client.fetch({
535
+ body: JSON.stringify(marshalPatchTwinDocumentRequest(request, this.client.settings)),
536
+ headers: jsonContentHeaders,
537
+ method: 'PATCH',
538
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam('twinId', request.twinId)}/documents/${validatePathParam('documentName', request.documentName)}`
539
+ }, unmarshalTwinDocument);
540
+
541
+ /**
542
+ * BETA - Delete a Cloud Twin Document.
543
+ *
544
+ * @param request - The request {@link DeleteTwinDocumentRequest}
545
+ */
546
+ deleteTwinDocument = request => this.client.fetch({
547
+ method: 'DELETE',
548
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam('twinId', request.twinId)}/documents/${validatePathParam('documentName', request.documentName)}`
549
+ });
550
+
551
+ /**
552
+ * BETA - List the documents of a Cloud Twin.
553
+ *
554
+ * @param request - The request {@link ListTwinDocumentsRequest}
555
+ * @returns A Promise of ListTwinDocumentsResponse
556
+ */
557
+ listTwinDocuments = request => this.client.fetch({
558
+ method: 'GET',
559
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam('twinId', request.twinId)}`
560
+ }, unmarshalListTwinDocumentsResponse);
561
+
562
+ /**
563
+ * BETA - Delete all the documents of a Cloud Twin.
564
+ *
565
+ * @param request - The request {@link DeleteTwinDocumentsRequest}
566
+ */
567
+ deleteTwinDocuments = request => this.client.fetch({
568
+ method: 'DELETE',
569
+ path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam('twinId', request.twinId)}`
570
+ });
571
+ }
572
+
573
+ export { API };
@@ -0,0 +1,7 @@
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
+ /** Lists transient statutes of the enum {@link HubStatus}. */
5
+ const HUB_TRANSIENT_STATUSES = ['enabling', 'disabling'];
6
+
7
+ export { HUB_TRANSIENT_STATUSES };
@@ -0,0 +1,5 @@
1
+ export { API } from './api.gen.js';
2
+ export { HUB_TRANSIENT_STATUSES } from './content.gen.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.