@scaleway/sdk-k8s 2.9.0 → 2.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,438 +2,214 @@ import { CLUSTER_TRANSIENT_STATUSES, NODE_TRANSIENT_STATUSES, POOL_TRANSIENT_STA
2
2
  import { marshalAddClusterACLRulesRequest, marshalCreateClusterRequest, marshalCreatePoolRequest, marshalSetClusterACLRulesRequest, marshalSetClusterTypeRequest, marshalSetPoolLabelsRequest, marshalSetPoolStartupTaintsRequest, marshalSetPoolTaintsRequest, marshalUpdateClusterRequest, marshalUpdatePoolRequest, marshalUpgradeClusterRequest, marshalUpgradePoolRequest, unmarshalAddClusterACLRulesResponse, unmarshalCluster, unmarshalExternalNode, unmarshalExternalNodeAuth, unmarshalListClusterACLRulesResponse, unmarshalListClusterAvailableTypesResponse, unmarshalListClusterAvailableVersionsResponse, unmarshalListClusterTypesResponse, unmarshalListClustersResponse, unmarshalListNodesResponse, unmarshalListPoolsResponse, unmarshalListVersionsResponse, unmarshalNode, unmarshalNodeMetadata, unmarshalPool, unmarshalSetClusterACLRulesResponse, unmarshalVersion } from "./marshalling.gen.js";
3
3
  import { API as API$1, enrichForPagination, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
4
  //#region src/v1/api.gen.ts
5
- var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ const jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
6
6
  /**
7
7
  * Kubernetes API.
8
8
 
9
9
  This API allows you to manage Kubernetes Kapsule and Kosmos clusters.
10
10
  */
11
11
  var API = class extends API$1 {
12
- /**
13
- * Locality of this API.
14
- * type {'zone','region','global','unspecified'}
15
- */
16
- static LOCALITY = toApiLocality({ regions: [
17
- "fr-par",
18
- "nl-ams",
19
- "pl-waw"
20
- ] });
21
- pageOfListClusters = (request = {}) => this.client.fetch({
22
- method: "GET",
23
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters`,
24
- 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])
25
- }, unmarshalListClustersResponse);
26
- /**
27
- * List Clusters. List all existing Kubernetes clusters in a specific region.
28
- *
29
- * @param request - The request {@link ListClustersRequest}
30
- * @returns A Promise of ListClustersResponse
31
- */
32
- listClusters = (request = {}) => enrichForPagination("clusters", this.pageOfListClusters, request);
33
- /**
34
- * Create a new Cluster. Create a new Kubernetes cluster in a Scaleway region.
35
- *
36
- * @param request - The request {@link CreateClusterRequest}
37
- * @returns A Promise of Cluster
38
- */
39
- createCluster = (request) => this.client.fetch({
40
- body: JSON.stringify(marshalCreateClusterRequest(request, this.client.settings)),
41
- headers: jsonContentHeaders,
42
- method: "POST",
43
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters`
44
- }, unmarshalCluster);
45
- /**
46
- * Get a Cluster. Retrieve information about a specific Kubernetes cluster.
47
- *
48
- * @param request - The request {@link GetClusterRequest}
49
- * @returns A Promise of Cluster
50
- */
51
- getCluster = (request) => this.client.fetch({
52
- method: "GET",
53
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
54
- }, unmarshalCluster);
55
- /**
56
- * Waits for {@link Cluster} to be in a final state.
57
- *
58
- * @param request - The request {@link GetClusterRequest}
59
- * @param options - The waiting options
60
- * @returns A Promise of Cluster
61
- */
62
- waitForCluster = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!CLUSTER_TRANSIENT_STATUSES.includes(res.status))), this.getCluster, request, options);
63
- /**
64
- * Update a Cluster. Update information on a specific Kubernetes cluster. You can update details such as its name, description, tags and configuration. To upgrade a cluster, you will need to use the dedicated endpoint.
65
- *
66
- * @param request - The request {@link UpdateClusterRequest}
67
- * @returns A Promise of Cluster
68
- */
69
- updateCluster = (request) => this.client.fetch({
70
- body: JSON.stringify(marshalUpdateClusterRequest(request, this.client.settings)),
71
- headers: jsonContentHeaders,
72
- method: "PATCH",
73
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
74
- }, unmarshalCluster);
75
- /**
76
- * Delete a Cluster. Delete a specific Kubernetes cluster and all its associated pools and nodes, and possibly its associated Load Balancers or Block Volumes.
77
- *
78
- * @param request - The request {@link DeleteClusterRequest}
79
- * @returns A Promise of Cluster
80
- */
81
- deleteCluster = (request) => this.client.fetch({
82
- method: "DELETE",
83
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`,
84
- urlParams: urlParams(["with_additional_resources", request.withAdditionalResources])
85
- }, unmarshalCluster);
86
- /**
87
- * Upgrade a Cluster. Upgrade a specific Kubernetes cluster and possibly its associated pools to a specific and supported Kubernetes version.
88
- *
89
- * @param request - The request {@link UpgradeClusterRequest}
90
- * @returns A Promise of Cluster
91
- */
92
- upgradeCluster = (request) => this.client.fetch({
93
- body: JSON.stringify(marshalUpgradeClusterRequest(request, this.client.settings)),
94
- headers: jsonContentHeaders,
95
- method: "POST",
96
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/upgrade`
97
- }, unmarshalCluster);
98
- /**
99
- * Change the Cluster type. Change the type of a specific Kubernetes cluster. To see the possible values you can enter for the `type` field, [list available cluster types](#list-available-cluster-types-for-a-cluster).
100
- *
101
- * @param request - The request {@link SetClusterTypeRequest}
102
- * @returns A Promise of Cluster
103
- */
104
- setClusterType = (request) => this.client.fetch({
105
- body: JSON.stringify(marshalSetClusterTypeRequest(request, this.client.settings)),
106
- headers: jsonContentHeaders,
107
- method: "POST",
108
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/set-type`
109
- }, unmarshalCluster);
110
- /**
111
- * List available versions for a Cluster. List the versions that a specific Kubernetes cluster is allowed to upgrade to. Results will include every patch version greater than the current patch, as well as one minor version ahead of the current version. Any upgrade skipping a minor version will not work.
112
- *
113
- * @param request - The request {@link ListClusterAvailableVersionsRequest}
114
- * @returns A Promise of ListClusterAvailableVersionsResponse
115
- */
116
- listClusterAvailableVersions = (request) => this.client.fetch({
117
- method: "GET",
118
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/available-versions`
119
- }, unmarshalListClusterAvailableVersionsResponse);
120
- /**
121
- * List available cluster types for a cluster. List the cluster types that a specific Kubernetes cluster is allowed to switch to.
122
- *
123
- * @param request - The request {@link ListClusterAvailableTypesRequest}
124
- * @returns A Promise of ListClusterAvailableTypesResponse
125
- */
126
- listClusterAvailableTypes = (request) => this.client.fetch({
127
- method: "GET",
128
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/available-types`
129
- }, unmarshalListClusterAvailableTypesResponse);
130
- _getClusterKubeConfig = (request) => this.client.fetch({
131
- method: "GET",
132
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/kubeconfig`,
133
- urlParams: urlParams(["dl", 1], ["redacted", request.redacted]),
134
- responseType: "blob"
135
- });
136
- /**
137
- * Reset the admin token of a Cluster. Reset the admin token for a specific Kubernetes cluster. This will revoke the old admin token (which will not be usable afterwards) and create a new one. Note that you will need to download the kubeconfig again to keep interacting with the cluster.
138
- *
139
- * @param request - The request {@link ResetClusterAdminTokenRequest}
140
- */
141
- resetClusterAdminToken = (request) => this.client.fetch({
142
- body: "{}",
143
- headers: jsonContentHeaders,
144
- method: "POST",
145
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/reset-admin-token`
146
- });
147
- pageOfListClusterACLRules = (request) => this.client.fetch({
148
- method: "GET",
149
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`,
150
- urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
151
- }, unmarshalListClusterACLRulesResponse);
152
- /**
153
- * List ACLs. List ACLs for a specific cluster.
154
- *
155
- * @param request - The request {@link ListClusterACLRulesRequest}
156
- * @returns A Promise of ListClusterACLRulesResponse
157
- */
158
- listClusterACLRules = (request) => enrichForPagination("rules", this.pageOfListClusterACLRules, request);
159
- /**
160
- * Add new ACLs. Add new ACL rules for a specific cluster.
161
- *
162
- * @param request - The request {@link AddClusterACLRulesRequest}
163
- * @returns A Promise of AddClusterACLRulesResponse
164
- */
165
- addClusterACLRules = (request) => this.client.fetch({
166
- body: JSON.stringify(marshalAddClusterACLRulesRequest(request, this.client.settings)),
167
- headers: jsonContentHeaders,
168
- method: "POST",
169
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
170
- }, unmarshalAddClusterACLRulesResponse);
171
- /**
172
- * Set new ACLs. Set new ACL rules for a specific cluster.
173
- *
174
- * @param request - The request {@link SetClusterACLRulesRequest}
175
- * @returns A Promise of SetClusterACLRulesResponse
176
- */
177
- setClusterACLRules = (request) => this.client.fetch({
178
- body: JSON.stringify(marshalSetClusterACLRulesRequest(request, this.client.settings)),
179
- headers: jsonContentHeaders,
180
- method: "PUT",
181
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
182
- }, unmarshalSetClusterACLRulesResponse);
183
- /**
184
- * Delete an existing ACL.
185
- *
186
- * @param request - The request {@link DeleteACLRuleRequest}
187
- */
188
- deleteACLRule = (request) => this.client.fetch({
189
- method: "DELETE",
190
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/acls/${validatePathParam("aclId", request.aclId)}`
191
- });
192
- pageOfListPools = (request) => this.client.fetch({
193
- method: "GET",
194
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/pools`,
195
- urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["status", request.status])
196
- }, unmarshalListPoolsResponse);
197
- /**
198
- * List Pools in a Cluster. List all the existing pools for a specific Kubernetes cluster.
199
- *
200
- * @param request - The request {@link ListPoolsRequest}
201
- * @returns A Promise of ListPoolsResponse
202
- */
203
- listPools = (request) => enrichForPagination("pools", this.pageOfListPools, request);
204
- /**
205
- * Create a new Pool in a Cluster. Create a new pool in a specific Kubernetes cluster.
206
- *
207
- * @param request - The request {@link CreatePoolRequest}
208
- * @returns A Promise of Pool
209
- */
210
- createPool = (request) => this.client.fetch({
211
- body: JSON.stringify(marshalCreatePoolRequest(request, this.client.settings)),
212
- headers: jsonContentHeaders,
213
- method: "POST",
214
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/pools`
215
- }, unmarshalPool);
216
- /**
217
- * Get a Pool in a Cluster. Retrieve details about a specific pool in a Kubernetes cluster.
218
- *
219
- * @param request - The request {@link GetPoolRequest}
220
- * @returns A Promise of Pool
221
- */
222
- getPool = (request) => this.client.fetch({
223
- method: "GET",
224
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
225
- }, unmarshalPool);
226
- /**
227
- * Waits for {@link Pool} to be in a final state.
228
- *
229
- * @param request - The request {@link GetPoolRequest}
230
- * @param options - The waiting options
231
- * @returns A Promise of Pool
232
- */
233
- waitForPool = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!POOL_TRANSIENT_STATUSES.includes(res.status))), this.getPool, request, options);
234
- /**
235
- * Upgrade a Pool in a Cluster. Upgrade the Kubernetes version of a specific pool. Note that it only works if the targeted version matches the cluster's version.
236
- This will drain and replace the nodes in that pool.
237
- *
238
- * @param request - The request {@link UpgradePoolRequest}
239
- * @returns A Promise of Pool
240
- */
241
- upgradePool = (request) => this.client.fetch({
242
- body: JSON.stringify(marshalUpgradePoolRequest(request, this.client.settings)),
243
- headers: jsonContentHeaders,
244
- method: "POST",
245
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/upgrade`
246
- }, unmarshalPool);
247
- /**
248
- * Update a Pool in a Cluster. Update the attributes of a specific pool, such as its desired size, autoscaling settings, and tags. To upgrade a pool, you will need to use the dedicated endpoint.
249
- *
250
- * @param request - The request {@link UpdatePoolRequest}
251
- * @returns A Promise of Pool
252
- */
253
- updatePool = (request) => this.client.fetch({
254
- body: JSON.stringify(marshalUpdatePoolRequest(request, this.client.settings)),
255
- headers: jsonContentHeaders,
256
- method: "PATCH",
257
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
258
- }, unmarshalPool);
259
- /**
260
- * Delete a Pool in a Cluster. Delete a specific pool from a cluster. Note that all the pool's nodes will also be deleted.
261
- *
262
- * @param request - The request {@link DeletePoolRequest}
263
- * @returns A Promise of Pool
264
- */
265
- deletePool = (request) => this.client.fetch({
266
- method: "DELETE",
267
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
268
- }, unmarshalPool);
269
- /**
270
- * Set a list of taints for a specific pool. Apply a list of taints to all nodes of the pool which will be periodically reconciled by scaleway.
271
- *
272
- * @param request - The request {@link SetPoolTaintsRequest}
273
- * @returns A Promise of Pool
274
- */
275
- setPoolTaints = (request) => this.client.fetch({
276
- body: JSON.stringify(marshalSetPoolTaintsRequest(request, this.client.settings)),
277
- headers: jsonContentHeaders,
278
- method: "PUT",
279
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-taints`
280
- }, unmarshalPool);
281
- /**
282
- * Set a list of startup taints for a specific pool. Apply a list of taints to new nodes of the pool which would not be reconciled by scaleway.
283
- *
284
- * @param request - The request {@link SetPoolStartupTaintsRequest}
285
- * @returns A Promise of Pool
286
- */
287
- setPoolStartupTaints = (request) => this.client.fetch({
288
- body: JSON.stringify(marshalSetPoolStartupTaintsRequest(request, this.client.settings)),
289
- headers: jsonContentHeaders,
290
- method: "PUT",
291
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-startup-taints`
292
- }, unmarshalPool);
293
- /**
294
- * Set a list of labels for a specific pool. Apply a list of taints to all nodes of the pool (only apply to labels which was set through scaleway api).
295
- *
296
- * @param request - The request {@link SetPoolLabelsRequest}
297
- * @returns A Promise of Pool
298
- */
299
- setPoolLabels = (request) => this.client.fetch({
300
- body: JSON.stringify(marshalSetPoolLabelsRequest(request, this.client.settings)),
301
- headers: jsonContentHeaders,
302
- method: "PUT",
303
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-labels`
304
- }, unmarshalPool);
305
- /**
306
- * Fetch node metadata. Rerieve metadata to instantiate a Kapsule/Kosmos node. This method is not intended to be called by end users but rather programmatically by the node-installer.
307
- *
308
- * @param request - The request {@link GetNodeMetadataRequest}
309
- * @returns A Promise of NodeMetadata
310
- */
311
- getNodeMetadata = (request = {}) => this.client.fetch({
312
- method: "GET",
313
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/node-metadata`
314
- }, unmarshalNodeMetadata);
315
- /**
316
- * Authenticate Kosmos external node. Creates a newer Kosmos node and returns its token. This method is not intended to be called by end users but rather programmatically by the node-installer.
317
- *
318
- * @param request - The request {@link AuthExternalNodeRequest}
319
- * @returns A Promise of ExternalNodeAuth
320
- */
321
- authExternalNode = (request) => this.client.fetch({
322
- body: "{}",
323
- headers: jsonContentHeaders,
324
- method: "POST",
325
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/external-nodes/auth`
326
- }, unmarshalExternalNodeAuth);
327
- /**
328
- * Create a Kosmos node. Retrieve metadata for a Kosmos node. This method is not intended to be called by end users but rather programmatically by the kapsule-node-agent.
329
- *
330
- * @param request - The request {@link CreateExternalNodeRequest}
331
- * @returns A Promise of ExternalNode
332
- */
333
- createExternalNode = (request) => this.client.fetch({
334
- body: "{}",
335
- headers: jsonContentHeaders,
336
- method: "POST",
337
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/external-nodes`
338
- }, unmarshalExternalNode);
339
- pageOfListNodes = (request) => this.client.fetch({
340
- method: "GET",
341
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/nodes`,
342
- 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])
343
- }, unmarshalListNodesResponse);
344
- /**
345
- * List Nodes in a Cluster. List all the existing nodes for a specific Kubernetes cluster.
346
- *
347
- * @param request - The request {@link ListNodesRequest}
348
- * @returns A Promise of ListNodesResponse
349
- */
350
- listNodes = (request) => enrichForPagination("nodes", this.pageOfListNodes, request);
351
- /**
352
- * Get a Node in a Cluster. Retrieve details about a specific Kubernetes Node.
353
- *
354
- * @param request - The request {@link GetNodeRequest}
355
- * @returns A Promise of Node
356
- */
357
- getNode = (request) => this.client.fetch({
358
- method: "GET",
359
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}`
360
- }, unmarshalNode);
361
- /**
362
- * Waits for {@link Node} to be in a final state.
363
- *
364
- * @param request - The request {@link GetNodeRequest}
365
- * @param options - The waiting options
366
- * @returns A Promise of Node
367
- */
368
- waitForNode = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!NODE_TRANSIENT_STATUSES.includes(res.status))), this.getNode, request, options);
369
- /**
370
- * Replace a Node in a Cluster. Replace a specific Node. The node will first be drained and pods will be rescheduled onto another node. Note that when there is not enough space to reschedule all the pods (such as in a one-node cluster, or with specific constraints), disruption of your applications may occur.
371
- *
372
- * @deprecated
373
- * @param request - The request {@link ReplaceNodeRequest}
374
- * @returns A Promise of Node
375
- */
376
- replaceNode = (request) => this.client.fetch({
377
- body: "{}",
378
- headers: jsonContentHeaders,
379
- method: "POST",
380
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}/replace`
381
- }, unmarshalNode);
382
- /**
383
- * Reboot a Node in a Cluster. Reboot a specific Node. The node will first be drained and pods will be rescheduled onto another node. Note that when there is not enough space to reschedule all the pods (such as in a one-node cluster, or with specific constraints), disruption of your applications may occur.
384
- *
385
- * @param request - The request {@link RebootNodeRequest}
386
- * @returns A Promise of Node
387
- */
388
- rebootNode = (request) => this.client.fetch({
389
- body: "{}",
390
- headers: jsonContentHeaders,
391
- method: "POST",
392
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}/reboot`
393
- }, unmarshalNode);
394
- /**
395
- * Delete a Node in a Cluster. Delete a specific Node. The node will first be drained and pods will be rescheduled onto another node. Note that when there is not enough space to reschedule all the pods (such as in a one-node cluster, or with specific constraints), disruption of your applications may occur.
396
- *
397
- * @param request - The request {@link DeleteNodeRequest}
398
- * @returns A Promise of Node
399
- */
400
- deleteNode = (request) => this.client.fetch({
401
- method: "DELETE",
402
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}`,
403
- urlParams: urlParams(["replace", request.replace], ["skip_drain", request.skipDrain])
404
- }, unmarshalNode);
405
- /**
406
- * List all available Versions. List all available versions for the creation of a new Kubernetes cluster.
407
- *
408
- * @param request - The request {@link ListVersionsRequest}
409
- * @returns A Promise of ListVersionsResponse
410
- */
411
- listVersions = (request = {}) => this.client.fetch({
412
- method: "GET",
413
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions`
414
- }, unmarshalListVersionsResponse);
415
- /**
416
- * Get a Version. Retrieve a specific Kubernetes version and its details.
417
- *
418
- * @param request - The request {@link GetVersionRequest}
419
- * @returns A Promise of Version
420
- */
421
- getVersion = (request) => this.client.fetch({
422
- method: "GET",
423
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions/${validatePathParam("versionName", request.versionName)}`
424
- }, unmarshalVersion);
425
- pageOfListClusterTypes = (request = {}) => this.client.fetch({
426
- method: "GET",
427
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/cluster-types`,
428
- urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
429
- }, unmarshalListClusterTypesResponse);
430
- /**
431
- * List cluster types. List available cluster types and their technical details.
432
- *
433
- * @param request - The request {@link ListClusterTypesRequest}
434
- * @returns A Promise of ListClusterTypesResponse
435
- */
436
- listClusterTypes = (request = {}) => enrichForPagination("clusterTypes", this.pageOfListClusterTypes, request);
12
+ constructor(..._args) {
13
+ super(..._args);
14
+ this.pageOfListClusters = (request = {}) => this.client.fetch({
15
+ method: "GET",
16
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters`,
17
+ 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])
18
+ }, unmarshalListClustersResponse);
19
+ this.listClusters = (request = {}) => enrichForPagination("clusters", this.pageOfListClusters, request);
20
+ this.createCluster = (request) => this.client.fetch({
21
+ body: JSON.stringify(marshalCreateClusterRequest(request, this.client.settings)),
22
+ headers: jsonContentHeaders,
23
+ method: "POST",
24
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters`
25
+ }, unmarshalCluster);
26
+ this.getCluster = (request) => this.client.fetch({
27
+ method: "GET",
28
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
29
+ }, unmarshalCluster);
30
+ this.waitForCluster = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!CLUSTER_TRANSIENT_STATUSES.includes(res.status))), this.getCluster, request, options);
31
+ this.updateCluster = (request) => this.client.fetch({
32
+ body: JSON.stringify(marshalUpdateClusterRequest(request, this.client.settings)),
33
+ headers: jsonContentHeaders,
34
+ method: "PATCH",
35
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
36
+ }, unmarshalCluster);
37
+ this.deleteCluster = (request) => this.client.fetch({
38
+ method: "DELETE",
39
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`,
40
+ urlParams: urlParams(["with_additional_resources", request.withAdditionalResources])
41
+ }, unmarshalCluster);
42
+ this.upgradeCluster = (request) => this.client.fetch({
43
+ body: JSON.stringify(marshalUpgradeClusterRequest(request, this.client.settings)),
44
+ headers: jsonContentHeaders,
45
+ method: "POST",
46
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/upgrade`
47
+ }, unmarshalCluster);
48
+ this.setClusterType = (request) => this.client.fetch({
49
+ body: JSON.stringify(marshalSetClusterTypeRequest(request, this.client.settings)),
50
+ headers: jsonContentHeaders,
51
+ method: "POST",
52
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/set-type`
53
+ }, unmarshalCluster);
54
+ this.listClusterAvailableVersions = (request) => this.client.fetch({
55
+ method: "GET",
56
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/available-versions`
57
+ }, unmarshalListClusterAvailableVersionsResponse);
58
+ this.listClusterAvailableTypes = (request) => this.client.fetch({
59
+ method: "GET",
60
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/available-types`
61
+ }, unmarshalListClusterAvailableTypesResponse);
62
+ this._getClusterKubeConfig = (request) => this.client.fetch({
63
+ method: "GET",
64
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/kubeconfig`,
65
+ urlParams: urlParams(["dl", 1], ["redacted", request.redacted]),
66
+ responseType: "blob"
67
+ });
68
+ this.resetClusterAdminToken = (request) => this.client.fetch({
69
+ body: "{}",
70
+ headers: jsonContentHeaders,
71
+ method: "POST",
72
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/reset-admin-token`
73
+ });
74
+ this.pageOfListClusterACLRules = (request) => this.client.fetch({
75
+ method: "GET",
76
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`,
77
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
78
+ }, unmarshalListClusterACLRulesResponse);
79
+ this.listClusterACLRules = (request) => enrichForPagination("rules", this.pageOfListClusterACLRules, request);
80
+ this.addClusterACLRules = (request) => this.client.fetch({
81
+ body: JSON.stringify(marshalAddClusterACLRulesRequest(request, this.client.settings)),
82
+ headers: jsonContentHeaders,
83
+ method: "POST",
84
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
85
+ }, unmarshalAddClusterACLRulesResponse);
86
+ this.setClusterACLRules = (request) => this.client.fetch({
87
+ body: JSON.stringify(marshalSetClusterACLRulesRequest(request, this.client.settings)),
88
+ headers: jsonContentHeaders,
89
+ method: "PUT",
90
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
91
+ }, unmarshalSetClusterACLRulesResponse);
92
+ this.deleteACLRule = (request) => this.client.fetch({
93
+ method: "DELETE",
94
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/acls/${validatePathParam("aclId", request.aclId)}`
95
+ });
96
+ this.pageOfListPools = (request) => this.client.fetch({
97
+ method: "GET",
98
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/pools`,
99
+ urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["status", request.status])
100
+ }, unmarshalListPoolsResponse);
101
+ this.listPools = (request) => enrichForPagination("pools", this.pageOfListPools, request);
102
+ this.createPool = (request) => this.client.fetch({
103
+ body: JSON.stringify(marshalCreatePoolRequest(request, this.client.settings)),
104
+ headers: jsonContentHeaders,
105
+ method: "POST",
106
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/pools`
107
+ }, unmarshalPool);
108
+ this.getPool = (request) => this.client.fetch({
109
+ method: "GET",
110
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
111
+ }, unmarshalPool);
112
+ this.waitForPool = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!POOL_TRANSIENT_STATUSES.includes(res.status))), this.getPool, request, options);
113
+ this.upgradePool = (request) => this.client.fetch({
114
+ body: JSON.stringify(marshalUpgradePoolRequest(request, this.client.settings)),
115
+ headers: jsonContentHeaders,
116
+ method: "POST",
117
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/upgrade`
118
+ }, unmarshalPool);
119
+ this.updatePool = (request) => this.client.fetch({
120
+ body: JSON.stringify(marshalUpdatePoolRequest(request, this.client.settings)),
121
+ headers: jsonContentHeaders,
122
+ method: "PATCH",
123
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
124
+ }, unmarshalPool);
125
+ this.deletePool = (request) => this.client.fetch({
126
+ method: "DELETE",
127
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
128
+ }, unmarshalPool);
129
+ this.setPoolTaints = (request) => this.client.fetch({
130
+ body: JSON.stringify(marshalSetPoolTaintsRequest(request, this.client.settings)),
131
+ headers: jsonContentHeaders,
132
+ method: "PUT",
133
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-taints`
134
+ }, unmarshalPool);
135
+ this.setPoolStartupTaints = (request) => this.client.fetch({
136
+ body: JSON.stringify(marshalSetPoolStartupTaintsRequest(request, this.client.settings)),
137
+ headers: jsonContentHeaders,
138
+ method: "PUT",
139
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-startup-taints`
140
+ }, unmarshalPool);
141
+ this.setPoolLabels = (request) => this.client.fetch({
142
+ body: JSON.stringify(marshalSetPoolLabelsRequest(request, this.client.settings)),
143
+ headers: jsonContentHeaders,
144
+ method: "PUT",
145
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-labels`
146
+ }, unmarshalPool);
147
+ this.getNodeMetadata = (request = {}) => this.client.fetch({
148
+ method: "GET",
149
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/node-metadata`
150
+ }, unmarshalNodeMetadata);
151
+ this.authExternalNode = (request) => this.client.fetch({
152
+ body: "{}",
153
+ headers: jsonContentHeaders,
154
+ method: "POST",
155
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/external-nodes/auth`
156
+ }, unmarshalExternalNodeAuth);
157
+ this.createExternalNode = (request) => this.client.fetch({
158
+ body: "{}",
159
+ headers: jsonContentHeaders,
160
+ method: "POST",
161
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/external-nodes`
162
+ }, unmarshalExternalNode);
163
+ this.pageOfListNodes = (request) => this.client.fetch({
164
+ method: "GET",
165
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/nodes`,
166
+ 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])
167
+ }, unmarshalListNodesResponse);
168
+ this.listNodes = (request) => enrichForPagination("nodes", this.pageOfListNodes, request);
169
+ this.getNode = (request) => this.client.fetch({
170
+ method: "GET",
171
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}`
172
+ }, unmarshalNode);
173
+ this.waitForNode = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!NODE_TRANSIENT_STATUSES.includes(res.status))), this.getNode, request, options);
174
+ this.replaceNode = (request) => this.client.fetch({
175
+ body: "{}",
176
+ headers: jsonContentHeaders,
177
+ method: "POST",
178
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}/replace`
179
+ }, unmarshalNode);
180
+ this.rebootNode = (request) => this.client.fetch({
181
+ body: "{}",
182
+ headers: jsonContentHeaders,
183
+ method: "POST",
184
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}/reboot`
185
+ }, unmarshalNode);
186
+ this.deleteNode = (request) => this.client.fetch({
187
+ method: "DELETE",
188
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}`,
189
+ urlParams: urlParams(["replace", request.replace], ["skip_drain", request.skipDrain])
190
+ }, unmarshalNode);
191
+ this.listVersions = (request = {}) => this.client.fetch({
192
+ method: "GET",
193
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions`
194
+ }, unmarshalListVersionsResponse);
195
+ this.getVersion = (request) => this.client.fetch({
196
+ method: "GET",
197
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions/${validatePathParam("versionName", request.versionName)}`
198
+ }, unmarshalVersion);
199
+ this.pageOfListClusterTypes = (request = {}) => this.client.fetch({
200
+ method: "GET",
201
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/cluster-types`,
202
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
203
+ }, unmarshalListClusterTypesResponse);
204
+ this.listClusterTypes = (request = {}) => enrichForPagination("clusterTypes", this.pageOfListClusterTypes, request);
205
+ }
206
+ static {
207
+ this.LOCALITY = toApiLocality({ regions: [
208
+ "fr-par",
209
+ "nl-ams",
210
+ "pl-waw"
211
+ ] });
212
+ }
437
213
  };
438
214
  //#endregion
439
215
  export { API };