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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/dist/api/account/index.js +4 -0
  2. package/dist/api/account/v2/api.gen.js +147 -0
  3. package/dist/api/account/v2/index.gen.js +4 -0
  4. package/dist/api/account/v2/marshalling.gen.js +39 -0
  5. package/dist/api/account/v3/api.gen.js +129 -0
  6. package/dist/api/account/v3/index.gen.js +6 -0
  7. package/dist/api/account/v3/marshalling.gen.js +39 -0
  8. package/dist/api/account/v3/validation-rules.gen.js +39 -0
  9. package/dist/api/applesilicon/index.js +2 -0
  10. package/dist/api/applesilicon/v1alpha1/api.gen.js +220 -0
  11. package/dist/api/applesilicon/v1alpha1/content.gen.js +7 -0
  12. package/dist/api/applesilicon/v1alpha1/index.gen.js +5 -0
  13. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +113 -0
  14. package/dist/api/baremetal/index.js +2 -0
  15. package/dist/api/baremetal/v1/api.gen.js +523 -0
  16. package/dist/api/baremetal/v1/api.utils.js +27 -0
  17. package/dist/api/baremetal/v1/content.gen.js +13 -0
  18. package/dist/api/baremetal/v1/index.js +5 -0
  19. package/dist/api/baremetal/v1/marshalling.gen.js +406 -0
  20. package/dist/api/baremetal/v1/validation-rules.gen.js +109 -0
  21. package/dist/api/billing/index.js +2 -0
  22. package/dist/api/billing/v2alpha1/api.gen.js +80 -0
  23. package/dist/api/billing/v2alpha1/index.gen.js +4 -0
  24. package/dist/api/billing/v2alpha1/marshalling.gen.js +53 -0
  25. package/dist/api/block/index.js +2 -0
  26. package/dist/api/block/v1alpha1/api.gen.js +249 -0
  27. package/dist/api/block/v1alpha1/content.gen.js +13 -0
  28. package/dist/api/block/v1alpha1/index.gen.js +7 -0
  29. package/dist/api/block/v1alpha1/marshalling.gen.js +182 -0
  30. package/dist/api/block/v1alpha1/validation-rules.gen.js +52 -0
  31. package/dist/api/cockpit/index.js +2 -0
  32. package/dist/api/cockpit/v1beta1/api.gen.js +543 -0
  33. package/dist/api/cockpit/v1beta1/content.gen.js +7 -0
  34. package/dist/api/cockpit/v1beta1/index.gen.js +5 -0
  35. package/dist/api/cockpit/v1beta1/marshalling.gen.js +271 -0
  36. package/dist/api/container/index.js +2 -0
  37. package/dist/api/container/v1beta1/api.gen.js +549 -0
  38. package/dist/api/container/v1beta1/content.gen.js +22 -0
  39. package/dist/api/container/v1beta1/index.gen.js +7 -0
  40. package/dist/api/container/v1beta1/marshalling.gen.js +358 -0
  41. package/dist/api/container/v1beta1/validation-rules.gen.js +44 -0
  42. package/dist/api/document_db/index.js +2 -0
  43. package/dist/api/document_db/v1beta1/api.gen.js +830 -0
  44. package/dist/api/document_db/v1beta1/content.gen.js +19 -0
  45. package/dist/api/document_db/v1beta1/index.gen.js +7 -0
  46. package/dist/api/document_db/v1beta1/marshalling.gen.js +636 -0
  47. package/dist/api/document_db/v1beta1/validation-rules.gen.js +10 -0
  48. package/dist/api/domain/index.js +2 -0
  49. package/dist/api/domain/v2beta1/api.gen.js +867 -0
  50. package/dist/api/domain/v2beta1/content.gen.js +28 -0
  51. package/dist/api/domain/v2beta1/index.gen.js +5 -0
  52. package/dist/api/domain/v2beta1/marshalling.gen.js +1172 -0
  53. package/dist/api/flexibleip/index.js +2 -0
  54. package/dist/api/flexibleip/v1alpha1/api.gen.js +195 -0
  55. package/dist/api/flexibleip/v1alpha1/content.gen.js +10 -0
  56. package/dist/api/flexibleip/v1alpha1/index.gen.js +7 -0
  57. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +97 -0
  58. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +14 -0
  59. package/dist/api/function/index.js +2 -0
  60. package/dist/api/function/v1beta1/api.gen.js +560 -0
  61. package/dist/api/function/v1beta1/content.gen.js +22 -0
  62. package/dist/api/function/v1beta1/index.gen.js +7 -0
  63. package/dist/api/function/v1beta1/marshalling.gen.js +396 -0
  64. package/dist/api/function/v1beta1/validation-rules.gen.js +44 -0
  65. package/dist/api/iam/index.js +2 -0
  66. package/dist/api/iam/v1alpha1/api.gen.js +783 -0
  67. package/dist/api/iam/v1alpha1/index.gen.js +6 -0
  68. package/dist/api/iam/v1alpha1/marshalling.gen.js +384 -0
  69. package/dist/api/iam/v1alpha1/validation-rules.gen.js +207 -0
  70. package/dist/api/instance/index.js +2 -0
  71. package/dist/api/instance/v1/api.gen.js +1003 -0
  72. package/dist/api/instance/v1/api.utils.js +369 -0
  73. package/dist/api/instance/v1/content.gen.js +31 -0
  74. package/dist/api/instance/v1/index.js +2 -0
  75. package/dist/api/instance/v1/marshalling.gen.js +1415 -0
  76. package/dist/api/instance/v1/marshalling.utils.js +63 -0
  77. package/dist/api/iot/index.js +2 -0
  78. package/dist/api/iot/v1/api.gen.js +573 -0
  79. package/dist/api/iot/v1/content.gen.js +7 -0
  80. package/dist/api/iot/v1/index.gen.js +5 -0
  81. package/dist/api/iot/v1/marshalling.gen.js +439 -0
  82. package/dist/api/ipam/index.js +2 -0
  83. package/dist/api/ipam/v1/api.gen.js +113 -0
  84. package/dist/api/ipam/v1/index.gen.js +6 -0
  85. package/dist/api/ipam/v1/marshalling.gen.js +77 -0
  86. package/dist/api/ipam/v1/validation-rules.gen.js +11 -0
  87. package/dist/api/ipfs/index.js +2 -0
  88. package/dist/api/ipfs/v1alpha1/api.gen.js +314 -0
  89. package/dist/api/ipfs/v1alpha1/content.gen.js +10 -0
  90. package/dist/api/ipfs/v1alpha1/index.gen.js +5 -0
  91. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +180 -0
  92. package/dist/api/k8s/index.js +2 -0
  93. package/dist/api/k8s/v1/api.gen.js +454 -0
  94. package/dist/api/k8s/v1/api.utils.js +13 -0
  95. package/dist/api/k8s/v1/content.gen.js +13 -0
  96. package/dist/api/k8s/v1/index.js +4 -0
  97. package/dist/api/k8s/v1/marshalling.gen.js +421 -0
  98. package/dist/api/k8s/v1/validation-rules.gen.js +101 -0
  99. package/dist/api/lb/index.js +2 -0
  100. package/dist/api/lb/v1/api.gen.js +1669 -0
  101. package/dist/api/lb/v1/api.utils.js +81 -0
  102. package/dist/api/lb/v1/content.gen.js +16 -0
  103. package/dist/api/lb/v1/index.js +2 -0
  104. package/dist/api/lb/v1/marshalling.gen.js +1039 -0
  105. package/dist/api/marketplace/index.js +4 -0
  106. package/dist/api/marketplace/v1/api.gen.js +60 -0
  107. package/dist/api/marketplace/v1/index.gen.js +4 -0
  108. package/dist/api/marketplace/v1/marshalling.gen.js +92 -0
  109. package/dist/api/marketplace/v2/api.gen.js +162 -0
  110. package/dist/api/marketplace/v2/index.gen.js +4 -0
  111. package/dist/api/marketplace/v2/marshalling.gen.js +94 -0
  112. package/dist/api/mnq/index.js +4 -0
  113. package/dist/api/mnq/v1alpha1/api.gen.js +197 -0
  114. package/dist/api/mnq/v1alpha1/index.gen.js +4 -0
  115. package/dist/api/mnq/v1alpha1/marshalling.gen.js +126 -0
  116. package/dist/api/mnq/v1beta1/api.gen.js +529 -0
  117. package/dist/api/mnq/v1beta1/index.gen.js +6 -0
  118. package/dist/api/mnq/v1beta1/marshalling.gen.js +212 -0
  119. package/dist/api/mnq/v1beta1/validation-rules.gen.js +77 -0
  120. package/dist/api/rdb/index.js +2 -0
  121. package/dist/api/rdb/v1/api.gen.js +972 -0
  122. package/dist/api/rdb/v1/content.gen.js +22 -0
  123. package/dist/api/rdb/v1/index.gen.js +7 -0
  124. package/dist/api/rdb/v1/marshalling.gen.js +694 -0
  125. package/dist/api/rdb/v1/validation-rules.gen.js +10 -0
  126. package/dist/api/redis/index.js +2 -0
  127. package/dist/api/redis/v1/api.gen.js +389 -0
  128. package/dist/api/redis/v1/content.gen.js +7 -0
  129. package/dist/api/redis/v1/index.gen.js +5 -0
  130. package/dist/api/redis/v1/marshalling.gen.js +283 -0
  131. package/dist/api/registry/index.js +2 -0
  132. package/dist/api/registry/v1/api.gen.js +252 -0
  133. package/dist/api/registry/v1/content.gen.js +13 -0
  134. package/dist/api/registry/v1/index.gen.js +5 -0
  135. package/dist/api/registry/v1/marshalling.gen.js +108 -0
  136. package/dist/api/secret/index.js +2 -0
  137. package/dist/api/secret/v1alpha1/api.gen.js +415 -0
  138. package/dist/api/secret/v1alpha1/index.gen.js +4 -0
  139. package/dist/api/secret/v1alpha1/marshalling.gen.js +150 -0
  140. package/dist/api/tem/index.js +2 -0
  141. package/dist/api/tem/v1alpha1/api.gen.js +229 -0
  142. package/dist/api/tem/v1alpha1/content.gen.js +10 -0
  143. package/dist/api/tem/v1alpha1/index.gen.js +5 -0
  144. package/dist/api/tem/v1alpha1/marshalling.gen.js +168 -0
  145. package/dist/api/test/index.js +2 -0
  146. package/dist/api/test/v1/api.gen.js +152 -0
  147. package/dist/api/test/v1/content.gen.js +7 -0
  148. package/dist/api/test/v1/index.gen.js +5 -0
  149. package/dist/api/test/v1/marshalling.gen.js +81 -0
  150. package/dist/api/vpc/index.js +4 -0
  151. package/dist/api/vpc/v1/api.gen.js +110 -0
  152. package/dist/api/vpc/v1/index.gen.js +4 -0
  153. package/dist/api/vpc/v1/marshalling.gen.js +44 -0
  154. package/dist/api/vpc/v2/api.gen.js +276 -0
  155. package/dist/api/vpc/v2/index.gen.js +4 -0
  156. package/dist/api/vpc/v2/marshalling.gen.js +137 -0
  157. package/dist/api/vpcgw/index.js +2 -0
  158. package/dist/api/vpcgw/v1/api.gen.js +669 -0
  159. package/dist/api/vpcgw/v1/content.gen.js +10 -0
  160. package/dist/api/vpcgw/v1/index.gen.js +5 -0
  161. package/dist/api/vpcgw/v1/marshalling.gen.js +359 -0
  162. package/dist/api/webhosting/index.js +2 -0
  163. package/dist/api/webhosting/v1alpha1/api.gen.js +158 -0
  164. package/dist/api/webhosting/v1alpha1/content.gen.js +7 -0
  165. package/dist/api/webhosting/v1alpha1/index.gen.js +7 -0
  166. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +146 -0
  167. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +14 -0
  168. package/dist/helpers/is-browser.js +5 -0
  169. package/dist/helpers/is-response.js +10 -0
  170. package/dist/helpers/json.js +11 -0
  171. package/dist/helpers/marshalling.js +130 -0
  172. package/dist/index.cjs +26484 -0
  173. package/dist/index.d.ts +31184 -0
  174. package/dist/index.js +71 -0
  175. package/dist/internal/async/interval-retrier.js +105 -0
  176. package/dist/internal/async/sleep.js +13 -0
  177. package/dist/internal/interceptors/composer.js +46 -0
  178. package/dist/internal/interceptors/helpers.js +32 -0
  179. package/dist/internal/logger/console-logger.js +38 -0
  180. package/dist/internal/logger/index.js +41 -0
  181. package/dist/internal/logger/level-resolver.js +13 -0
  182. package/dist/internal/validations/string-validation.js +38 -0
  183. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js +13 -0
  184. package/dist/scw/api.js +12 -0
  185. package/dist/scw/auth.js +68 -0
  186. package/dist/scw/client-ini-factory.js +174 -0
  187. package/dist/scw/client-ini-profile.js +54 -0
  188. package/dist/scw/client-settings.js +78 -0
  189. package/dist/scw/client.js +98 -0
  190. package/dist/scw/constants.js +4 -0
  191. package/dist/scw/custom-marshalling.js +131 -0
  192. package/dist/scw/errors/error-parser.js +107 -0
  193. package/dist/scw/errors/non-standard/invalid-request-mapper.js +36 -0
  194. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +27 -0
  195. package/dist/scw/errors/scw-error.js +66 -0
  196. package/dist/scw/errors/standard/already-exists-error.js +26 -0
  197. package/dist/scw/errors/standard/denied-authentication-error.js +52 -0
  198. package/dist/scw/errors/standard/index.js +13 -0
  199. package/dist/scw/errors/standard/invalid-arguments-error.js +67 -0
  200. package/dist/scw/errors/standard/out-of-stock-error.js +22 -0
  201. package/dist/scw/errors/standard/permissions-denied-error.js +48 -0
  202. package/dist/scw/errors/standard/precondition-failed-error.js +42 -0
  203. package/dist/scw/errors/standard/quotas-exceeded-error.js +68 -0
  204. package/dist/scw/errors/standard/resource-expired-error.js +26 -0
  205. package/dist/scw/errors/standard/resource-locked-error.js +25 -0
  206. package/dist/scw/errors/standard/resource-not-found-error.js +25 -0
  207. package/dist/scw/errors/standard/too-many-requests-error.js +70 -0
  208. package/dist/scw/errors/standard/transient-state-error.js +26 -0
  209. package/dist/scw/errors/types.js +23 -0
  210. package/dist/scw/fetch/build-fetcher.js +72 -0
  211. package/dist/scw/fetch/http-dumper.js +54 -0
  212. package/dist/scw/fetch/http-interceptors.js +99 -0
  213. package/dist/scw/fetch/resource-paginator.js +84 -0
  214. package/dist/scw/fetch/response-parser.js +72 -0
  215. package/package.json +2 -2
@@ -0,0 +1,454 @@
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 { CLUSTER_TRANSIENT_STATUSES, POOL_TRANSIENT_STATUSES, NODE_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { unmarshalListClustersResponse, marshalCreateClusterRequest, unmarshalCluster, marshalUpdateClusterRequest, marshalUpgradeClusterRequest, marshalSetClusterTypeRequest, unmarshalListClusterAvailableVersionsResponse, unmarshalListClusterAvailableTypesResponse, marshalMigrateToPrivateNetworkClusterRequest, unmarshalListPoolsResponse, marshalCreatePoolRequest, unmarshalPool, marshalUpgradePoolRequest, marshalUpdatePoolRequest, unmarshalExternalNode, unmarshalListNodesResponse, unmarshalNode, unmarshalListVersionsResponse, unmarshalVersion, unmarshalListClusterTypesResponse } 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
+ /** Kubernetes API. */
15
+ class API extends API$1 {
16
+ /** Lists the available regions of the API. */
17
+ static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
18
+ pageOfListClusters = (() => {
19
+ var _this = this;
20
+ return function (request) {
21
+ if (request === void 0) {
22
+ request = {};
23
+ }
24
+ return _this.client.fetch({
25
+ method: 'GET',
26
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/clusters`,
27
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['private_network_id', request.privateNetworkId], ['project_id', request.projectId], ['status', request.status], ['type', request.type])
28
+ }, unmarshalListClustersResponse);
29
+ };
30
+ })();
31
+
32
+ /**
33
+ * List Clusters. List all existing Kubernetes clusters in a specific region.
34
+ *
35
+ * @param request - The request {@link ListClustersRequest}
36
+ * @returns A Promise of ListClustersResponse
37
+ */
38
+ listClusters = (() => {
39
+ var _this2 = this;
40
+ return function (request) {
41
+ if (request === void 0) {
42
+ request = {};
43
+ }
44
+ return enrichForPagination('clusters', _this2.pageOfListClusters, request);
45
+ };
46
+ })();
47
+
48
+ /**
49
+ * Create a new Cluster. Create a new Kubernetes cluster in a Scaleway region.
50
+ *
51
+ * @param request - The request {@link CreateClusterRequest}
52
+ * @returns A Promise of Cluster
53
+ */
54
+ createCluster = request => this.client.fetch({
55
+ body: JSON.stringify(marshalCreateClusterRequest(request, this.client.settings)),
56
+ headers: jsonContentHeaders,
57
+ method: 'POST',
58
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters`
59
+ }, unmarshalCluster);
60
+
61
+ /**
62
+ * Get a Cluster. Retrieve information about a specific Kubernetes cluster.
63
+ *
64
+ * @param request - The request {@link GetClusterRequest}
65
+ * @returns A Promise of Cluster
66
+ */
67
+ getCluster = request => this.client.fetch({
68
+ method: 'GET',
69
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}`
70
+ }, unmarshalCluster);
71
+
72
+ /**
73
+ * Waits for {@link Cluster} to be in a final state.
74
+ *
75
+ * @param request - The request {@link GetClusterRequest}
76
+ * @param options - The waiting options
77
+ * @returns A Promise of Cluster
78
+ */
79
+ waitForCluster = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!CLUSTER_TRANSIENT_STATUSES.includes(res.status))), this.getCluster, request, options);
80
+
81
+ /**
82
+ * Update a Cluster. Update information on a specific Kubernetes cluster. You
83
+ * can update details such as its name, description, tags and configuration.
84
+ * To upgrade a cluster, you will need to use the dedicated endpoint.
85
+ *
86
+ * @param request - The request {@link UpdateClusterRequest}
87
+ * @returns A Promise of Cluster
88
+ */
89
+ updateCluster = request => this.client.fetch({
90
+ body: JSON.stringify(marshalUpdateClusterRequest(request, this.client.settings)),
91
+ headers: jsonContentHeaders,
92
+ method: 'PATCH',
93
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}`
94
+ }, unmarshalCluster);
95
+
96
+ /**
97
+ * Delete a Cluster. Delete a specific Kubernetes cluster and all its
98
+ * associated pools and nodes. Note that this method will not delete any Load
99
+ * Balancer or Block Volume that are associated with the cluster.
100
+ *
101
+ * @param request - The request {@link DeleteClusterRequest}
102
+ * @returns A Promise of Cluster
103
+ */
104
+ deleteCluster = request => this.client.fetch({
105
+ method: 'DELETE',
106
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}`,
107
+ urlParams: urlParams(['with_additional_resources', request.withAdditionalResources])
108
+ }, unmarshalCluster);
109
+
110
+ /**
111
+ * Upgrade a Cluster. Upgrade a specific Kubernetes cluster and possibly its
112
+ * associated pools to a specific and supported Kubernetes version.
113
+ *
114
+ * @param request - The request {@link UpgradeClusterRequest}
115
+ * @returns A Promise of Cluster
116
+ */
117
+ upgradeCluster = request => this.client.fetch({
118
+ body: JSON.stringify(marshalUpgradeClusterRequest(request, this.client.settings)),
119
+ headers: jsonContentHeaders,
120
+ method: 'POST',
121
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/upgrade`
122
+ }, unmarshalCluster);
123
+
124
+ /**
125
+ * Change the Cluster type. Change the type of a specific Kubernetes cluster.
126
+ * To see the possible values you can enter for the `type` field, [list
127
+ * available cluster
128
+ * types](#path-clusters-list-available-cluster-types-for-a-cluster).
129
+ *
130
+ * @param request - The request {@link SetClusterTypeRequest}
131
+ * @returns A Promise of Cluster
132
+ */
133
+ setClusterType = request => this.client.fetch({
134
+ body: JSON.stringify(marshalSetClusterTypeRequest(request, this.client.settings)),
135
+ headers: jsonContentHeaders,
136
+ method: 'POST',
137
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/set-type`
138
+ }, unmarshalCluster);
139
+
140
+ /**
141
+ * List available versions for a Cluster. List the versions that a specific
142
+ * Kubernetes cluster is allowed to upgrade to. Results will include every
143
+ * patch version greater than the current patch, as well as one minor version
144
+ * ahead of the current version. Any upgrade skipping a minor version will not
145
+ * work.
146
+ *
147
+ * @param request - The request {@link ListClusterAvailableVersionsRequest}
148
+ * @returns A Promise of ListClusterAvailableVersionsResponse
149
+ */
150
+ listClusterAvailableVersions = request => this.client.fetch({
151
+ method: 'GET',
152
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/available-versions`
153
+ }, unmarshalListClusterAvailableVersionsResponse);
154
+
155
+ /**
156
+ * List available cluster types for a cluster. List the cluster types that a
157
+ * specific Kubernetes cluster is allowed to switch to.
158
+ *
159
+ * @param request - The request {@link ListClusterAvailableTypesRequest}
160
+ * @returns A Promise of ListClusterAvailableTypesResponse
161
+ */
162
+ listClusterAvailableTypes = request => this.client.fetch({
163
+ method: 'GET',
164
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/available-types`
165
+ }, unmarshalListClusterAvailableTypesResponse);
166
+ _getClusterKubeConfig = request => this.client.fetch({
167
+ method: 'GET',
168
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/kubeconfig`,
169
+ urlParams: urlParams(['dl', 1]),
170
+ responseType: 'blob'
171
+ });
172
+
173
+ /**
174
+ * Reset the admin token of a Cluster. Reset the admin token for a specific
175
+ * Kubernetes cluster. This will revoke the old admin token (which will not be
176
+ * usable afterwards) and create a new one. Note that you will need to
177
+ * download kubeconfig again to keep interacting with the cluster.
178
+ *
179
+ * @param request - The request {@link ResetClusterAdminTokenRequest}
180
+ */
181
+ resetClusterAdminToken = request => this.client.fetch({
182
+ body: '{}',
183
+ headers: jsonContentHeaders,
184
+ method: 'POST',
185
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/reset-admin-token`
186
+ });
187
+
188
+ /**
189
+ * Migrate an existing cluster to a Private Network cluster. Migrate a cluster
190
+ * that was created before the release of Private Network clusters to a new
191
+ * one with a Private Network.
192
+ *
193
+ * @param request - The request {@link MigrateToPrivateNetworkClusterRequest}
194
+ * @returns A Promise of Cluster
195
+ */
196
+ migrateToPrivateNetworkCluster = request => this.client.fetch({
197
+ body: JSON.stringify(marshalMigrateToPrivateNetworkClusterRequest(request, this.client.settings)),
198
+ headers: jsonContentHeaders,
199
+ method: 'POST',
200
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/migrate-to-private-network`
201
+ }, unmarshalCluster);
202
+ pageOfListPools = request => this.client.fetch({
203
+ method: 'GET',
204
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/pools`,
205
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['status', request.status])
206
+ }, unmarshalListPoolsResponse);
207
+
208
+ /**
209
+ * List Pools in a Cluster. List all the existing pools for a specific
210
+ * Kubernetes cluster.
211
+ *
212
+ * @param request - The request {@link ListPoolsRequest}
213
+ * @returns A Promise of ListPoolsResponse
214
+ */
215
+ listPools = request => enrichForPagination('pools', this.pageOfListPools, request);
216
+
217
+ /**
218
+ * Create a new Pool in a Cluster. Create a new pool in a specific Kubernetes
219
+ * cluster.
220
+ *
221
+ * @param request - The request {@link CreatePoolRequest}
222
+ * @returns A Promise of Pool
223
+ */
224
+ createPool = request => this.client.fetch({
225
+ body: JSON.stringify(marshalCreatePoolRequest(request, this.client.settings)),
226
+ headers: jsonContentHeaders,
227
+ method: 'POST',
228
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/pools`
229
+ }, unmarshalPool);
230
+
231
+ /**
232
+ * Get a Pool in a Cluster. Retrieve details about a specific pool in a
233
+ * Kubernetes cluster.
234
+ *
235
+ * @param request - The request {@link GetPoolRequest}
236
+ * @returns A Promise of Pool
237
+ */
238
+ getPool = request => this.client.fetch({
239
+ method: 'GET',
240
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam('poolId', request.poolId)}`
241
+ }, unmarshalPool);
242
+
243
+ /**
244
+ * Waits for {@link Pool} to be in a final state.
245
+ *
246
+ * @param request - The request {@link GetPoolRequest}
247
+ * @param options - The waiting options
248
+ * @returns A Promise of Pool
249
+ */
250
+ waitForPool = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!POOL_TRANSIENT_STATUSES.includes(res.status))), this.getPool, request, options);
251
+
252
+ /**
253
+ * Upgrade a Pool in a Cluster. Upgrade the Kubernetes version of a specific
254
+ * pool. Note that it only works if the targeted version matches the cluster's
255
+ * version.
256
+ *
257
+ * @param request - The request {@link UpgradePoolRequest}
258
+ * @returns A Promise of Pool
259
+ */
260
+ upgradePool = request => this.client.fetch({
261
+ body: JSON.stringify(marshalUpgradePoolRequest(request, this.client.settings)),
262
+ headers: jsonContentHeaders,
263
+ method: 'POST',
264
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam('poolId', request.poolId)}/upgrade`
265
+ }, unmarshalPool);
266
+
267
+ /**
268
+ * Update a Pool in a Cluster. Update the attributes of a specific pool, such
269
+ * as its desired size, autoscaling settings, and tags.
270
+ *
271
+ * @param request - The request {@link UpdatePoolRequest}
272
+ * @returns A Promise of Pool
273
+ */
274
+ updatePool = request => this.client.fetch({
275
+ body: JSON.stringify(marshalUpdatePoolRequest(request, this.client.settings)),
276
+ headers: jsonContentHeaders,
277
+ method: 'PATCH',
278
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam('poolId', request.poolId)}`
279
+ }, unmarshalPool);
280
+
281
+ /**
282
+ * Delete a Pool in a Cluster. Delete a specific pool from a cluster. Note
283
+ * that all the pool's nodes will also be deleted.
284
+ *
285
+ * @param request - The request {@link DeletePoolRequest}
286
+ * @returns A Promise of Pool
287
+ */
288
+ deletePool = request => this.client.fetch({
289
+ method: 'DELETE',
290
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam('poolId', request.poolId)}`
291
+ }, unmarshalPool);
292
+
293
+ /**
294
+ * Create a Kosmos node. Retrieve metadata for a Kosmos node. This method is
295
+ * not intended to be called by end users but rather programmatically by the
296
+ * kapsule-node-agent.
297
+ *
298
+ * @param request - The request {@link CreateExternalNodeRequest}
299
+ * @returns A Promise of ExternalNode
300
+ */
301
+ createExternalNode = request => this.client.fetch({
302
+ body: '{}',
303
+ headers: jsonContentHeaders,
304
+ method: 'POST',
305
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam('poolId', request.poolId)}/external-nodes`
306
+ }, unmarshalExternalNode);
307
+ pageOfListNodes = request => this.client.fetch({
308
+ method: 'GET',
309
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/nodes`,
310
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['pool_id', request.poolId], ['status', request.status])
311
+ }, unmarshalListNodesResponse);
312
+
313
+ /**
314
+ * List Nodes in a Cluster. List all the existing nodes for a specific
315
+ * Kubernetes cluster.
316
+ *
317
+ * @param request - The request {@link ListNodesRequest}
318
+ * @returns A Promise of ListNodesResponse
319
+ */
320
+ listNodes = request => enrichForPagination('nodes', this.pageOfListNodes, request);
321
+
322
+ /**
323
+ * Get a Node in a Cluster. Retrieve details about a specific Kubernetes Node.
324
+ *
325
+ * @param request - The request {@link GetNodeRequest}
326
+ * @returns A Promise of Node
327
+ */
328
+ getNode = request => this.client.fetch({
329
+ method: 'GET',
330
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam('nodeId', request.nodeId)}`
331
+ }, unmarshalNode);
332
+
333
+ /**
334
+ * Waits for {@link Node} to be in a final state.
335
+ *
336
+ * @param request - The request {@link GetNodeRequest}
337
+ * @param options - The waiting options
338
+ * @returns A Promise of Node
339
+ */
340
+ waitForNode = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!NODE_TRANSIENT_STATUSES.includes(res.status))), this.getNode, request, options);
341
+
342
+ /**
343
+ * Replace a Node in a Cluster. Replace a specific Node. The node will first
344
+ * be cordoned (scheduling will be disabled on it). The existing pods on the
345
+ * node will then be drained and rescheduled onto another schedulable node.
346
+ * Note that when there is not enough space to reschedule all the pods (such
347
+ * as in a one-node cluster), disruption of your applications can be
348
+ * expected.
349
+ *
350
+ * @deprecated
351
+ * @param request - The request {@link ReplaceNodeRequest}
352
+ * @returns A Promise of Node
353
+ */
354
+ replaceNode = request => this.client.fetch({
355
+ body: '{}',
356
+ headers: jsonContentHeaders,
357
+ method: 'POST',
358
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam('nodeId', request.nodeId)}/replace`
359
+ }, unmarshalNode);
360
+
361
+ /**
362
+ * Reboot a Node in a Cluster. Reboot a specific Node. The node will first be
363
+ * cordoned (scheduling will be disabled on it). The existing pods on the node
364
+ * will then be drained and rescheduled onto another schedulable node. Note
365
+ * that when there is not enough space to reschedule all the pods (such as in
366
+ * a one-node cluster), disruption of your applications can be expected.
367
+ *
368
+ * @param request - The request {@link RebootNodeRequest}
369
+ * @returns A Promise of Node
370
+ */
371
+ rebootNode = request => this.client.fetch({
372
+ body: '{}',
373
+ headers: jsonContentHeaders,
374
+ method: 'POST',
375
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam('nodeId', request.nodeId)}/reboot`
376
+ }, unmarshalNode);
377
+
378
+ /**
379
+ * Delete a Node in a Cluster. Delete a specific Node. Note that when there is
380
+ * not enough space to reschedule all the pods (such as in a one-node
381
+ * cluster), disruption of your applications can be expected.
382
+ *
383
+ * @param request - The request {@link DeleteNodeRequest}
384
+ * @returns A Promise of Node
385
+ */
386
+ deleteNode = request => this.client.fetch({
387
+ method: 'DELETE',
388
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam('nodeId', request.nodeId)}`,
389
+ urlParams: urlParams(['replace', request.replace], ['skip_drain', request.skipDrain])
390
+ }, unmarshalNode);
391
+
392
+ /**
393
+ * List all available Versions. List all available versions for the creation
394
+ * of a new Kubernetes cluster.
395
+ *
396
+ * @param request - The request {@link ListVersionsRequest}
397
+ * @returns A Promise of ListVersionsResponse
398
+ */
399
+ listVersions = (() => {
400
+ var _this3 = this;
401
+ return function (request) {
402
+ if (request === void 0) {
403
+ request = {};
404
+ }
405
+ return _this3.client.fetch({
406
+ method: 'GET',
407
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/versions`
408
+ }, unmarshalListVersionsResponse);
409
+ };
410
+ })();
411
+
412
+ /**
413
+ * Get a Version. Retrieve a specific Kubernetes version and its details.
414
+ *
415
+ * @param request - The request {@link GetVersionRequest}
416
+ * @returns A Promise of Version
417
+ */
418
+ getVersion = request => this.client.fetch({
419
+ method: 'GET',
420
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/versions/${validatePathParam('versionName', request.versionName)}`
421
+ }, unmarshalVersion);
422
+ pageOfListClusterTypes = (() => {
423
+ var _this4 = this;
424
+ return function (request) {
425
+ if (request === void 0) {
426
+ request = {};
427
+ }
428
+ return _this4.client.fetch({
429
+ method: 'GET',
430
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? _this4.client.settings.defaultRegion)}/cluster-types`,
431
+ urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this4.client.settings.defaultPageSize])
432
+ }, unmarshalListClusterTypesResponse);
433
+ };
434
+ })();
435
+
436
+ /**
437
+ * List cluster types. List available cluster types and their technical
438
+ * details.
439
+ *
440
+ * @param request - The request {@link ListClusterTypesRequest}
441
+ * @returns A Promise of ListClusterTypesResponse
442
+ */
443
+ listClusterTypes = (() => {
444
+ var _this5 = this;
445
+ return function (request) {
446
+ if (request === void 0) {
447
+ request = {};
448
+ }
449
+ return enrichForPagination('clusterTypes', _this5.pageOfListClusterTypes, request);
450
+ };
451
+ })();
452
+ }
453
+
454
+ export { API };
@@ -0,0 +1,13 @@
1
+ import { API } from './api.gen.js';
2
+
3
+ class K8SUtilsAPI extends API {
4
+ /**
5
+ * Get configuration of a kube cluster.
6
+ *
7
+ * @param request - The request {@link GetClusterKubeConfigRequest}
8
+ * @returns A Promise of Blob
9
+ */
10
+ getClusterKubeConfig = request => this._getClusterKubeConfig(request);
11
+ }
12
+
13
+ export { K8SUtilsAPI };
@@ -0,0 +1,13 @@
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 ClusterStatus}. */
5
+ const CLUSTER_TRANSIENT_STATUSES = ['creating', 'deleting', 'updating'];
6
+
7
+ /** Lists transient statutes of the enum {@link NodeStatus}. */
8
+ const NODE_TRANSIENT_STATUSES = ['creating', 'deleting', 'rebooting', 'upgrading', 'starting', 'registering'];
9
+
10
+ /** Lists transient statutes of the enum {@link PoolStatus}. */
11
+ const POOL_TRANSIENT_STATUSES = ['deleting', 'scaling', 'upgrading'];
12
+
13
+ export { CLUSTER_TRANSIENT_STATUSES, NODE_TRANSIENT_STATUSES, POOL_TRANSIENT_STATUSES };
@@ -0,0 +1,4 @@
1
+ export { K8SUtilsAPI as API } from './api.utils.js';
2
+ export { CLUSTER_TRANSIENT_STATUSES, NODE_TRANSIENT_STATUSES, POOL_TRANSIENT_STATUSES } from './content.gen.js';
3
+ import * as validationRules_gen from './validation-rules.gen.js';
4
+ export { validationRules_gen as ValidationRules };