@scaleway/sdk-k8s 2.5.0 → 2.6.0

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.
@@ -1,616 +1,437 @@
1
- import { API as API$1, toApiLocality, urlParams, validatePathParam, enrichForPagination, waitForResource } from "@scaleway/sdk-client";
2
- import { CLUSTER_TRANSIENT_STATUSES, POOL_TRANSIENT_STATUSES, NODE_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { unmarshalListClustersResponse, marshalCreateClusterRequest, unmarshalCluster, marshalUpdateClusterRequest, marshalUpgradeClusterRequest, marshalSetClusterTypeRequest, unmarshalListClusterAvailableVersionsResponse, unmarshalListClusterAvailableTypesResponse, unmarshalListClusterACLRulesResponse, marshalAddClusterACLRulesRequest, unmarshalAddClusterACLRulesResponse, marshalSetClusterACLRulesRequest, unmarshalSetClusterACLRulesResponse, unmarshalListPoolsResponse, marshalCreatePoolRequest, unmarshalPool, marshalUpgradePoolRequest, marshalUpdatePoolRequest, marshalSetPoolTaintsRequest, marshalSetPoolStartupTaintsRequest, marshalSetPoolLabelsRequest, unmarshalNodeMetadata, unmarshalExternalNodeAuth, unmarshalExternalNode, unmarshalListNodesResponse, unmarshalNode, unmarshalListVersionsResponse, unmarshalVersion, unmarshalListClusterTypesResponse } from "./marshalling.gen.js";
4
- const jsonContentHeaders = {
5
- "Content-Type": "application/json; charset=utf-8"
6
- };
7
- class API extends API$1 {
8
- /**
9
- * Locality of this API.
10
- * type {'zone','region','global','unspecified'}
11
- */
12
- static LOCALITY = toApiLocality({
13
- regions: [
14
- "fr-par",
15
- "nl-ams",
16
- "pl-waw"
17
- ]
18
- });
19
- pageOfListClusters = (request = {}) => this.client.fetch(
20
- {
21
- method: "GET",
22
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters`,
23
- urlParams: urlParams(
24
- ["name", request.name],
25
- ["order_by", request.orderBy],
26
- ["organization_id", request.organizationId],
27
- ["page", request.page],
28
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
29
- ["private_network_id", request.privateNetworkId],
30
- ["project_id", request.projectId],
31
- ["status", request.status],
32
- ["type", request.type]
33
- )
34
- },
35
- unmarshalListClustersResponse
36
- );
37
- /**
38
- * List Clusters. List all existing Kubernetes clusters in a specific region.
39
- *
40
- * @param request - The request {@link ListClustersRequest}
41
- * @returns A Promise of ListClustersResponse
42
- */
43
- listClusters = (request = {}) => enrichForPagination("clusters", this.pageOfListClusters, request);
44
- /**
45
- * Create a new Cluster. Create a new Kubernetes cluster in a Scaleway region.
46
- *
47
- * @param request - The request {@link CreateClusterRequest}
48
- * @returns A Promise of Cluster
49
- */
50
- createCluster = (request) => this.client.fetch(
51
- {
52
- body: JSON.stringify(
53
- marshalCreateClusterRequest(request, this.client.settings)
54
- ),
55
- headers: jsonContentHeaders,
56
- method: "POST",
57
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters`
58
- },
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
- {
69
- method: "GET",
70
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
71
- },
72
- unmarshalCluster
73
- );
74
- /**
75
- * Waits for {@link Cluster} to be in a final state.
76
- *
77
- * @param request - The request {@link GetClusterRequest}
78
- * @param options - The waiting options
79
- * @returns A Promise of Cluster
80
- */
81
- waitForCluster = (request, options) => waitForResource(
82
- options?.stop ?? ((res) => Promise.resolve(!CLUSTER_TRANSIENT_STATUSES.includes(res.status))),
83
- this.getCluster,
84
- request,
85
- options
86
- );
87
- /**
88
- * 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.
89
- *
90
- * @param request - The request {@link UpdateClusterRequest}
91
- * @returns A Promise of Cluster
92
- */
93
- updateCluster = (request) => this.client.fetch(
94
- {
95
- body: JSON.stringify(
96
- marshalUpdateClusterRequest(request, this.client.settings)
97
- ),
98
- headers: jsonContentHeaders,
99
- method: "PATCH",
100
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
101
- },
102
- unmarshalCluster
103
- );
104
- /**
105
- * Delete a Cluster. Delete a specific Kubernetes cluster and all its associated pools and nodes, and possibly its associated Load Balancers or Block Volumes.
106
- *
107
- * @param request - The request {@link DeleteClusterRequest}
108
- * @returns A Promise of Cluster
109
- */
110
- deleteCluster = (request) => this.client.fetch(
111
- {
112
- method: "DELETE",
113
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`,
114
- urlParams: urlParams(
115
- ["with_additional_resources", request.withAdditionalResources]
116
- )
117
- },
118
- unmarshalCluster
119
- );
120
- /**
121
- * Upgrade a Cluster. Upgrade a specific Kubernetes cluster and possibly its associated pools to a specific and supported Kubernetes version.
122
- *
123
- * @param request - The request {@link UpgradeClusterRequest}
124
- * @returns A Promise of Cluster
125
- */
126
- upgradeCluster = (request) => this.client.fetch(
127
- {
128
- body: JSON.stringify(
129
- marshalUpgradeClusterRequest(request, this.client.settings)
130
- ),
131
- headers: jsonContentHeaders,
132
- method: "POST",
133
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/upgrade`
134
- },
135
- unmarshalCluster
136
- );
137
- /**
138
- * 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).
139
- *
140
- * @param request - The request {@link SetClusterTypeRequest}
141
- * @returns A Promise of Cluster
142
- */
143
- setClusterType = (request) => this.client.fetch(
144
- {
145
- body: JSON.stringify(
146
- marshalSetClusterTypeRequest(request, this.client.settings)
147
- ),
148
- headers: jsonContentHeaders,
149
- method: "POST",
150
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/set-type`
151
- },
152
- unmarshalCluster
153
- );
154
- /**
155
- * 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.
156
- *
157
- * @param request - The request {@link ListClusterAvailableVersionsRequest}
158
- * @returns A Promise of ListClusterAvailableVersionsResponse
159
- */
160
- listClusterAvailableVersions = (request) => this.client.fetch(
161
- {
162
- method: "GET",
163
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/available-versions`
164
- },
165
- unmarshalListClusterAvailableVersionsResponse
166
- );
167
- /**
168
- * List available cluster types for a cluster. List the cluster types that a specific Kubernetes cluster is allowed to switch to.
169
- *
170
- * @param request - The request {@link ListClusterAvailableTypesRequest}
171
- * @returns A Promise of ListClusterAvailableTypesResponse
172
- */
173
- listClusterAvailableTypes = (request) => this.client.fetch(
174
- {
175
- method: "GET",
176
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/available-types`
177
- },
178
- unmarshalListClusterAvailableTypesResponse
179
- );
180
- _getClusterKubeConfig = (request) => this.client.fetch(
181
- {
182
- method: "GET",
183
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/kubeconfig`,
184
- urlParams: urlParams(
185
- ["dl", 1],
186
- ["redacted", request.redacted]
187
- ),
188
- responseType: "blob"
189
- }
190
- );
191
- /**
192
- * 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.
193
- *
194
- * @param request - The request {@link ResetClusterAdminTokenRequest}
195
- */
196
- resetClusterAdminToken = (request) => this.client.fetch(
197
- {
198
- body: "{}",
199
- headers: jsonContentHeaders,
200
- method: "POST",
201
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/reset-admin-token`
202
- }
203
- );
204
- pageOfListClusterACLRules = (request) => this.client.fetch(
205
- {
206
- method: "GET",
207
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`,
208
- urlParams: urlParams(
209
- ["page", request.page],
210
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
211
- )
212
- },
213
- unmarshalListClusterACLRulesResponse
214
- );
215
- /**
216
- * List ACLs. List ACLs for a specific cluster.
217
- *
218
- * @param request - The request {@link ListClusterACLRulesRequest}
219
- * @returns A Promise of ListClusterACLRulesResponse
220
- */
221
- listClusterACLRules = (request) => enrichForPagination("rules", this.pageOfListClusterACLRules, request);
222
- /**
223
- * Add new ACLs. Add new ACL rules for a specific cluster.
224
- *
225
- * @param request - The request {@link AddClusterACLRulesRequest}
226
- * @returns A Promise of AddClusterACLRulesResponse
227
- */
228
- addClusterACLRules = (request) => this.client.fetch(
229
- {
230
- body: JSON.stringify(
231
- marshalAddClusterACLRulesRequest(request, this.client.settings)
232
- ),
233
- headers: jsonContentHeaders,
234
- method: "POST",
235
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
236
- },
237
- unmarshalAddClusterACLRulesResponse
238
- );
239
- /**
240
- * Set new ACLs. Set new ACL rules for a specific cluster.
241
- *
242
- * @param request - The request {@link SetClusterACLRulesRequest}
243
- * @returns A Promise of SetClusterACLRulesResponse
244
- */
245
- setClusterACLRules = (request) => this.client.fetch(
246
- {
247
- body: JSON.stringify(
248
- marshalSetClusterACLRulesRequest(request, this.client.settings)
249
- ),
250
- headers: jsonContentHeaders,
251
- method: "PUT",
252
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
253
- },
254
- unmarshalSetClusterACLRulesResponse
255
- );
256
- /**
257
- * Delete an existing ACL.
258
- *
259
- * @param request - The request {@link DeleteACLRuleRequest}
260
- */
261
- deleteACLRule = (request) => this.client.fetch(
262
- {
263
- method: "DELETE",
264
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/acls/${validatePathParam("aclId", request.aclId)}`
265
- }
266
- );
267
- pageOfListPools = (request) => this.client.fetch(
268
- {
269
- method: "GET",
270
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/pools`,
271
- urlParams: urlParams(
272
- ["name", request.name],
273
- ["order_by", request.orderBy],
274
- ["page", request.page],
275
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
276
- ["status", request.status]
277
- )
278
- },
279
- unmarshalListPoolsResponse
280
- );
281
- /**
282
- * List Pools in a Cluster. List all the existing pools for a specific Kubernetes cluster.
283
- *
284
- * @param request - The request {@link ListPoolsRequest}
285
- * @returns A Promise of ListPoolsResponse
286
- */
287
- listPools = (request) => enrichForPagination("pools", this.pageOfListPools, request);
288
- /**
289
- * Create a new Pool in a Cluster. Create a new pool in a specific Kubernetes cluster.
290
- *
291
- * @param request - The request {@link CreatePoolRequest}
292
- * @returns A Promise of Pool
293
- */
294
- createPool = (request) => this.client.fetch(
295
- {
296
- body: JSON.stringify(
297
- marshalCreatePoolRequest(request, this.client.settings)
298
- ),
299
- headers: jsonContentHeaders,
300
- method: "POST",
301
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/pools`
302
- },
303
- unmarshalPool
304
- );
305
- /**
306
- * Get a Pool in a Cluster. Retrieve details about a specific pool in a Kubernetes cluster.
307
- *
308
- * @param request - The request {@link GetPoolRequest}
309
- * @returns A Promise of Pool
310
- */
311
- getPool = (request) => this.client.fetch(
312
- {
313
- method: "GET",
314
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
315
- },
316
- unmarshalPool
317
- );
318
- /**
319
- * Waits for {@link Pool} to be in a final state.
320
- *
321
- * @param request - The request {@link GetPoolRequest}
322
- * @param options - The waiting options
323
- * @returns A Promise of Pool
324
- */
325
- waitForPool = (request, options) => waitForResource(
326
- options?.stop ?? ((res) => Promise.resolve(!POOL_TRANSIENT_STATUSES.includes(res.status))),
327
- this.getPool,
328
- request,
329
- options
330
- );
331
- /**
332
- * 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.
333
- This will drain and replace the nodes in that pool.
334
- *
335
- * @param request - The request {@link UpgradePoolRequest}
336
- * @returns A Promise of Pool
337
- */
338
- upgradePool = (request) => this.client.fetch(
339
- {
340
- body: JSON.stringify(
341
- marshalUpgradePoolRequest(request, this.client.settings)
342
- ),
343
- headers: jsonContentHeaders,
344
- method: "POST",
345
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/upgrade`
346
- },
347
- unmarshalPool
348
- );
349
- /**
350
- * 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.
351
- *
352
- * @param request - The request {@link UpdatePoolRequest}
353
- * @returns A Promise of Pool
354
- */
355
- updatePool = (request) => this.client.fetch(
356
- {
357
- body: JSON.stringify(
358
- marshalUpdatePoolRequest(request, this.client.settings)
359
- ),
360
- headers: jsonContentHeaders,
361
- method: "PATCH",
362
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
363
- },
364
- unmarshalPool
365
- );
366
- /**
367
- * Delete a Pool in a Cluster. Delete a specific pool from a cluster. Note that all the pool's nodes will also be deleted.
368
- *
369
- * @param request - The request {@link DeletePoolRequest}
370
- * @returns A Promise of Pool
371
- */
372
- deletePool = (request) => this.client.fetch(
373
- {
374
- method: "DELETE",
375
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
376
- },
377
- unmarshalPool
378
- );
379
- /**
380
- * 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.
381
- *
382
- * @param request - The request {@link SetPoolTaintsRequest}
383
- * @returns A Promise of Pool
384
- */
385
- setPoolTaints = (request) => this.client.fetch(
386
- {
387
- body: JSON.stringify(
388
- marshalSetPoolTaintsRequest(request, this.client.settings)
389
- ),
390
- headers: jsonContentHeaders,
391
- method: "PUT",
392
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-taints`
393
- },
394
- unmarshalPool
395
- );
396
- /**
397
- * 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.
398
- *
399
- * @param request - The request {@link SetPoolStartupTaintsRequest}
400
- * @returns A Promise of Pool
401
- */
402
- setPoolStartupTaints = (request) => this.client.fetch(
403
- {
404
- body: JSON.stringify(
405
- marshalSetPoolStartupTaintsRequest(request, this.client.settings)
406
- ),
407
- headers: jsonContentHeaders,
408
- method: "PUT",
409
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-startup-taints`
410
- },
411
- unmarshalPool
412
- );
413
- /**
414
- * 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).
415
- *
416
- * @param request - The request {@link SetPoolLabelsRequest}
417
- * @returns A Promise of Pool
418
- */
419
- setPoolLabels = (request) => this.client.fetch(
420
- {
421
- body: JSON.stringify(
422
- marshalSetPoolLabelsRequest(request, this.client.settings)
423
- ),
424
- headers: jsonContentHeaders,
425
- method: "PUT",
426
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-labels`
427
- },
428
- unmarshalPool
429
- );
430
- /**
431
- * 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.
432
- *
433
- * @param request - The request {@link GetNodeMetadataRequest}
434
- * @returns A Promise of NodeMetadata
435
- */
436
- getNodeMetadata = (request = {}) => this.client.fetch(
437
- {
438
- method: "GET",
439
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/node-metadata`
440
- },
441
- unmarshalNodeMetadata
442
- );
443
- /**
444
- * 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.
445
- *
446
- * @param request - The request {@link AuthExternalNodeRequest}
447
- * @returns A Promise of ExternalNodeAuth
448
- */
449
- authExternalNode = (request) => this.client.fetch(
450
- {
451
- body: "{}",
452
- headers: jsonContentHeaders,
453
- method: "POST",
454
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/external-nodes/auth`
455
- },
456
- unmarshalExternalNodeAuth
457
- );
458
- /**
459
- * 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.
460
- *
461
- * @param request - The request {@link CreateExternalNodeRequest}
462
- * @returns A Promise of ExternalNode
463
- */
464
- createExternalNode = (request) => this.client.fetch(
465
- {
466
- body: "{}",
467
- headers: jsonContentHeaders,
468
- method: "POST",
469
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/external-nodes`
470
- },
471
- unmarshalExternalNode
472
- );
473
- pageOfListNodes = (request) => this.client.fetch(
474
- {
475
- method: "GET",
476
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/nodes`,
477
- urlParams: urlParams(
478
- ["name", request.name],
479
- ["order_by", request.orderBy],
480
- ["page", request.page],
481
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
482
- ["pool_id", request.poolId],
483
- ["status", request.status]
484
- )
485
- },
486
- unmarshalListNodesResponse
487
- );
488
- /**
489
- * List Nodes in a Cluster. List all the existing nodes for a specific Kubernetes cluster.
490
- *
491
- * @param request - The request {@link ListNodesRequest}
492
- * @returns A Promise of ListNodesResponse
493
- */
494
- listNodes = (request) => enrichForPagination("nodes", this.pageOfListNodes, request);
495
- /**
496
- * Get a Node in a Cluster. Retrieve details about a specific Kubernetes Node.
497
- *
498
- * @param request - The request {@link GetNodeRequest}
499
- * @returns A Promise of Node
500
- */
501
- getNode = (request) => this.client.fetch(
502
- {
503
- method: "GET",
504
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}`
505
- },
506
- unmarshalNode
507
- );
508
- /**
509
- * Waits for {@link Node} to be in a final state.
510
- *
511
- * @param request - The request {@link GetNodeRequest}
512
- * @param options - The waiting options
513
- * @returns A Promise of Node
514
- */
515
- waitForNode = (request, options) => waitForResource(
516
- options?.stop ?? ((res) => Promise.resolve(!NODE_TRANSIENT_STATUSES.includes(res.status))),
517
- this.getNode,
518
- request,
519
- options
520
- );
521
- /**
522
- * 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.
523
- *
524
- * @deprecated
525
- * @param request - The request {@link ReplaceNodeRequest}
526
- * @returns A Promise of Node
527
- */
528
- replaceNode = (request) => this.client.fetch(
529
- {
530
- body: "{}",
531
- headers: jsonContentHeaders,
532
- method: "POST",
533
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}/replace`
534
- },
535
- unmarshalNode
536
- );
537
- /**
538
- * 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.
539
- *
540
- * @param request - The request {@link RebootNodeRequest}
541
- * @returns A Promise of Node
542
- */
543
- rebootNode = (request) => this.client.fetch(
544
- {
545
- body: "{}",
546
- headers: jsonContentHeaders,
547
- method: "POST",
548
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}/reboot`
549
- },
550
- unmarshalNode
551
- );
552
- /**
553
- * 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.
554
- *
555
- * @param request - The request {@link DeleteNodeRequest}
556
- * @returns A Promise of Node
557
- */
558
- deleteNode = (request) => this.client.fetch(
559
- {
560
- method: "DELETE",
561
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}`,
562
- urlParams: urlParams(
563
- ["replace", request.replace],
564
- ["skip_drain", request.skipDrain]
565
- )
566
- },
567
- unmarshalNode
568
- );
569
- /**
570
- * List all available Versions. List all available versions for the creation of a new Kubernetes cluster.
571
- *
572
- * @param request - The request {@link ListVersionsRequest}
573
- * @returns A Promise of ListVersionsResponse
574
- */
575
- listVersions = (request = {}) => this.client.fetch(
576
- {
577
- method: "GET",
578
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions`
579
- },
580
- unmarshalListVersionsResponse
581
- );
582
- /**
583
- * Get a Version. Retrieve a specific Kubernetes version and its details.
584
- *
585
- * @param request - The request {@link GetVersionRequest}
586
- * @returns A Promise of Version
587
- */
588
- getVersion = (request) => this.client.fetch(
589
- {
590
- method: "GET",
591
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions/${validatePathParam("versionName", request.versionName)}`
592
- },
593
- unmarshalVersion
594
- );
595
- pageOfListClusterTypes = (request = {}) => this.client.fetch(
596
- {
597
- method: "GET",
598
- path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/cluster-types`,
599
- urlParams: urlParams(
600
- ["page", request.page],
601
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
602
- )
603
- },
604
- unmarshalListClusterTypesResponse
605
- );
606
- /**
607
- * List cluster types. List available cluster types and their technical details.
608
- *
609
- * @param request - The request {@link ListClusterTypesRequest}
610
- * @returns A Promise of ListClusterTypesResponse
611
- */
612
- listClusterTypes = (request = {}) => enrichForPagination("clusterTypes", this.pageOfListClusterTypes, request);
613
- }
614
- export {
615
- API
1
+ import { CLUSTER_TRANSIENT_STATUSES, NODE_TRANSIENT_STATUSES, POOL_TRANSIENT_STATUSES } from "./content.gen.js";
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
+ import { API, enrichForPagination, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ /**
6
+ * Kubernetes API.
7
+
8
+ This API allows you to manage Kubernetes Kapsule and Kosmos clusters.
9
+ */
10
+ var API$1 = class extends API {
11
+ /**
12
+ * Locality of this API.
13
+ * type ∈ {'zone','region','global','unspecified'}
14
+ */
15
+ static LOCALITY = toApiLocality({ regions: [
16
+ "fr-par",
17
+ "nl-ams",
18
+ "pl-waw"
19
+ ] });
20
+ pageOfListClusters = (request = {}) => this.client.fetch({
21
+ method: "GET",
22
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters`,
23
+ 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])
24
+ }, unmarshalListClustersResponse);
25
+ /**
26
+ * List Clusters. List all existing Kubernetes clusters in a specific region.
27
+ *
28
+ * @param request - The request {@link ListClustersRequest}
29
+ * @returns A Promise of ListClustersResponse
30
+ */
31
+ listClusters = (request = {}) => enrichForPagination("clusters", this.pageOfListClusters, request);
32
+ /**
33
+ * Create a new Cluster. Create a new Kubernetes cluster in a Scaleway region.
34
+ *
35
+ * @param request - The request {@link CreateClusterRequest}
36
+ * @returns A Promise of Cluster
37
+ */
38
+ createCluster = (request) => this.client.fetch({
39
+ body: JSON.stringify(marshalCreateClusterRequest(request, this.client.settings)),
40
+ headers: jsonContentHeaders,
41
+ method: "POST",
42
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters`
43
+ }, unmarshalCluster);
44
+ /**
45
+ * Get a Cluster. Retrieve information about a specific Kubernetes cluster.
46
+ *
47
+ * @param request - The request {@link GetClusterRequest}
48
+ * @returns A Promise of Cluster
49
+ */
50
+ getCluster = (request) => this.client.fetch({
51
+ method: "GET",
52
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
53
+ }, unmarshalCluster);
54
+ /**
55
+ * Waits for {@link Cluster} to be in a final state.
56
+ *
57
+ * @param request - The request {@link GetClusterRequest}
58
+ * @param options - The waiting options
59
+ * @returns A Promise of Cluster
60
+ */
61
+ waitForCluster = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!CLUSTER_TRANSIENT_STATUSES.includes(res.status))), this.getCluster, request, options);
62
+ /**
63
+ * 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.
64
+ *
65
+ * @param request - The request {@link UpdateClusterRequest}
66
+ * @returns A Promise of Cluster
67
+ */
68
+ updateCluster = (request) => this.client.fetch({
69
+ body: JSON.stringify(marshalUpdateClusterRequest(request, this.client.settings)),
70
+ headers: jsonContentHeaders,
71
+ method: "PATCH",
72
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
73
+ }, unmarshalCluster);
74
+ /**
75
+ * Delete a Cluster. Delete a specific Kubernetes cluster and all its associated pools and nodes, and possibly its associated Load Balancers or Block Volumes.
76
+ *
77
+ * @param request - The request {@link DeleteClusterRequest}
78
+ * @returns A Promise of Cluster
79
+ */
80
+ deleteCluster = (request) => this.client.fetch({
81
+ method: "DELETE",
82
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}`,
83
+ urlParams: urlParams(["with_additional_resources", request.withAdditionalResources])
84
+ }, unmarshalCluster);
85
+ /**
86
+ * Upgrade a Cluster. Upgrade a specific Kubernetes cluster and possibly its associated pools to a specific and supported Kubernetes version.
87
+ *
88
+ * @param request - The request {@link UpgradeClusterRequest}
89
+ * @returns A Promise of Cluster
90
+ */
91
+ upgradeCluster = (request) => this.client.fetch({
92
+ body: JSON.stringify(marshalUpgradeClusterRequest(request, this.client.settings)),
93
+ headers: jsonContentHeaders,
94
+ method: "POST",
95
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/upgrade`
96
+ }, unmarshalCluster);
97
+ /**
98
+ * 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).
99
+ *
100
+ * @param request - The request {@link SetClusterTypeRequest}
101
+ * @returns A Promise of Cluster
102
+ */
103
+ setClusterType = (request) => this.client.fetch({
104
+ body: JSON.stringify(marshalSetClusterTypeRequest(request, this.client.settings)),
105
+ headers: jsonContentHeaders,
106
+ method: "POST",
107
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/set-type`
108
+ }, unmarshalCluster);
109
+ /**
110
+ * 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.
111
+ *
112
+ * @param request - The request {@link ListClusterAvailableVersionsRequest}
113
+ * @returns A Promise of ListClusterAvailableVersionsResponse
114
+ */
115
+ listClusterAvailableVersions = (request) => this.client.fetch({
116
+ method: "GET",
117
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/available-versions`
118
+ }, unmarshalListClusterAvailableVersionsResponse);
119
+ /**
120
+ * List available cluster types for a cluster. List the cluster types that a specific Kubernetes cluster is allowed to switch to.
121
+ *
122
+ * @param request - The request {@link ListClusterAvailableTypesRequest}
123
+ * @returns A Promise of ListClusterAvailableTypesResponse
124
+ */
125
+ listClusterAvailableTypes = (request) => this.client.fetch({
126
+ method: "GET",
127
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/available-types`
128
+ }, unmarshalListClusterAvailableTypesResponse);
129
+ _getClusterKubeConfig = (request) => this.client.fetch({
130
+ method: "GET",
131
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/kubeconfig`,
132
+ urlParams: urlParams(["dl", 1], ["redacted", request.redacted]),
133
+ responseType: "blob"
134
+ });
135
+ /**
136
+ * 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.
137
+ *
138
+ * @param request - The request {@link ResetClusterAdminTokenRequest}
139
+ */
140
+ resetClusterAdminToken = (request) => this.client.fetch({
141
+ body: "{}",
142
+ headers: jsonContentHeaders,
143
+ method: "POST",
144
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/reset-admin-token`
145
+ });
146
+ pageOfListClusterACLRules = (request) => this.client.fetch({
147
+ method: "GET",
148
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`,
149
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
150
+ }, unmarshalListClusterACLRulesResponse);
151
+ /**
152
+ * List ACLs. List ACLs for a specific cluster.
153
+ *
154
+ * @param request - The request {@link ListClusterACLRulesRequest}
155
+ * @returns A Promise of ListClusterACLRulesResponse
156
+ */
157
+ listClusterACLRules = (request) => enrichForPagination("rules", this.pageOfListClusterACLRules, request);
158
+ /**
159
+ * Add new ACLs. Add new ACL rules for a specific cluster.
160
+ *
161
+ * @param request - The request {@link AddClusterACLRulesRequest}
162
+ * @returns A Promise of AddClusterACLRulesResponse
163
+ */
164
+ addClusterACLRules = (request) => this.client.fetch({
165
+ body: JSON.stringify(marshalAddClusterACLRulesRequest(request, this.client.settings)),
166
+ headers: jsonContentHeaders,
167
+ method: "POST",
168
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
169
+ }, unmarshalAddClusterACLRulesResponse);
170
+ /**
171
+ * Set new ACLs. Set new ACL rules for a specific cluster.
172
+ *
173
+ * @param request - The request {@link SetClusterACLRulesRequest}
174
+ * @returns A Promise of SetClusterACLRulesResponse
175
+ */
176
+ setClusterACLRules = (request) => this.client.fetch({
177
+ body: JSON.stringify(marshalSetClusterACLRulesRequest(request, this.client.settings)),
178
+ headers: jsonContentHeaders,
179
+ method: "PUT",
180
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
181
+ }, unmarshalSetClusterACLRulesResponse);
182
+ /**
183
+ * Delete an existing ACL.
184
+ *
185
+ * @param request - The request {@link DeleteACLRuleRequest}
186
+ */
187
+ deleteACLRule = (request) => this.client.fetch({
188
+ method: "DELETE",
189
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/acls/${validatePathParam("aclId", request.aclId)}`
190
+ });
191
+ pageOfListPools = (request) => this.client.fetch({
192
+ method: "GET",
193
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/pools`,
194
+ urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["status", request.status])
195
+ }, unmarshalListPoolsResponse);
196
+ /**
197
+ * List Pools in a Cluster. List all the existing pools for a specific Kubernetes cluster.
198
+ *
199
+ * @param request - The request {@link ListPoolsRequest}
200
+ * @returns A Promise of ListPoolsResponse
201
+ */
202
+ listPools = (request) => enrichForPagination("pools", this.pageOfListPools, request);
203
+ /**
204
+ * Create a new Pool in a Cluster. Create a new pool in a specific Kubernetes cluster.
205
+ *
206
+ * @param request - The request {@link CreatePoolRequest}
207
+ * @returns A Promise of Pool
208
+ */
209
+ createPool = (request) => this.client.fetch({
210
+ body: JSON.stringify(marshalCreatePoolRequest(request, this.client.settings)),
211
+ headers: jsonContentHeaders,
212
+ method: "POST",
213
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/pools`
214
+ }, unmarshalPool);
215
+ /**
216
+ * Get a Pool in a Cluster. Retrieve details about a specific pool in a Kubernetes cluster.
217
+ *
218
+ * @param request - The request {@link GetPoolRequest}
219
+ * @returns A Promise of Pool
220
+ */
221
+ getPool = (request) => this.client.fetch({
222
+ method: "GET",
223
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
224
+ }, unmarshalPool);
225
+ /**
226
+ * Waits for {@link Pool} to be in a final state.
227
+ *
228
+ * @param request - The request {@link GetPoolRequest}
229
+ * @param options - The waiting options
230
+ * @returns A Promise of Pool
231
+ */
232
+ waitForPool = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!POOL_TRANSIENT_STATUSES.includes(res.status))), this.getPool, request, options);
233
+ /**
234
+ * 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.
235
+ This will drain and replace the nodes in that pool.
236
+ *
237
+ * @param request - The request {@link UpgradePoolRequest}
238
+ * @returns A Promise of Pool
239
+ */
240
+ upgradePool = (request) => this.client.fetch({
241
+ body: JSON.stringify(marshalUpgradePoolRequest(request, this.client.settings)),
242
+ headers: jsonContentHeaders,
243
+ method: "POST",
244
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/upgrade`
245
+ }, unmarshalPool);
246
+ /**
247
+ * 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.
248
+ *
249
+ * @param request - The request {@link UpdatePoolRequest}
250
+ * @returns A Promise of Pool
251
+ */
252
+ updatePool = (request) => this.client.fetch({
253
+ body: JSON.stringify(marshalUpdatePoolRequest(request, this.client.settings)),
254
+ headers: jsonContentHeaders,
255
+ method: "PATCH",
256
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
257
+ }, unmarshalPool);
258
+ /**
259
+ * Delete a Pool in a Cluster. Delete a specific pool from a cluster. Note that all the pool's nodes will also be deleted.
260
+ *
261
+ * @param request - The request {@link DeletePoolRequest}
262
+ * @returns A Promise of Pool
263
+ */
264
+ deletePool = (request) => this.client.fetch({
265
+ method: "DELETE",
266
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}`
267
+ }, unmarshalPool);
268
+ /**
269
+ * 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.
270
+ *
271
+ * @param request - The request {@link SetPoolTaintsRequest}
272
+ * @returns A Promise of Pool
273
+ */
274
+ setPoolTaints = (request) => this.client.fetch({
275
+ body: JSON.stringify(marshalSetPoolTaintsRequest(request, this.client.settings)),
276
+ headers: jsonContentHeaders,
277
+ method: "PUT",
278
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-taints`
279
+ }, unmarshalPool);
280
+ /**
281
+ * 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.
282
+ *
283
+ * @param request - The request {@link SetPoolStartupTaintsRequest}
284
+ * @returns A Promise of Pool
285
+ */
286
+ setPoolStartupTaints = (request) => this.client.fetch({
287
+ body: JSON.stringify(marshalSetPoolStartupTaintsRequest(request, this.client.settings)),
288
+ headers: jsonContentHeaders,
289
+ method: "PUT",
290
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-startup-taints`
291
+ }, unmarshalPool);
292
+ /**
293
+ * 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).
294
+ *
295
+ * @param request - The request {@link SetPoolLabelsRequest}
296
+ * @returns A Promise of Pool
297
+ */
298
+ setPoolLabels = (request) => this.client.fetch({
299
+ body: JSON.stringify(marshalSetPoolLabelsRequest(request, this.client.settings)),
300
+ headers: jsonContentHeaders,
301
+ method: "PUT",
302
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/set-labels`
303
+ }, unmarshalPool);
304
+ /**
305
+ * 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.
306
+ *
307
+ * @param request - The request {@link GetNodeMetadataRequest}
308
+ * @returns A Promise of NodeMetadata
309
+ */
310
+ getNodeMetadata = (request = {}) => this.client.fetch({
311
+ method: "GET",
312
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/node-metadata`
313
+ }, unmarshalNodeMetadata);
314
+ /**
315
+ * 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.
316
+ *
317
+ * @param request - The request {@link AuthExternalNodeRequest}
318
+ * @returns A Promise of ExternalNodeAuth
319
+ */
320
+ authExternalNode = (request) => this.client.fetch({
321
+ body: "{}",
322
+ headers: jsonContentHeaders,
323
+ method: "POST",
324
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/external-nodes/auth`
325
+ }, unmarshalExternalNodeAuth);
326
+ /**
327
+ * 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.
328
+ *
329
+ * @param request - The request {@link CreateExternalNodeRequest}
330
+ * @returns A Promise of ExternalNode
331
+ */
332
+ createExternalNode = (request) => this.client.fetch({
333
+ body: "{}",
334
+ headers: jsonContentHeaders,
335
+ method: "POST",
336
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam("poolId", request.poolId)}/external-nodes`
337
+ }, unmarshalExternalNode);
338
+ pageOfListNodes = (request) => this.client.fetch({
339
+ method: "GET",
340
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam("clusterId", request.clusterId)}/nodes`,
341
+ 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])
342
+ }, unmarshalListNodesResponse);
343
+ /**
344
+ * List Nodes in a Cluster. List all the existing nodes for a specific Kubernetes cluster.
345
+ *
346
+ * @param request - The request {@link ListNodesRequest}
347
+ * @returns A Promise of ListNodesResponse
348
+ */
349
+ listNodes = (request) => enrichForPagination("nodes", this.pageOfListNodes, request);
350
+ /**
351
+ * Get a Node in a Cluster. Retrieve details about a specific Kubernetes Node.
352
+ *
353
+ * @param request - The request {@link GetNodeRequest}
354
+ * @returns A Promise of Node
355
+ */
356
+ getNode = (request) => this.client.fetch({
357
+ method: "GET",
358
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}`
359
+ }, unmarshalNode);
360
+ /**
361
+ * Waits for {@link Node} to be in a final state.
362
+ *
363
+ * @param request - The request {@link GetNodeRequest}
364
+ * @param options - The waiting options
365
+ * @returns A Promise of Node
366
+ */
367
+ waitForNode = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!NODE_TRANSIENT_STATUSES.includes(res.status))), this.getNode, request, options);
368
+ /**
369
+ * 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.
370
+ *
371
+ * @deprecated
372
+ * @param request - The request {@link ReplaceNodeRequest}
373
+ * @returns A Promise of Node
374
+ */
375
+ replaceNode = (request) => this.client.fetch({
376
+ body: "{}",
377
+ headers: jsonContentHeaders,
378
+ method: "POST",
379
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}/replace`
380
+ }, unmarshalNode);
381
+ /**
382
+ * 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.
383
+ *
384
+ * @param request - The request {@link RebootNodeRequest}
385
+ * @returns A Promise of Node
386
+ */
387
+ rebootNode = (request) => this.client.fetch({
388
+ body: "{}",
389
+ headers: jsonContentHeaders,
390
+ method: "POST",
391
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}/reboot`
392
+ }, unmarshalNode);
393
+ /**
394
+ * 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.
395
+ *
396
+ * @param request - The request {@link DeleteNodeRequest}
397
+ * @returns A Promise of Node
398
+ */
399
+ deleteNode = (request) => this.client.fetch({
400
+ method: "DELETE",
401
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam("nodeId", request.nodeId)}`,
402
+ urlParams: urlParams(["replace", request.replace], ["skip_drain", request.skipDrain])
403
+ }, unmarshalNode);
404
+ /**
405
+ * List all available Versions. List all available versions for the creation of a new Kubernetes cluster.
406
+ *
407
+ * @param request - The request {@link ListVersionsRequest}
408
+ * @returns A Promise of ListVersionsResponse
409
+ */
410
+ listVersions = (request = {}) => this.client.fetch({
411
+ method: "GET",
412
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions`
413
+ }, unmarshalListVersionsResponse);
414
+ /**
415
+ * Get a Version. Retrieve a specific Kubernetes version and its details.
416
+ *
417
+ * @param request - The request {@link GetVersionRequest}
418
+ * @returns A Promise of Version
419
+ */
420
+ getVersion = (request) => this.client.fetch({
421
+ method: "GET",
422
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions/${validatePathParam("versionName", request.versionName)}`
423
+ }, unmarshalVersion);
424
+ pageOfListClusterTypes = (request = {}) => this.client.fetch({
425
+ method: "GET",
426
+ path: `/k8s/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/cluster-types`,
427
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
428
+ }, unmarshalListClusterTypesResponse);
429
+ /**
430
+ * List cluster types. List available cluster types and their technical details.
431
+ *
432
+ * @param request - The request {@link ListClusterTypesRequest}
433
+ * @returns A Promise of ListClusterTypesResponse
434
+ */
435
+ listClusterTypes = (request = {}) => enrichForPagination("clusterTypes", this.pageOfListClusterTypes, request);
616
436
  };
437
+ export { API$1 as API };