@numa-tech/numa 1.12.10 → 1.13.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.
- package/README.md +96 -14
- package/dist/ai-registry/commands.js +33 -33
- package/dist/ai-registry/commands.js.map +1 -1
- package/dist/app-config.d.ts +0 -1
- package/dist/app-config.js +4 -2
- package/dist/app-config.js.map +1 -1
- package/dist/application-onboarding/client.d.ts +83 -8
- package/dist/application-onboarding/client.js +23 -1
- package/dist/application-onboarding/client.js.map +1 -1
- package/dist/application-onboarding/commands.js +66 -4
- package/dist/application-onboarding/commands.js.map +1 -1
- package/dist/application-onboarding/schemas.d.ts +301 -58
- package/dist/application-onboarding/schemas.js +134 -8
- package/dist/application-onboarding/schemas.js.map +1 -1
- package/dist/application-onboarding/tui-model.d.ts +18 -0
- package/dist/application-onboarding/tui-model.js +215 -3
- package/dist/application-onboarding/tui-model.js.map +1 -1
- package/dist/application-onboarding/tui.d.ts +1 -1
- package/dist/application-onboarding/tui.js +20 -6
- package/dist/application-onboarding/tui.js.map +1 -1
- package/dist/authorization/access-request-client.d.ts +45 -0
- package/dist/authorization/access-request-client.js +93 -0
- package/dist/authorization/access-request-client.js.map +1 -0
- package/dist/authorization/access-request-commands.d.ts +25 -0
- package/dist/authorization/access-request-commands.js +196 -0
- package/dist/authorization/access-request-commands.js.map +1 -0
- package/dist/authorization/access-request-schemas.d.ts +123 -0
- package/dist/authorization/access-request-schemas.js +67 -0
- package/dist/authorization/access-request-schemas.js.map +1 -0
- package/dist/authorization/client.d.ts +50 -0
- package/dist/authorization/client.js +113 -0
- package/dist/authorization/client.js.map +1 -0
- package/dist/authorization/commands.d.ts +40 -0
- package/dist/authorization/commands.js +296 -0
- package/dist/authorization/commands.js.map +1 -0
- package/dist/authorization/errors.d.ts +13 -0
- package/dist/authorization/errors.js +70 -0
- package/dist/authorization/errors.js.map +1 -0
- package/dist/authorization/schemas.d.ts +187 -0
- package/dist/authorization/schemas.js +101 -0
- package/dist/authorization/schemas.js.map +1 -0
- package/dist/cli.js +73 -9
- package/dist/cli.js.map +1 -1
- package/dist/clusters/client.d.ts +436 -0
- package/dist/clusters/client.js +207 -0
- package/dist/clusters/client.js.map +1 -0
- package/dist/clusters/commands.d.ts +11 -0
- package/dist/clusters/commands.js +373 -0
- package/dist/clusters/commands.js.map +1 -0
- package/dist/clusters/errors.d.ts +10 -0
- package/dist/clusters/errors.js +61 -0
- package/dist/clusters/errors.js.map +1 -0
- package/dist/clusters/kubeconfig-discovery.d.ts +48 -0
- package/dist/clusters/kubeconfig-discovery.js +280 -0
- package/dist/clusters/kubeconfig-discovery.js.map +1 -0
- package/dist/clusters/schemas.d.ts +510 -0
- package/dist/clusters/schemas.js +201 -0
- package/dist/clusters/schemas.js.map +1 -0
- package/dist/command-catalog.js +490 -26
- package/dist/command-catalog.js.map +1 -1
- package/dist/gitops/client.d.ts +499 -0
- package/dist/gitops/client.js +163 -0
- package/dist/gitops/client.js.map +1 -0
- package/dist/gitops/commands.d.ts +11 -0
- package/dist/gitops/commands.js +367 -0
- package/dist/gitops/commands.js.map +1 -0
- package/dist/gitops/errors.d.ts +10 -0
- package/dist/gitops/errors.js +59 -0
- package/dist/gitops/errors.js.map +1 -0
- package/dist/gitops/schemas.d.ts +1712 -0
- package/dist/gitops/schemas.js +360 -0
- package/dist/gitops/schemas.js.map +1 -0
- package/dist/repositories/client.d.ts +540 -0
- package/dist/repositories/client.js +215 -0
- package/dist/repositories/client.js.map +1 -0
- package/dist/repositories/commands.d.ts +10 -0
- package/dist/repositories/commands.js +347 -0
- package/dist/repositories/commands.js.map +1 -0
- package/dist/repositories/errors.d.ts +10 -0
- package/dist/repositories/errors.js +60 -0
- package/dist/repositories/errors.js.map +1 -0
- package/dist/repositories/schemas.d.ts +1692 -0
- package/dist/repositories/schemas.js +255 -0
- package/dist/repositories/schemas.js.map +1 -0
- package/dist/web-console-page.d.ts +1 -1
- package/dist/web-console-page.js +1 -1
- package/dist/web-console.js +2 -2
- package/dist/web-console.js.map +1 -1
- package/examples/ai-registry/README.md +18 -0
- package/examples/ai-registry/nacos-instance.username-password.example.json +25 -0
- package/package.json +4 -4
- package/skills/numa-ai-registry/SKILL.md +5 -5
- package/skills/numa-ai-registry/evals/evals.json +1 -1
- package/skills/numa-ai-registry/references/command-contract.md +22 -22
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import type { AuthConfig } from "../config.js";
|
|
2
|
+
import { type KeycloakTokenProvider } from "../oauth.js";
|
|
3
|
+
import { type ClusterAdoptRequest, type ClusterIgnoreRequest, type ClusterLinkRequest, type ClusterObservationBatchRequest, type ClusterSourceCreate, type ClusterSourceUpdate } from "./schemas.js";
|
|
4
|
+
export declare const CLUSTER_CONTROL_PLANE_API_ROOT = "/api/v1/cluster-control-plane";
|
|
5
|
+
export declare const CLUSTER_CONTROL_PLANE_CONTRACT_VERSION = "v1";
|
|
6
|
+
export interface ClusterControlPlaneClientDependencies {
|
|
7
|
+
fetch?: typeof fetch;
|
|
8
|
+
tokenProvider?: KeycloakTokenProvider;
|
|
9
|
+
}
|
|
10
|
+
export interface ClusterCandidateListOptions {
|
|
11
|
+
status?: string;
|
|
12
|
+
sourceKey?: string;
|
|
13
|
+
page?: number;
|
|
14
|
+
size?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ClusterObservationListOptions {
|
|
17
|
+
sourceKey?: string;
|
|
18
|
+
candidateKey?: string;
|
|
19
|
+
page?: number;
|
|
20
|
+
size?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class ClusterControlPlaneClient {
|
|
23
|
+
private readonly config;
|
|
24
|
+
private readonly fetchImpl;
|
|
25
|
+
private readonly tokenProvider;
|
|
26
|
+
constructor(config: AuthConfig, dependencies?: ClusterControlPlaneClientDependencies);
|
|
27
|
+
private authenticatedFetch;
|
|
28
|
+
private json;
|
|
29
|
+
private mutation;
|
|
30
|
+
listClusters(): Promise<{
|
|
31
|
+
id?: string | undefined;
|
|
32
|
+
clusterKey: string;
|
|
33
|
+
code: string;
|
|
34
|
+
name: string;
|
|
35
|
+
provider: string;
|
|
36
|
+
providerClusterId?: string | null | undefined;
|
|
37
|
+
region?: string | null | undefined;
|
|
38
|
+
status: string;
|
|
39
|
+
identityStatus: string;
|
|
40
|
+
endpointFingerprintPrefix?: string | null | undefined;
|
|
41
|
+
lastObservedAt?: string | null | undefined;
|
|
42
|
+
version: number;
|
|
43
|
+
}[]>;
|
|
44
|
+
getCluster(clusterKey: string): Promise<{
|
|
45
|
+
cluster: {
|
|
46
|
+
id?: string | undefined;
|
|
47
|
+
clusterKey: string;
|
|
48
|
+
code: string;
|
|
49
|
+
name: string;
|
|
50
|
+
provider: string;
|
|
51
|
+
providerClusterId?: string | null | undefined;
|
|
52
|
+
region?: string | null | undefined;
|
|
53
|
+
status: string;
|
|
54
|
+
identityStatus: string;
|
|
55
|
+
endpointFingerprintPrefix?: string | null | undefined;
|
|
56
|
+
lastObservedAt?: string | null | undefined;
|
|
57
|
+
version: number;
|
|
58
|
+
};
|
|
59
|
+
description?: string | null | undefined;
|
|
60
|
+
fingerprintKinds: string[];
|
|
61
|
+
linkedCandidateKeys: string[];
|
|
62
|
+
}>;
|
|
63
|
+
listSources(): Promise<{
|
|
64
|
+
id?: string | undefined;
|
|
65
|
+
sourceKey: string;
|
|
66
|
+
sourceType: "ALIYUN_ACK_ASSUME_ROLE" | "KUBECONFIG_CLI";
|
|
67
|
+
displayName: string;
|
|
68
|
+
aliyunAccountId?: string | null | undefined;
|
|
69
|
+
aliyunAssumeRoleId?: string | null | undefined;
|
|
70
|
+
regions: string[];
|
|
71
|
+
enabled: boolean;
|
|
72
|
+
status: "ACTIVE" | "DISABLED" | "ERROR";
|
|
73
|
+
lastObservedAt?: string | null | undefined;
|
|
74
|
+
observationCount: number;
|
|
75
|
+
lastErrorCode?: string | null | undefined;
|
|
76
|
+
lastErrorMessage?: string | null | undefined;
|
|
77
|
+
version: number;
|
|
78
|
+
}[]>;
|
|
79
|
+
getSource(sourceKey: string): Promise<{
|
|
80
|
+
id?: string | undefined;
|
|
81
|
+
sourceKey: string;
|
|
82
|
+
sourceType: "ALIYUN_ACK_ASSUME_ROLE" | "KUBECONFIG_CLI";
|
|
83
|
+
displayName: string;
|
|
84
|
+
aliyunAccountId?: string | null | undefined;
|
|
85
|
+
aliyunAssumeRoleId?: string | null | undefined;
|
|
86
|
+
regions: string[];
|
|
87
|
+
enabled: boolean;
|
|
88
|
+
status: "ACTIVE" | "DISABLED" | "ERROR";
|
|
89
|
+
lastObservedAt?: string | null | undefined;
|
|
90
|
+
observationCount: number;
|
|
91
|
+
lastErrorCode?: string | null | undefined;
|
|
92
|
+
lastErrorMessage?: string | null | undefined;
|
|
93
|
+
version: number;
|
|
94
|
+
}>;
|
|
95
|
+
listCandidates(options?: ClusterCandidateListOptions): Promise<{
|
|
96
|
+
items: {
|
|
97
|
+
candidateKey: string;
|
|
98
|
+
sourceKey: string;
|
|
99
|
+
status: "ADOPTED" | "AMBIGUOUS" | "IGNORED" | "LINKED" | "MATCHED" | "PENDING";
|
|
100
|
+
matchKind: string;
|
|
101
|
+
matchedClusterKey?: string | null | undefined;
|
|
102
|
+
observedName?: string | null | undefined;
|
|
103
|
+
provider: string;
|
|
104
|
+
providerClusterId?: string | null | undefined;
|
|
105
|
+
region?: string | null | undefined;
|
|
106
|
+
kubernetesVersion?: string | null | undefined;
|
|
107
|
+
evidence: {
|
|
108
|
+
kind: string;
|
|
109
|
+
fingerprintPrefix: string;
|
|
110
|
+
strength: string;
|
|
111
|
+
matched: boolean;
|
|
112
|
+
}[];
|
|
113
|
+
firstObservedAt?: string | null | undefined;
|
|
114
|
+
lastObservedAt?: string | null | undefined;
|
|
115
|
+
observationCount: number;
|
|
116
|
+
resolutionReason?: string | null | undefined;
|
|
117
|
+
reviewedBy?: string | null | undefined;
|
|
118
|
+
reviewedAt?: string | null | undefined;
|
|
119
|
+
version: number;
|
|
120
|
+
}[];
|
|
121
|
+
total: number;
|
|
122
|
+
page: number;
|
|
123
|
+
size: number;
|
|
124
|
+
totalPages: number;
|
|
125
|
+
}>;
|
|
126
|
+
getCandidate(candidateKey: string): Promise<{
|
|
127
|
+
candidateKey: string;
|
|
128
|
+
sourceKey: string;
|
|
129
|
+
status: "ADOPTED" | "AMBIGUOUS" | "IGNORED" | "LINKED" | "MATCHED" | "PENDING";
|
|
130
|
+
matchKind: string;
|
|
131
|
+
matchedClusterKey?: string | null | undefined;
|
|
132
|
+
observedName?: string | null | undefined;
|
|
133
|
+
provider: string;
|
|
134
|
+
providerClusterId?: string | null | undefined;
|
|
135
|
+
region?: string | null | undefined;
|
|
136
|
+
kubernetesVersion?: string | null | undefined;
|
|
137
|
+
evidence: {
|
|
138
|
+
kind: string;
|
|
139
|
+
fingerprintPrefix: string;
|
|
140
|
+
strength: string;
|
|
141
|
+
matched: boolean;
|
|
142
|
+
}[];
|
|
143
|
+
firstObservedAt?: string | null | undefined;
|
|
144
|
+
lastObservedAt?: string | null | undefined;
|
|
145
|
+
observationCount: number;
|
|
146
|
+
resolutionReason?: string | null | undefined;
|
|
147
|
+
reviewedBy?: string | null | undefined;
|
|
148
|
+
reviewedAt?: string | null | undefined;
|
|
149
|
+
version: number;
|
|
150
|
+
}>;
|
|
151
|
+
listObservations(options?: ClusterObservationListOptions): Promise<{
|
|
152
|
+
items: {
|
|
153
|
+
observationKey: string;
|
|
154
|
+
sourceKey: string;
|
|
155
|
+
candidateKey: string;
|
|
156
|
+
observedName?: string | null | undefined;
|
|
157
|
+
provider: string;
|
|
158
|
+
providerClusterId?: string | null | undefined;
|
|
159
|
+
region?: string | null | undefined;
|
|
160
|
+
kubernetesVersion?: string | null | undefined;
|
|
161
|
+
evidence: {
|
|
162
|
+
kind: string;
|
|
163
|
+
fingerprintPrefix: string;
|
|
164
|
+
strength: string;
|
|
165
|
+
matched: boolean;
|
|
166
|
+
}[];
|
|
167
|
+
evidenceSource: "ACK_API" | "KUBECONFIG_CLI";
|
|
168
|
+
observedAt?: string | null | undefined;
|
|
169
|
+
receivedAt?: string | null | undefined;
|
|
170
|
+
disposition?: string | null | undefined;
|
|
171
|
+
}[];
|
|
172
|
+
total: number;
|
|
173
|
+
page: number;
|
|
174
|
+
size: number;
|
|
175
|
+
totalPages: number;
|
|
176
|
+
}>;
|
|
177
|
+
getObservation(observationKey: string): Promise<{
|
|
178
|
+
observationKey: string;
|
|
179
|
+
sourceKey: string;
|
|
180
|
+
candidateKey: string;
|
|
181
|
+
observedName?: string | null | undefined;
|
|
182
|
+
provider: string;
|
|
183
|
+
providerClusterId?: string | null | undefined;
|
|
184
|
+
region?: string | null | undefined;
|
|
185
|
+
kubernetesVersion?: string | null | undefined;
|
|
186
|
+
evidence: {
|
|
187
|
+
kind: string;
|
|
188
|
+
fingerprintPrefix: string;
|
|
189
|
+
strength: string;
|
|
190
|
+
matched: boolean;
|
|
191
|
+
}[];
|
|
192
|
+
evidenceSource: "ACK_API" | "KUBECONFIG_CLI";
|
|
193
|
+
observedAt?: string | null | undefined;
|
|
194
|
+
receivedAt?: string | null | undefined;
|
|
195
|
+
disposition?: string | null | undefined;
|
|
196
|
+
}>;
|
|
197
|
+
createSource(input: ClusterSourceCreate, idempotencyKey: string): Promise<{
|
|
198
|
+
id?: string | undefined;
|
|
199
|
+
sourceKey: string;
|
|
200
|
+
sourceType: "ALIYUN_ACK_ASSUME_ROLE" | "KUBECONFIG_CLI";
|
|
201
|
+
displayName: string;
|
|
202
|
+
aliyunAccountId?: string | null | undefined;
|
|
203
|
+
aliyunAssumeRoleId?: string | null | undefined;
|
|
204
|
+
regions: string[];
|
|
205
|
+
enabled: boolean;
|
|
206
|
+
status: "ACTIVE" | "DISABLED" | "ERROR";
|
|
207
|
+
lastObservedAt?: string | null | undefined;
|
|
208
|
+
observationCount: number;
|
|
209
|
+
lastErrorCode?: string | null | undefined;
|
|
210
|
+
lastErrorMessage?: string | null | undefined;
|
|
211
|
+
version: number;
|
|
212
|
+
}>;
|
|
213
|
+
updateSource(sourceKey: string, input: ClusterSourceUpdate, idempotencyKey: string): Promise<{
|
|
214
|
+
id?: string | undefined;
|
|
215
|
+
sourceKey: string;
|
|
216
|
+
sourceType: "ALIYUN_ACK_ASSUME_ROLE" | "KUBECONFIG_CLI";
|
|
217
|
+
displayName: string;
|
|
218
|
+
aliyunAccountId?: string | null | undefined;
|
|
219
|
+
aliyunAssumeRoleId?: string | null | undefined;
|
|
220
|
+
regions: string[];
|
|
221
|
+
enabled: boolean;
|
|
222
|
+
status: "ACTIVE" | "DISABLED" | "ERROR";
|
|
223
|
+
lastObservedAt?: string | null | undefined;
|
|
224
|
+
observationCount: number;
|
|
225
|
+
lastErrorCode?: string | null | undefined;
|
|
226
|
+
lastErrorMessage?: string | null | undefined;
|
|
227
|
+
version: number;
|
|
228
|
+
}>;
|
|
229
|
+
discoverSource(sourceKey: string, idempotencyKey: string): Promise<{
|
|
230
|
+
runNo: string;
|
|
231
|
+
sourceKey: string;
|
|
232
|
+
state: string;
|
|
233
|
+
discoveredCount: number;
|
|
234
|
+
candidateCount: number;
|
|
235
|
+
errorCode?: string | null | undefined;
|
|
236
|
+
errorMessage?: string | null | undefined;
|
|
237
|
+
startedAt?: string | null | undefined;
|
|
238
|
+
completedAt?: string | null | undefined;
|
|
239
|
+
}>;
|
|
240
|
+
getRun(runNo: string): Promise<{
|
|
241
|
+
runNo: string;
|
|
242
|
+
sourceKey: string;
|
|
243
|
+
state: string;
|
|
244
|
+
discoveredCount: number;
|
|
245
|
+
candidateCount: number;
|
|
246
|
+
errorCode?: string | null | undefined;
|
|
247
|
+
errorMessage?: string | null | undefined;
|
|
248
|
+
startedAt?: string | null | undefined;
|
|
249
|
+
completedAt?: string | null | undefined;
|
|
250
|
+
}>;
|
|
251
|
+
submitObservations(sourceKey: string, input: ClusterObservationBatchRequest, idempotencyKey: string): Promise<{
|
|
252
|
+
items: {
|
|
253
|
+
observation: {
|
|
254
|
+
observationKey: string;
|
|
255
|
+
sourceKey: string;
|
|
256
|
+
candidateKey: string;
|
|
257
|
+
observedName?: string | null | undefined;
|
|
258
|
+
provider: string;
|
|
259
|
+
providerClusterId?: string | null | undefined;
|
|
260
|
+
region?: string | null | undefined;
|
|
261
|
+
kubernetesVersion?: string | null | undefined;
|
|
262
|
+
evidence: {
|
|
263
|
+
kind: string;
|
|
264
|
+
fingerprintPrefix: string;
|
|
265
|
+
strength: string;
|
|
266
|
+
matched: boolean;
|
|
267
|
+
}[];
|
|
268
|
+
evidenceSource: "ACK_API" | "KUBECONFIG_CLI";
|
|
269
|
+
observedAt?: string | null | undefined;
|
|
270
|
+
receivedAt?: string | null | undefined;
|
|
271
|
+
disposition?: string | null | undefined;
|
|
272
|
+
};
|
|
273
|
+
candidate: {
|
|
274
|
+
candidateKey: string;
|
|
275
|
+
sourceKey: string;
|
|
276
|
+
status: "ADOPTED" | "AMBIGUOUS" | "IGNORED" | "LINKED" | "MATCHED" | "PENDING";
|
|
277
|
+
matchKind: string;
|
|
278
|
+
matchedClusterKey?: string | null | undefined;
|
|
279
|
+
observedName?: string | null | undefined;
|
|
280
|
+
provider: string;
|
|
281
|
+
providerClusterId?: string | null | undefined;
|
|
282
|
+
region?: string | null | undefined;
|
|
283
|
+
kubernetesVersion?: string | null | undefined;
|
|
284
|
+
evidence: {
|
|
285
|
+
kind: string;
|
|
286
|
+
fingerprintPrefix: string;
|
|
287
|
+
strength: string;
|
|
288
|
+
matched: boolean;
|
|
289
|
+
}[];
|
|
290
|
+
firstObservedAt?: string | null | undefined;
|
|
291
|
+
lastObservedAt?: string | null | undefined;
|
|
292
|
+
observationCount: number;
|
|
293
|
+
resolutionReason?: string | null | undefined;
|
|
294
|
+
reviewedBy?: string | null | undefined;
|
|
295
|
+
reviewedAt?: string | null | undefined;
|
|
296
|
+
version: number;
|
|
297
|
+
};
|
|
298
|
+
replayed: boolean;
|
|
299
|
+
}[];
|
|
300
|
+
observationCount: number;
|
|
301
|
+
candidateCount: number;
|
|
302
|
+
replayed: boolean;
|
|
303
|
+
}>;
|
|
304
|
+
adoptCandidate(candidateKey: string, input: ClusterAdoptRequest, idempotencyKey: string): Promise<{
|
|
305
|
+
action: "ADOPT" | "IGNORE" | "LINK";
|
|
306
|
+
candidate: {
|
|
307
|
+
candidateKey: string;
|
|
308
|
+
sourceKey: string;
|
|
309
|
+
status: "ADOPTED" | "AMBIGUOUS" | "IGNORED" | "LINKED" | "MATCHED" | "PENDING";
|
|
310
|
+
matchKind: string;
|
|
311
|
+
matchedClusterKey?: string | null | undefined;
|
|
312
|
+
observedName?: string | null | undefined;
|
|
313
|
+
provider: string;
|
|
314
|
+
providerClusterId?: string | null | undefined;
|
|
315
|
+
region?: string | null | undefined;
|
|
316
|
+
kubernetesVersion?: string | null | undefined;
|
|
317
|
+
evidence: {
|
|
318
|
+
kind: string;
|
|
319
|
+
fingerprintPrefix: string;
|
|
320
|
+
strength: string;
|
|
321
|
+
matched: boolean;
|
|
322
|
+
}[];
|
|
323
|
+
firstObservedAt?: string | null | undefined;
|
|
324
|
+
lastObservedAt?: string | null | undefined;
|
|
325
|
+
observationCount: number;
|
|
326
|
+
resolutionReason?: string | null | undefined;
|
|
327
|
+
reviewedBy?: string | null | undefined;
|
|
328
|
+
reviewedAt?: string | null | undefined;
|
|
329
|
+
version: number;
|
|
330
|
+
};
|
|
331
|
+
cluster?: {
|
|
332
|
+
id?: string | undefined;
|
|
333
|
+
clusterKey: string;
|
|
334
|
+
code: string;
|
|
335
|
+
name: string;
|
|
336
|
+
provider: string;
|
|
337
|
+
providerClusterId?: string | null | undefined;
|
|
338
|
+
region?: string | null | undefined;
|
|
339
|
+
status: string;
|
|
340
|
+
identityStatus: string;
|
|
341
|
+
endpointFingerprintPrefix?: string | null | undefined;
|
|
342
|
+
lastObservedAt?: string | null | undefined;
|
|
343
|
+
version: number;
|
|
344
|
+
} | null | undefined;
|
|
345
|
+
replayed: boolean;
|
|
346
|
+
decidedAt: string;
|
|
347
|
+
}>;
|
|
348
|
+
linkCandidate(candidateKey: string, input: ClusterLinkRequest, idempotencyKey: string): Promise<{
|
|
349
|
+
action: "ADOPT" | "IGNORE" | "LINK";
|
|
350
|
+
candidate: {
|
|
351
|
+
candidateKey: string;
|
|
352
|
+
sourceKey: string;
|
|
353
|
+
status: "ADOPTED" | "AMBIGUOUS" | "IGNORED" | "LINKED" | "MATCHED" | "PENDING";
|
|
354
|
+
matchKind: string;
|
|
355
|
+
matchedClusterKey?: string | null | undefined;
|
|
356
|
+
observedName?: string | null | undefined;
|
|
357
|
+
provider: string;
|
|
358
|
+
providerClusterId?: string | null | undefined;
|
|
359
|
+
region?: string | null | undefined;
|
|
360
|
+
kubernetesVersion?: string | null | undefined;
|
|
361
|
+
evidence: {
|
|
362
|
+
kind: string;
|
|
363
|
+
fingerprintPrefix: string;
|
|
364
|
+
strength: string;
|
|
365
|
+
matched: boolean;
|
|
366
|
+
}[];
|
|
367
|
+
firstObservedAt?: string | null | undefined;
|
|
368
|
+
lastObservedAt?: string | null | undefined;
|
|
369
|
+
observationCount: number;
|
|
370
|
+
resolutionReason?: string | null | undefined;
|
|
371
|
+
reviewedBy?: string | null | undefined;
|
|
372
|
+
reviewedAt?: string | null | undefined;
|
|
373
|
+
version: number;
|
|
374
|
+
};
|
|
375
|
+
cluster?: {
|
|
376
|
+
id?: string | undefined;
|
|
377
|
+
clusterKey: string;
|
|
378
|
+
code: string;
|
|
379
|
+
name: string;
|
|
380
|
+
provider: string;
|
|
381
|
+
providerClusterId?: string | null | undefined;
|
|
382
|
+
region?: string | null | undefined;
|
|
383
|
+
status: string;
|
|
384
|
+
identityStatus: string;
|
|
385
|
+
endpointFingerprintPrefix?: string | null | undefined;
|
|
386
|
+
lastObservedAt?: string | null | undefined;
|
|
387
|
+
version: number;
|
|
388
|
+
} | null | undefined;
|
|
389
|
+
replayed: boolean;
|
|
390
|
+
decidedAt: string;
|
|
391
|
+
}>;
|
|
392
|
+
ignoreCandidate(candidateKey: string, input: ClusterIgnoreRequest, idempotencyKey: string): Promise<{
|
|
393
|
+
action: "ADOPT" | "IGNORE" | "LINK";
|
|
394
|
+
candidate: {
|
|
395
|
+
candidateKey: string;
|
|
396
|
+
sourceKey: string;
|
|
397
|
+
status: "ADOPTED" | "AMBIGUOUS" | "IGNORED" | "LINKED" | "MATCHED" | "PENDING";
|
|
398
|
+
matchKind: string;
|
|
399
|
+
matchedClusterKey?: string | null | undefined;
|
|
400
|
+
observedName?: string | null | undefined;
|
|
401
|
+
provider: string;
|
|
402
|
+
providerClusterId?: string | null | undefined;
|
|
403
|
+
region?: string | null | undefined;
|
|
404
|
+
kubernetesVersion?: string | null | undefined;
|
|
405
|
+
evidence: {
|
|
406
|
+
kind: string;
|
|
407
|
+
fingerprintPrefix: string;
|
|
408
|
+
strength: string;
|
|
409
|
+
matched: boolean;
|
|
410
|
+
}[];
|
|
411
|
+
firstObservedAt?: string | null | undefined;
|
|
412
|
+
lastObservedAt?: string | null | undefined;
|
|
413
|
+
observationCount: number;
|
|
414
|
+
resolutionReason?: string | null | undefined;
|
|
415
|
+
reviewedBy?: string | null | undefined;
|
|
416
|
+
reviewedAt?: string | null | undefined;
|
|
417
|
+
version: number;
|
|
418
|
+
};
|
|
419
|
+
cluster?: {
|
|
420
|
+
id?: string | undefined;
|
|
421
|
+
clusterKey: string;
|
|
422
|
+
code: string;
|
|
423
|
+
name: string;
|
|
424
|
+
provider: string;
|
|
425
|
+
providerClusterId?: string | null | undefined;
|
|
426
|
+
region?: string | null | undefined;
|
|
427
|
+
status: string;
|
|
428
|
+
identityStatus: string;
|
|
429
|
+
endpointFingerprintPrefix?: string | null | undefined;
|
|
430
|
+
lastObservedAt?: string | null | undefined;
|
|
431
|
+
version: number;
|
|
432
|
+
} | null | undefined;
|
|
433
|
+
replayed: boolean;
|
|
434
|
+
decidedAt: string;
|
|
435
|
+
}>;
|
|
436
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { resolveBackendUrl } from "../backend.js";
|
|
2
|
+
import { ensureAccessToken, fetchWithKeycloakIdentity } from "../oauth.js";
|
|
3
|
+
import { ClusterError } from "./errors.js";
|
|
4
|
+
import { ClusterAdoptRequestSchema, ClusterApiErrorSchema, ClusterCandidateDecisionViewSchema, ClusterCandidatePageSchema, ClusterCandidateViewSchema, ClusterDetailSchema, ClusterDiscoveryRunViewSchema, ClusterIgnoreRequestSchema, ClusterLinkRequestSchema, ClusterObservationBatchReceiptSchema, ClusterObservationBatchRequestSchema, ClusterObservationPageSchema, ClusterObservationViewSchema, ClusterSourceCreateSchema, ClusterSourceListSchema, ClusterSourceUpdateSchema, ClusterSourceViewSchema, ClusterSummaryListSchema } from "./schemas.js";
|
|
5
|
+
export const CLUSTER_CONTROL_PLANE_API_ROOT = "/api/v1/cluster-control-plane";
|
|
6
|
+
export const CLUSTER_CONTROL_PLANE_CONTRACT_VERSION = "v1";
|
|
7
|
+
function safeIdentifier(value, label) {
|
|
8
|
+
const trimmed = value.trim();
|
|
9
|
+
if (!trimmed || trimmed.length > 256 || !/^[A-Za-z0-9][A-Za-z0-9._:-]*$/u.test(trimmed)) {
|
|
10
|
+
throw new ClusterError(`${label} must be a stable platform identifier.`, "CLUSTER_CLI_INPUT_INVALID");
|
|
11
|
+
}
|
|
12
|
+
return trimmed;
|
|
13
|
+
}
|
|
14
|
+
function safeIdempotencyKey(value) {
|
|
15
|
+
const trimmed = value.trim();
|
|
16
|
+
if (!trimmed || trimmed.length > 200 || !/^[A-Za-z0-9][A-Za-z0-9._:/+-]*$/u.test(trimmed)) {
|
|
17
|
+
throw new ClusterError("idempotency-key must be 1-200 safe opaque characters.", "CLUSTER_IDEMPOTENCY_INVALID");
|
|
18
|
+
}
|
|
19
|
+
return trimmed;
|
|
20
|
+
}
|
|
21
|
+
function positiveInteger(value, label, maximum) {
|
|
22
|
+
if (value == null)
|
|
23
|
+
return undefined;
|
|
24
|
+
if (!Number.isInteger(value) || value < 1 || value > maximum) {
|
|
25
|
+
throw new ClusterError(`${label} must be an integer between 1 and ${maximum}.`, "CLUSTER_CLI_INPUT_INVALID");
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
function queryPath(path, values) {
|
|
30
|
+
const query = new URLSearchParams();
|
|
31
|
+
for (const [key, value] of Object.entries(values)) {
|
|
32
|
+
if (value != null && value !== "")
|
|
33
|
+
query.set(key, String(value));
|
|
34
|
+
}
|
|
35
|
+
return query.size ? `${path}?${query.toString()}` : path;
|
|
36
|
+
}
|
|
37
|
+
async function responseBody(response) {
|
|
38
|
+
const text = await response.text();
|
|
39
|
+
if (!text)
|
|
40
|
+
return {};
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(text);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function requestIdFrom(response, body) {
|
|
49
|
+
if (body && typeof body === "object" && "requestId" in body && typeof body.requestId === "string")
|
|
50
|
+
return body.requestId;
|
|
51
|
+
return response.headers.get("x-request-id") ?? undefined;
|
|
52
|
+
}
|
|
53
|
+
function apiFailure(response, body) {
|
|
54
|
+
const parsed = ClusterApiErrorSchema.safeParse(body);
|
|
55
|
+
return new ClusterError(parsed.success && parsed.data.message
|
|
56
|
+
? `Cluster Control Plane HTTP ${response.status}: ${parsed.data.message}`
|
|
57
|
+
: `Cluster Control Plane request failed with HTTP ${response.status}.`, parsed.success ? parsed.data.code ?? "CLUSTER_API_ERROR" : "CLUSTER_API_ERROR", response.status, requestIdFrom(response, body), parsed.success ? parsed.data.details : undefined);
|
|
58
|
+
}
|
|
59
|
+
function shouldRetryUnknown(error) {
|
|
60
|
+
if (error instanceof ClusterError) {
|
|
61
|
+
return [502, 503, 504].includes(error.status ?? 0) || /RESULT_UNKNOWN/u.test(error.code);
|
|
62
|
+
}
|
|
63
|
+
return error instanceof TypeError || (error instanceof Error && error.name === "AbortError");
|
|
64
|
+
}
|
|
65
|
+
export class ClusterControlPlaneClient {
|
|
66
|
+
config;
|
|
67
|
+
fetchImpl;
|
|
68
|
+
tokenProvider;
|
|
69
|
+
constructor(config, dependencies = {}) {
|
|
70
|
+
this.config = config;
|
|
71
|
+
this.fetchImpl = dependencies.fetch ?? fetch;
|
|
72
|
+
this.tokenProvider = dependencies.tokenProvider ?? ensureAccessToken;
|
|
73
|
+
}
|
|
74
|
+
async authenticatedFetch(path, init = {}) {
|
|
75
|
+
const method = String(init.method ?? "GET").toUpperCase();
|
|
76
|
+
const url = resolveBackendUrl(this.config, { method, path });
|
|
77
|
+
const headers = new Headers(init.headers);
|
|
78
|
+
headers.set("Accept", "application/json");
|
|
79
|
+
headers.set("X-Numa-Cluster-Contract", CLUSTER_CONTROL_PLANE_CONTRACT_VERSION);
|
|
80
|
+
if (init.body != null)
|
|
81
|
+
headers.set("Content-Type", "application/json");
|
|
82
|
+
return fetchWithKeycloakIdentity(this.config, url, () => ({ ...init, headers }), {
|
|
83
|
+
fetch: this.fetchImpl,
|
|
84
|
+
tokenProvider: this.tokenProvider
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async json(path, schema, init = {}, expectedStatuses) {
|
|
88
|
+
const response = await this.authenticatedFetch(path, init);
|
|
89
|
+
const body = await responseBody(response);
|
|
90
|
+
if (!response.ok)
|
|
91
|
+
throw apiFailure(response, body);
|
|
92
|
+
if (expectedStatuses && !expectedStatuses.includes(response.status)) {
|
|
93
|
+
throw new ClusterError(`Cluster Control Plane returned HTTP ${response.status}; expected ${expectedStatuses.join(" or ")}.`, "CLUSTER_INVALID_RESPONSE", response.status, requestIdFrom(response, body));
|
|
94
|
+
}
|
|
95
|
+
const parsed = schema.safeParse(body);
|
|
96
|
+
if (!parsed.success) {
|
|
97
|
+
throw new ClusterError(`Cluster Control Plane returned an invalid response: ${parsed.error.message}`, "CLUSTER_INVALID_RESPONSE", response.status, requestIdFrom(response, body));
|
|
98
|
+
}
|
|
99
|
+
return parsed.data;
|
|
100
|
+
}
|
|
101
|
+
async mutation(path, schema, method, body, idempotencyKey, expectedStatuses) {
|
|
102
|
+
const key = safeIdempotencyKey(idempotencyKey);
|
|
103
|
+
const serialized = body == null ? undefined : JSON.stringify(body);
|
|
104
|
+
let lastError;
|
|
105
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
106
|
+
try {
|
|
107
|
+
return await this.json(path, schema, {
|
|
108
|
+
method,
|
|
109
|
+
headers: { "Idempotency-Key": key },
|
|
110
|
+
...(serialized == null ? {} : { body: serialized })
|
|
111
|
+
}, expectedStatuses);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
lastError = error;
|
|
115
|
+
if (!shouldRetryUnknown(error) || attempt === 1)
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (shouldRetryUnknown(lastError)) {
|
|
120
|
+
throw new ClusterError("Cluster mutation result is unknown. Retry the same command with the same Idempotency-Key and unchanged input.", "CLUSTER_RESULT_UNKNOWN", lastError instanceof ClusterError ? lastError.status : undefined, lastError instanceof ClusterError ? lastError.requestId : undefined);
|
|
121
|
+
}
|
|
122
|
+
throw lastError;
|
|
123
|
+
}
|
|
124
|
+
listClusters() {
|
|
125
|
+
return this.json(`${CLUSTER_CONTROL_PLANE_API_ROOT}/clusters`, ClusterSummaryListSchema);
|
|
126
|
+
}
|
|
127
|
+
getCluster(clusterKey) {
|
|
128
|
+
return this.json(`${CLUSTER_CONTROL_PLANE_API_ROOT}/clusters/${encodeURIComponent(safeIdentifier(clusterKey, "cluster-key"))}`, ClusterDetailSchema);
|
|
129
|
+
}
|
|
130
|
+
listSources() {
|
|
131
|
+
return this.json(`${CLUSTER_CONTROL_PLANE_API_ROOT}/sources`, ClusterSourceListSchema);
|
|
132
|
+
}
|
|
133
|
+
getSource(sourceKey) {
|
|
134
|
+
return this.json(`${CLUSTER_CONTROL_PLANE_API_ROOT}/sources/${encodeURIComponent(safeIdentifier(sourceKey, "source-key"))}`, ClusterSourceViewSchema);
|
|
135
|
+
}
|
|
136
|
+
listCandidates(options = {}) {
|
|
137
|
+
return this.json(queryPath(`${CLUSTER_CONTROL_PLANE_API_ROOT}/candidates`, {
|
|
138
|
+
status: options.status,
|
|
139
|
+
sourceKey: options.sourceKey,
|
|
140
|
+
page: positiveInteger(options.page, "page", 1_000_000),
|
|
141
|
+
size: positiveInteger(options.size, "size", 100)
|
|
142
|
+
}), ClusterCandidatePageSchema);
|
|
143
|
+
}
|
|
144
|
+
getCandidate(candidateKey) {
|
|
145
|
+
return this.json(`${CLUSTER_CONTROL_PLANE_API_ROOT}/candidates/${encodeURIComponent(safeIdentifier(candidateKey, "candidate-key"))}`, ClusterCandidateViewSchema);
|
|
146
|
+
}
|
|
147
|
+
listObservations(options = {}) {
|
|
148
|
+
return this.json(queryPath(`${CLUSTER_CONTROL_PLANE_API_ROOT}/observations`, {
|
|
149
|
+
sourceKey: options.sourceKey,
|
|
150
|
+
candidateKey: options.candidateKey,
|
|
151
|
+
page: positiveInteger(options.page, "page", 1_000_000),
|
|
152
|
+
size: positiveInteger(options.size, "size", 100)
|
|
153
|
+
}), ClusterObservationPageSchema);
|
|
154
|
+
}
|
|
155
|
+
getObservation(observationKey) {
|
|
156
|
+
return this.json(`${CLUSTER_CONTROL_PLANE_API_ROOT}/observations/${encodeURIComponent(safeIdentifier(observationKey, "observation-key"))}`, ClusterObservationViewSchema);
|
|
157
|
+
}
|
|
158
|
+
createSource(input, idempotencyKey) {
|
|
159
|
+
const parsed = ClusterSourceCreateSchema.safeParse(input);
|
|
160
|
+
if (!parsed.success)
|
|
161
|
+
throw new ClusterError(`Source input is invalid: ${parsed.error.message}`, "CLUSTER_CLI_INPUT_INVALID");
|
|
162
|
+
return this.mutation(`${CLUSTER_CONTROL_PLANE_API_ROOT}/sources`, ClusterSourceViewSchema, "POST", parsed.data, idempotencyKey, [201]);
|
|
163
|
+
}
|
|
164
|
+
updateSource(sourceKey, input, idempotencyKey) {
|
|
165
|
+
const parsed = ClusterSourceUpdateSchema.safeParse(input);
|
|
166
|
+
if (!parsed.success)
|
|
167
|
+
throw new ClusterError(`Source update is invalid: ${parsed.error.message}`, "CLUSTER_CLI_INPUT_INVALID");
|
|
168
|
+
const source = encodeURIComponent(safeIdentifier(sourceKey, "source-key"));
|
|
169
|
+
return this.mutation(`${CLUSTER_CONTROL_PLANE_API_ROOT}/sources/${source}`, ClusterSourceViewSchema, "PUT", parsed.data, idempotencyKey, [200]);
|
|
170
|
+
}
|
|
171
|
+
discoverSource(sourceKey, idempotencyKey) {
|
|
172
|
+
const source = encodeURIComponent(safeIdentifier(sourceKey, "source-key"));
|
|
173
|
+
return this.mutation(`${CLUSTER_CONTROL_PLANE_API_ROOT}/sources/${source}/discover`, ClusterDiscoveryRunViewSchema, "POST", undefined, idempotencyKey, [202]);
|
|
174
|
+
}
|
|
175
|
+
getRun(runNo) {
|
|
176
|
+
return this.json(`${CLUSTER_CONTROL_PLANE_API_ROOT}/runs/${encodeURIComponent(safeIdentifier(runNo, "run-no"))}`, ClusterDiscoveryRunViewSchema);
|
|
177
|
+
}
|
|
178
|
+
submitObservations(sourceKey, input, idempotencyKey) {
|
|
179
|
+
const parsed = ClusterObservationBatchRequestSchema.safeParse(input);
|
|
180
|
+
if (!parsed.success)
|
|
181
|
+
throw new ClusterError(`Observation plan is invalid: ${parsed.error.message}`, "CLUSTER_PLAN_INVALID");
|
|
182
|
+
const source = encodeURIComponent(safeIdentifier(sourceKey, "source-key"));
|
|
183
|
+
return this.mutation(`${CLUSTER_CONTROL_PLANE_API_ROOT}/sources/${source}/observations`, ClusterObservationBatchReceiptSchema, "POST", parsed.data, idempotencyKey, [202]);
|
|
184
|
+
}
|
|
185
|
+
adoptCandidate(candidateKey, input, idempotencyKey) {
|
|
186
|
+
const parsed = ClusterAdoptRequestSchema.safeParse(input);
|
|
187
|
+
if (!parsed.success)
|
|
188
|
+
throw new ClusterError(`Adopt input is invalid: ${parsed.error.message}`, "CLUSTER_CLI_INPUT_INVALID");
|
|
189
|
+
const candidate = encodeURIComponent(safeIdentifier(candidateKey, "candidate-key"));
|
|
190
|
+
return this.mutation(`${CLUSTER_CONTROL_PLANE_API_ROOT}/candidates/${candidate}/adopt`, ClusterCandidateDecisionViewSchema, "POST", parsed.data, idempotencyKey, [200]);
|
|
191
|
+
}
|
|
192
|
+
linkCandidate(candidateKey, input, idempotencyKey) {
|
|
193
|
+
const parsed = ClusterLinkRequestSchema.safeParse(input);
|
|
194
|
+
if (!parsed.success)
|
|
195
|
+
throw new ClusterError(`Link input is invalid: ${parsed.error.message}`, "CLUSTER_CLI_INPUT_INVALID");
|
|
196
|
+
const candidate = encodeURIComponent(safeIdentifier(candidateKey, "candidate-key"));
|
|
197
|
+
return this.mutation(`${CLUSTER_CONTROL_PLANE_API_ROOT}/candidates/${candidate}/link`, ClusterCandidateDecisionViewSchema, "POST", parsed.data, idempotencyKey, [200]);
|
|
198
|
+
}
|
|
199
|
+
ignoreCandidate(candidateKey, input, idempotencyKey) {
|
|
200
|
+
const parsed = ClusterIgnoreRequestSchema.safeParse(input);
|
|
201
|
+
if (!parsed.success)
|
|
202
|
+
throw new ClusterError(`Ignore input is invalid: ${parsed.error.message}`, "CLUSTER_CLI_INPUT_INVALID");
|
|
203
|
+
const candidate = encodeURIComponent(safeIdentifier(candidateKey, "candidate-key"));
|
|
204
|
+
return this.mutation(`${CLUSTER_CONTROL_PLANE_API_ROOT}/candidates/${candidate}/ignore`, ClusterCandidateDecisionViewSchema, "POST", parsed.data, idempotencyKey, [200]);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/clusters/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAA8B,MAAM,aAAa,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,kCAAkC,EAClC,0BAA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D,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,IAAI,YAAY,CAAC,0BAA0B,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,2BAA2B,CAAC,CAAC;QAC3H,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,8BAA8B,eAAe,SAAS,OAAO,EAAE,kCAAkC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzK,CAAC;IAED,eAAe,CAAC,YAAoB,EAAE,KAA2B,EAAE,cAAsB;QACvF,MAAM,MAAM,GAAG,0BAA0B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,IAAI,YAAY,CAAC,4BAA4B,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,2BAA2B,CAAC,CAAC;QAC7H,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,8BAA8B,eAAe,SAAS,SAAS,EAAE,kCAAkC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3K,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { ClusterControlPlaneClient } from "./client.js";
|
|
3
|
+
import { type KubeconfigDiscoveryOptions, type LocalKubeconfigDiscoveryPlan } from "./kubeconfig-discovery.js";
|
|
4
|
+
export interface ClusterCommandDependencies {
|
|
5
|
+
clientFactory?: () => ClusterControlPlaneClient;
|
|
6
|
+
discoverKubeconfig?: (options: KubeconfigDiscoveryOptions) => Promise<LocalKubeconfigDiscoveryPlan>;
|
|
7
|
+
readPlan?: (path: string) => Promise<unknown>;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseClusterIdentifier(value: string | undefined, label: string): string;
|
|
10
|
+
export declare function parseClusterIdempotencyKey(value: string | undefined): string;
|
|
11
|
+
export declare function registerClusterCommands(program: Command, dependencies?: ClusterCommandDependencies): void;
|