@scaleway/sdk 1.0.0 → 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.
Files changed (55) hide show
  1. package/dist/api/account/v2/api.gen.js +29 -0
  2. package/dist/api/account/v2alpha1/api.gen.js +29 -0
  3. package/dist/api/applesilicon/v1alpha1/api.gen.js +74 -1
  4. package/dist/api/baremetal/v1/api.gen.js +202 -2
  5. package/dist/api/baremetal/v1/api.utils.js +7 -0
  6. package/dist/api/baremetal/v1/marshalling.gen.js +4 -1
  7. package/dist/api/cockpit/index.js +2 -0
  8. package/dist/api/cockpit/v1beta1/api.gen.js +319 -0
  9. package/dist/api/cockpit/v1beta1/content.gen.js +7 -0
  10. package/dist/api/cockpit/v1beta1/index.gen.js +4 -0
  11. package/dist/api/cockpit/v1beta1/marshalling.gen.js +174 -0
  12. package/dist/api/container/v1beta1/api.gen.js +189 -2
  13. package/dist/api/domain/v2beta1/api.gen.js +395 -8
  14. package/dist/api/domain/v2beta1/marshalling.gen.js +2 -2
  15. package/dist/api/flexibleip/v1alpha1/api.gen.js +68 -1
  16. package/dist/api/function/v1beta1/api.gen.js +214 -2
  17. package/dist/api/function/v1beta1/marshalling.gen.js +12 -0
  18. package/dist/api/iam/v1alpha1/api.gen.js +265 -3
  19. package/dist/api/iam/v1alpha1/marshalling.gen.js +44 -1
  20. package/dist/api/iam/v1alpha1/validation-rules.gen.js +24 -1
  21. package/dist/api/instance/v1/api.gen.js +351 -11
  22. package/dist/api/instance/v1/api.utils.js +101 -0
  23. package/dist/api/instance/v1/marshalling.gen.js +12 -5
  24. package/dist/api/iot/v1/api.gen.js +230 -1
  25. package/dist/api/k8s/index.js +2 -2
  26. package/dist/api/k8s/v1/api.gen.js +189 -1
  27. package/dist/api/k8s/v1/api.utils.js +16 -0
  28. package/dist/api/k8s/v1/{index.gen.js → index.js} +1 -3
  29. package/dist/api/lb/v1/api.gen.js +652 -6
  30. package/dist/api/lb/v1/api.utils.js +29 -0
  31. package/dist/api/lb/v1/marshalling.gen.js +14 -0
  32. package/dist/api/marketplace/v1/api.gen.js +12 -0
  33. package/dist/api/marketplace/v2/api.gen.js +18 -0
  34. package/dist/api/mnq/v1alpha1/api.gen.js +60 -1
  35. package/dist/api/rdb/v1/api.gen.js +383 -4
  36. package/dist/api/rdb/v1/marshalling.gen.js +5 -1
  37. package/dist/api/redis/v1/api.gen.js +144 -1
  38. package/dist/api/registry/v1/api.gen.js +96 -2
  39. package/dist/api/secret/v1alpha1/api.gen.js +134 -44
  40. package/dist/api/tem/v1alpha1/api.gen.js +79 -3
  41. package/dist/api/test/v1/api.gen.js +61 -1
  42. package/dist/api/vpc/v1/api.gen.js +31 -1
  43. package/dist/api/vpcgw/v1/api.gen.js +227 -3
  44. package/dist/api/webhosting/index.js +2 -0
  45. package/dist/api/webhosting/v1alpha1/api.gen.js +131 -0
  46. package/dist/api/webhosting/v1alpha1/content.gen.js +7 -0
  47. package/dist/api/webhosting/v1alpha1/index.gen.js +6 -0
  48. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +140 -0
  49. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +14 -0
  50. package/dist/index.cjs +1667 -707
  51. package/dist/index.d.ts +7504 -5544
  52. package/dist/index.js +42 -38
  53. package/dist/scw/constants.js +1 -1
  54. package/dist/scw/fetch/build-fetcher.js +1 -1
  55. package/package.json +2 -2
@@ -23,43 +23,100 @@ class API extends API$1 {
23
23
  return _this.client.fetch({
24
24
  method: 'GET',
25
25
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/clusters`,
26
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId], ['status', request.status ?? 'unknown'], ['type', request.type])
26
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId], ['status', request.status ?? 'unknown'], ['type', request.type])
27
27
  }, unmarshalListClustersResponse);
28
28
  };
29
+ /**
30
+ * This method allows to list all the existing Kubernetes clusters in an
31
+ * account.
32
+ *
33
+ * @param request - The request {@link ListClustersRequest}
34
+ * @returns A Promise of ListClustersResponse
35
+ */
29
36
  this.listClusters = function (request) {
30
37
  if (request === void 0) {
31
38
  request = {};
32
39
  }
33
40
  return enrichForPagination('clusters', _this.pageOfListClusters, request);
34
41
  };
42
+ /**
43
+ * This method allows to create a new Kubernetes cluster on an account.
44
+ *
45
+ * @param request - The request {@link CreateClusterRequest}
46
+ * @returns A Promise of Cluster
47
+ */
35
48
  this.createCluster = request => this.client.fetch({
36
49
  body: JSON.stringify(marshalCreateClusterRequest(request, this.client.settings)),
37
50
  headers: jsonContentHeaders,
38
51
  method: 'POST',
39
52
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters`
40
53
  }, unmarshalCluster);
54
+ /**
55
+ * This method allows to get details about a specific Kubernetes cluster.
56
+ *
57
+ * @param request - The request {@link GetClusterRequest}
58
+ * @returns A Promise of Cluster
59
+ */
41
60
  this.getCluster = request => this.client.fetch({
42
61
  method: 'GET',
43
62
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}`
44
63
  }, unmarshalCluster);
64
+ /**
65
+ * Waits for {@link Cluster} to be in a final state.
66
+ *
67
+ * @param request - The request {@link GetClusterRequest}
68
+ * @param options - The waiting options
69
+ * @returns A Promise of Cluster
70
+ */
45
71
  this.waitForCluster = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!CLUSTER_TRANSIENT_STATUSES.includes(res.status))), this.getCluster, request, options);
72
+ /**
73
+ * This method allows to update a specific Kubernetes cluster. Note that this
74
+ * method is not made to upgrade a Kubernetes cluster.
75
+ *
76
+ * @param request - The request {@link UpdateClusterRequest}
77
+ * @returns A Promise of Cluster
78
+ */
46
79
  this.updateCluster = request => this.client.fetch({
47
80
  body: JSON.stringify(marshalUpdateClusterRequest(request, this.client.settings)),
48
81
  headers: jsonContentHeaders,
49
82
  method: 'PATCH',
50
83
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}`
51
84
  }, unmarshalCluster);
85
+ /**
86
+ * This method allows to delete a specific cluster and all its associated
87
+ * pools and nodes. Note that this method will not delete any Load Balancers
88
+ * or Block Volumes that are associated with the cluster.
89
+ *
90
+ * @param request - The request {@link DeleteClusterRequest}
91
+ * @returns A Promise of Cluster
92
+ */
52
93
  this.deleteCluster = request => this.client.fetch({
53
94
  method: 'DELETE',
54
95
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}`,
55
96
  urlParams: urlParams(['with_additional_resources', request.withAdditionalResources])
56
97
  }, unmarshalCluster);
98
+ /**
99
+ * This method allows to upgrade a specific Kubernetes cluster and/or its
100
+ * associated pools to a specific and supported Kubernetes version.
101
+ *
102
+ * @param request - The request {@link UpgradeClusterRequest}
103
+ * @returns A Promise of Cluster
104
+ */
57
105
  this.upgradeCluster = request => this.client.fetch({
58
106
  body: JSON.stringify(marshalUpgradeClusterRequest(request, this.client.settings)),
59
107
  headers: jsonContentHeaders,
60
108
  method: 'POST',
61
109
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/upgrade`
62
110
  }, unmarshalCluster);
111
+ /**
112
+ * This method allows to list the versions that a specific Kubernetes cluster
113
+ * is allowed to upgrade to. Note that it will be every patch version greater
114
+ * than the actual one as well a one minor version ahead of the actual one.
115
+ * Upgrades skipping a minor version will not work.
116
+ *
117
+ * @param request - The request {@link ListClusterAvailableVersionsRequest}
118
+ * @returns A Promise of ListClusterAvailableVersionsResponse
119
+ */
63
120
  this.listClusterAvailableVersions = request => this.client.fetch({
64
121
  method: 'GET',
65
122
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/available-versions`
@@ -70,6 +127,15 @@ class API extends API$1 {
70
127
  urlParams: urlParams(['dl', 1]),
71
128
  responseType: 'blob'
72
129
  });
130
+ /**
131
+ * This method allows to reset the admin token for a specific Kubernetes
132
+ * cluster. This will invalidate the old admin token (which will not be usable
133
+ * after) and create a new one. Note that the redownload of the kubeconfig
134
+ * will be necessary to keep interacting with the cluster (if the old admin
135
+ * token was used).
136
+ *
137
+ * @param request - The request {@link ResetClusterAdminTokenRequest}
138
+ */
73
139
  this.resetClusterAdminToken = request => this.client.fetch({
74
140
  body: '{}',
75
141
  headers: jsonContentHeaders,
@@ -81,34 +147,89 @@ class API extends API$1 {
81
147
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/pools`,
82
148
  urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['status', request.status ?? 'unknown'])
83
149
  }, unmarshalListPoolsResponse);
150
+ /**
151
+ * This method allows to list all the existing pools for a specific Kubernetes
152
+ * cluster.
153
+ *
154
+ * @param request - The request {@link ListPoolsRequest}
155
+ * @returns A Promise of ListPoolsResponse
156
+ */
84
157
  this.listPools = request => enrichForPagination('pools', this.pageOfListPools, request);
158
+ /**
159
+ * This method allows to create a new pool in a specific Kubernetes cluster.
160
+ *
161
+ * @param request - The request {@link CreatePoolRequest}
162
+ * @returns A Promise of Pool
163
+ */
85
164
  this.createPool = request => this.client.fetch({
86
165
  body: JSON.stringify(marshalCreatePoolRequest(request, this.client.settings)),
87
166
  headers: jsonContentHeaders,
88
167
  method: 'POST',
89
168
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/pools`
90
169
  }, unmarshalPool);
170
+ /**
171
+ * This method allows to get details about a specific pool.
172
+ *
173
+ * @param request - The request {@link GetPoolRequest}
174
+ * @returns A Promise of Pool
175
+ */
91
176
  this.getPool = request => this.client.fetch({
92
177
  method: 'GET',
93
178
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam('poolId', request.poolId)}`
94
179
  }, unmarshalPool);
180
+ /**
181
+ * Waits for {@link Pool} to be in a final state.
182
+ *
183
+ * @param request - The request {@link GetPoolRequest}
184
+ * @param options - The waiting options
185
+ * @returns A Promise of Pool
186
+ */
95
187
  this.waitForPool = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!POOL_TRANSIENT_STATUSES.includes(res.status))), this.getPool, request, options);
188
+ /**
189
+ * This method allows to upgrade the Kubernetes version of a specific pool.
190
+ * Note that this will work when the targeted version is the same than the
191
+ * version of the cluster.
192
+ *
193
+ * @param request - The request {@link UpgradePoolRequest}
194
+ * @returns A Promise of Pool
195
+ */
96
196
  this.upgradePool = request => this.client.fetch({
97
197
  body: JSON.stringify(marshalUpgradePoolRequest(request, this.client.settings)),
98
198
  headers: jsonContentHeaders,
99
199
  method: 'POST',
100
200
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam('poolId', request.poolId)}/upgrade`
101
201
  }, unmarshalPool);
202
+ /**
203
+ * This method allows to update some attributes of a specific pool such as the
204
+ * size, the autoscaling enablement, the tags, ...
205
+ *
206
+ * @param request - The request {@link UpdatePoolRequest}
207
+ * @returns A Promise of Pool
208
+ */
102
209
  this.updatePool = request => this.client.fetch({
103
210
  body: JSON.stringify(marshalUpdatePoolRequest(request, this.client.settings)),
104
211
  headers: jsonContentHeaders,
105
212
  method: 'PATCH',
106
213
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam('poolId', request.poolId)}`
107
214
  }, unmarshalPool);
215
+ /**
216
+ * This method allows to delete a specific pool from a cluster, deleting all
217
+ * the nodes associated with it.
218
+ *
219
+ * @param request - The request {@link DeletePoolRequest}
220
+ * @returns A Promise of Pool
221
+ */
108
222
  this.deletePool = request => this.client.fetch({
109
223
  method: 'DELETE',
110
224
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pools/${validatePathParam('poolId', request.poolId)}`
111
225
  }, unmarshalPool);
226
+ /**
227
+ * This method returns metadata about a Kosmos node, it is not intended to be
228
+ * directly called by end users, rather by kapsule-node-agent.
229
+ *
230
+ * @param request - The request {@link CreateExternalNodeRequest}
231
+ * @returns A Promise of ExternalNode
232
+ */
112
233
  this.createExternalNode = request => this.client.fetch({
113
234
  body: '{}',
114
235
  headers: jsonContentHeaders,
@@ -120,29 +241,88 @@ class API extends API$1 {
120
241
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/nodes`,
121
242
  urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['pool_id', request.poolId], ['status', request.status ?? 'unknown'])
122
243
  }, unmarshalListNodesResponse);
244
+ /**
245
+ * This method allows to list all the existing nodes for a specific Kubernetes
246
+ * cluster.
247
+ *
248
+ * @param request - The request {@link ListNodesRequest}
249
+ * @returns A Promise of ListNodesResponse
250
+ */
123
251
  this.listNodes = request => enrichForPagination('nodes', this.pageOfListNodes, request);
252
+ /**
253
+ * This method allows to get details about a specific Kubernetes node.
254
+ *
255
+ * @param request - The request {@link GetNodeRequest}
256
+ * @returns A Promise of Node
257
+ */
124
258
  this.getNode = request => this.client.fetch({
125
259
  method: 'GET',
126
260
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam('nodeId', request.nodeId)}`
127
261
  }, unmarshalNode);
262
+ /**
263
+ * Waits for {@link Node} to be in a final state.
264
+ *
265
+ * @param request - The request {@link GetNodeRequest}
266
+ * @param options - The waiting options
267
+ * @returns A Promise of Node
268
+ */
128
269
  this.waitForNode = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!NODE_TRANSIENT_STATUSES.includes(res.status))), this.getNode, request, options);
270
+ /**
271
+ * This method allows to replace a specific node. The node will be set
272
+ * cordoned, meaning that scheduling will be disabled. Then the existing pods
273
+ * on the node will be drained and reschedule onto another schedulable node.
274
+ * Then the node will be deleted, and a new one will be created after the
275
+ * deletion. Note that when there is not enough space to reschedule all the
276
+ * pods (in a one node cluster for instance), you may experience some
277
+ * disruption of your applications.
278
+ *
279
+ * @deprecated
280
+ * @param request - The request {@link ReplaceNodeRequest}
281
+ * @returns A Promise of Node
282
+ */
129
283
  this.replaceNode = request => this.client.fetch({
130
284
  body: '{}',
131
285
  headers: jsonContentHeaders,
132
286
  method: 'POST',
133
287
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam('nodeId', request.nodeId)}/replace`
134
288
  }, unmarshalNode);
289
+ /**
290
+ * This method allows to reboot a specific node. This node will frist be
291
+ * cordoned, meaning that scheduling will be disabled. Then the existing pods
292
+ * on the node will be drained and reschedule onto another schedulable node.
293
+ * Note that when there is not enough space to reschedule all the pods (in a
294
+ * one node cluster for instance), you may experience some disruption of your
295
+ * applications.
296
+ *
297
+ * @param request - The request {@link RebootNodeRequest}
298
+ * @returns A Promise of Node
299
+ */
135
300
  this.rebootNode = request => this.client.fetch({
136
301
  body: '{}',
137
302
  headers: jsonContentHeaders,
138
303
  method: 'POST',
139
304
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam('nodeId', request.nodeId)}/reboot`
140
305
  }, unmarshalNode);
306
+ /**
307
+ * This method allows to delete a specific node. Note that when there is not
308
+ * enough space to reschedule all the pods (in a one node cluster for
309
+ * instance), you may experience some disruption of your applications.
310
+ *
311
+ * @param request - The request {@link DeleteNodeRequest}
312
+ * @returns A Promise of Node
313
+ */
141
314
  this.deleteNode = request => this.client.fetch({
142
315
  method: 'DELETE',
143
316
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/nodes/${validatePathParam('nodeId', request.nodeId)}`,
144
317
  urlParams: urlParams(['replace', request.replace], ['skip_drain', request.skipDrain])
145
318
  }, unmarshalNode);
319
+ /**
320
+ * This method allows to list all available versions for the creation of a new
321
+ * Kubernetes cluster.
322
+ *
323
+ * @param request - The request {@link ListVersionsRequest}
324
+ * @returns A Promise of ListVersionsResponse
325
+ */
146
326
  this.listVersions = function (request) {
147
327
  if (request === void 0) {
148
328
  request = {};
@@ -152,12 +332,20 @@ class API extends API$1 {
152
332
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/versions`
153
333
  }, unmarshalListVersionsResponse);
154
334
  };
335
+ /**
336
+ * This method allows to get a specific Kubernetes version and the details
337
+ * about the version.
338
+ *
339
+ * @param request - The request {@link GetVersionRequest}
340
+ * @returns A Promise of Version
341
+ */
155
342
  this.getVersion = request => this.client.fetch({
156
343
  method: 'GET',
157
344
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/versions/${validatePathParam('versionName', request.versionName)}`
158
345
  }, unmarshalVersion);
159
346
  }
160
347
  }
348
+ /** Lists the available regions of the API. */
161
349
  API.LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
162
350
 
163
351
  export { API };
@@ -0,0 +1,16 @@
1
+ import { API } from './api.gen.js';
2
+
3
+ class K8SUtilsAPI extends API {
4
+ constructor() {
5
+ super(...arguments);
6
+ /**
7
+ * Get configuration of a kube cluster.
8
+ *
9
+ * @param request - The request {@link GetClusterKubeConfigRequest}
10
+ * @returns A Promise of Blob
11
+ */
12
+ this.getClusterKubeConfig = request => this._getClusterKubeConfig(request);
13
+ }
14
+ }
15
+
16
+ export { K8SUtilsAPI };
@@ -1,6 +1,4 @@
1
- export { API } from './api.gen.js';
1
+ export { K8SUtilsAPI as API } from './api.utils.js';
2
2
  export { CLUSTER_TRANSIENT_STATUSES, NODE_TRANSIENT_STATUSES, POOL_TRANSIENT_STATUSES } from './content.gen.js';
3
3
  import * as validationRules_gen from './validation-rules.gen.js';
4
4
  export { validationRules_gen as ValidationRules };
5
-
6
- // This file was automatically generated. DO NOT EDIT.