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