sealos-cli 0.1.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/LICENSE +191 -0
- package/README.md +234 -0
- package/dist/bin/cli.cjs +2066 -0
- package/dist/bin/cli.d.cts +1 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.mjs +2044 -0
- package/dist/main.cjs +2079 -0
- package/dist/main.d.cts +7 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.mjs +2045 -0
- package/package.json +112 -0
- package/src/bin/cli.ts +4 -0
- package/src/commands/app/index.ts +22 -0
- package/src/commands/auth/index.ts +124 -0
- package/src/commands/auth/login.ts +35 -0
- package/src/commands/auth/logout.ts +23 -0
- package/src/commands/auth/whoami.ts +38 -0
- package/src/commands/config/index.ts +54 -0
- package/src/commands/database/index.ts +881 -0
- package/src/commands/devbox/index.ts +224 -0
- package/src/commands/quota/index.ts +22 -0
- package/src/commands/s3/index.ts +35 -0
- package/src/commands/template/index.ts +314 -0
- package/src/commands/workspace/index.ts +84 -0
- package/src/docs/database_openapi.json +8297 -0
- package/src/docs/template_openapi.json +1 -0
- package/src/generated/database.ts +3969 -0
- package/src/generated/template.ts +1007 -0
- package/src/lib/api-client.ts +64 -0
- package/src/lib/api.ts +83 -0
- package/src/lib/auth.ts +570 -0
- package/src/lib/config.ts +134 -0
- package/src/lib/constants.ts +1 -0
- package/src/lib/errors.ts +105 -0
- package/src/lib/oauth.ts +197 -0
- package/src/lib/output.ts +93 -0
- package/src/lib/with-auth.ts +56 -0
- package/src/main.ts +51 -0
- package/src/types/index.ts +56 -0
|
@@ -0,0 +1,1007 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by openapi-typescript.
|
|
3
|
+
* Do not make direct changes to the file.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface paths {
|
|
7
|
+
"/templates": {
|
|
8
|
+
parameters: {
|
|
9
|
+
query?: never;
|
|
10
|
+
header?: never;
|
|
11
|
+
path?: never;
|
|
12
|
+
cookie?: never;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* List all templates
|
|
16
|
+
* @description Returns metadata only (no resource calculation). Response headers: `Cache-Control` (public, max-age=300, s-maxage=600), `ETag`. When categories exist, top category keys are returned in `X-Menu-Keys` (comma-separated). For full details including resource requirements, use `/templates/{name}`.
|
|
17
|
+
*/
|
|
18
|
+
get: operations["listTemplates"];
|
|
19
|
+
put?: never;
|
|
20
|
+
post?: never;
|
|
21
|
+
delete?: never;
|
|
22
|
+
options?: never;
|
|
23
|
+
head?: never;
|
|
24
|
+
patch?: never;
|
|
25
|
+
trace?: never;
|
|
26
|
+
};
|
|
27
|
+
"/templates/{name}": {
|
|
28
|
+
parameters: {
|
|
29
|
+
query?: never;
|
|
30
|
+
header?: never;
|
|
31
|
+
path?: never;
|
|
32
|
+
cookie?: never;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Get template details
|
|
36
|
+
* @description Returns complete template metadata with dynamically calculated resource requirements (CPU, memory, storage, NodePort count) derived from the template YAML. Falls back to static configuration if calculation fails. Response headers: `Cache-Control` (public, max-age=300, s-maxage=600), `ETag`.
|
|
37
|
+
*/
|
|
38
|
+
get: operations["getTemplate"];
|
|
39
|
+
put?: never;
|
|
40
|
+
post?: never;
|
|
41
|
+
delete?: never;
|
|
42
|
+
options?: never;
|
|
43
|
+
head?: never;
|
|
44
|
+
patch?: never;
|
|
45
|
+
trace?: never;
|
|
46
|
+
};
|
|
47
|
+
"/templates/raw": {
|
|
48
|
+
parameters: {
|
|
49
|
+
query?: never;
|
|
50
|
+
header?: never;
|
|
51
|
+
path?: never;
|
|
52
|
+
cookie?: never;
|
|
53
|
+
};
|
|
54
|
+
get?: never;
|
|
55
|
+
put?: never;
|
|
56
|
+
/**
|
|
57
|
+
* Deploy template from raw YAML
|
|
58
|
+
* @description Deploy an arbitrary or custom template by supplying its raw YAML directly in the request body. The instance name is auto-generated from `${{ random(8) }}` inside `spec.defaults.app_name`. Use `dryRun: true` to validate the resources against the Kubernetes API without creating anything.
|
|
59
|
+
*
|
|
60
|
+
* **Example — dry-run a custom template:**
|
|
61
|
+
* ```json
|
|
62
|
+
* {
|
|
63
|
+
* "yaml": "apiVersion: app.sealos.io/v1\nkind: Template\n...",
|
|
64
|
+
* "dryRun": true
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
post: operations["deployRawTemplate"];
|
|
69
|
+
delete?: never;
|
|
70
|
+
options?: never;
|
|
71
|
+
head?: never;
|
|
72
|
+
patch?: never;
|
|
73
|
+
trace?: never;
|
|
74
|
+
};
|
|
75
|
+
"/templates/instances": {
|
|
76
|
+
parameters: {
|
|
77
|
+
query?: never;
|
|
78
|
+
header?: never;
|
|
79
|
+
path?: never;
|
|
80
|
+
cookie?: never;
|
|
81
|
+
};
|
|
82
|
+
get?: never;
|
|
83
|
+
put?: never;
|
|
84
|
+
/**
|
|
85
|
+
* Create template instance
|
|
86
|
+
* @description Deploy a named instance of a template into the user's Kubernetes namespace. User-provided `args` are merged with the template's declared defaults — only args with no default value are required. The `args` field in the response reflects the fully resolved values after applying defaults.
|
|
87
|
+
*
|
|
88
|
+
* **Example — create a Perplexica instance:**
|
|
89
|
+
* ```json
|
|
90
|
+
* {
|
|
91
|
+
* "name": "my-app-instance",
|
|
92
|
+
* "template": "perplexica",
|
|
93
|
+
* "args": {
|
|
94
|
+
* "OPENAI_API_KEY": "<your-api-key>",
|
|
95
|
+
* "OPENAI_MODEL_NAME": "gpt-4o"
|
|
96
|
+
* }
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
post: operations["createInstance"];
|
|
101
|
+
delete?: never;
|
|
102
|
+
options?: never;
|
|
103
|
+
head?: never;
|
|
104
|
+
patch?: never;
|
|
105
|
+
trace?: never;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export type webhooks = Record<string, never>;
|
|
109
|
+
export interface components {
|
|
110
|
+
schemas: never;
|
|
111
|
+
responses: never;
|
|
112
|
+
parameters: never;
|
|
113
|
+
requestBodies: never;
|
|
114
|
+
headers: never;
|
|
115
|
+
pathItems: never;
|
|
116
|
+
}
|
|
117
|
+
export type $defs = Record<string, never>;
|
|
118
|
+
export interface operations {
|
|
119
|
+
listTemplates: {
|
|
120
|
+
parameters: {
|
|
121
|
+
query?: {
|
|
122
|
+
/** @description Language code for internationalization (e.g., "en", "zh"). Defaults to "en" */
|
|
123
|
+
language?: string;
|
|
124
|
+
};
|
|
125
|
+
header?: never;
|
|
126
|
+
path?: never;
|
|
127
|
+
cookie?: never;
|
|
128
|
+
};
|
|
129
|
+
requestBody?: never;
|
|
130
|
+
responses: {
|
|
131
|
+
/** @description Successfully retrieved template list */
|
|
132
|
+
200: {
|
|
133
|
+
headers: {
|
|
134
|
+
/** @description Caching directive: public, max-age=300, s-maxage=600 */
|
|
135
|
+
"Cache-Control"?: string;
|
|
136
|
+
/** @description Entity tag for caching, format: "template-list-{language}" */
|
|
137
|
+
ETag?: string;
|
|
138
|
+
/** @description Top category keys (comma-separated). Present only when categories exist. */
|
|
139
|
+
"X-Menu-Keys"?: string;
|
|
140
|
+
[name: string]: unknown;
|
|
141
|
+
};
|
|
142
|
+
content: {
|
|
143
|
+
"application/json": {
|
|
144
|
+
/** @description Unique template identifier */
|
|
145
|
+
name: string;
|
|
146
|
+
/**
|
|
147
|
+
* @description Resource type, always "template"
|
|
148
|
+
* @constant
|
|
149
|
+
*/
|
|
150
|
+
resourceType: "template";
|
|
151
|
+
/** @description URL to README documentation. Empty string when not available. */
|
|
152
|
+
readme: string;
|
|
153
|
+
/** @description URL to template icon image. Empty string when not available. */
|
|
154
|
+
icon: string;
|
|
155
|
+
/** @description Brief description of the template */
|
|
156
|
+
description: string;
|
|
157
|
+
/** @description Git repository URL. Empty string when not available. */
|
|
158
|
+
gitRepo: string;
|
|
159
|
+
/** @description Template categories (e.g., ["ai", "database"]) */
|
|
160
|
+
category: string[];
|
|
161
|
+
/** @description Arguments required for template deployment */
|
|
162
|
+
args: {
|
|
163
|
+
[key: string]: {
|
|
164
|
+
/** @description Human-readable explanation of the argument */
|
|
165
|
+
description: string;
|
|
166
|
+
/** @description Argument type (e.g. "string", "number", "boolean", "password") */
|
|
167
|
+
type: string;
|
|
168
|
+
/** @description Default value used during deployment */
|
|
169
|
+
default: string;
|
|
170
|
+
/** @description Whether this argument is mandatory */
|
|
171
|
+
required: boolean;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
/** @description Number of deployments (includes multiplier for display) */
|
|
175
|
+
deployCount: number;
|
|
176
|
+
}[];
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
/** @description Internal server error */
|
|
180
|
+
500: {
|
|
181
|
+
headers: {
|
|
182
|
+
[name: string]: unknown;
|
|
183
|
+
};
|
|
184
|
+
content: {
|
|
185
|
+
"application/json": {
|
|
186
|
+
error: {
|
|
187
|
+
/**
|
|
188
|
+
* @description High-level error type for categorization
|
|
189
|
+
* @enum {string}
|
|
190
|
+
*/
|
|
191
|
+
type: "internal_error";
|
|
192
|
+
/**
|
|
193
|
+
* @description Specific error code for programmatic handling and i18n
|
|
194
|
+
* @enum {string}
|
|
195
|
+
*/
|
|
196
|
+
code: "INTERNAL_ERROR";
|
|
197
|
+
/** @description Human-readable error message */
|
|
198
|
+
message: string;
|
|
199
|
+
/** @description Raw error string from the underlying system, for troubleshooting. */
|
|
200
|
+
details?: string;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
getTemplate: {
|
|
208
|
+
parameters: {
|
|
209
|
+
query?: {
|
|
210
|
+
/** @description Language code for internationalization (e.g., "en", "zh"). Defaults to "en" */
|
|
211
|
+
language?: string;
|
|
212
|
+
};
|
|
213
|
+
header?: never;
|
|
214
|
+
path: {
|
|
215
|
+
/** @description Template name identifier (e.g., "perplexica", "yourls") */
|
|
216
|
+
name: string;
|
|
217
|
+
};
|
|
218
|
+
cookie?: never;
|
|
219
|
+
};
|
|
220
|
+
requestBody?: never;
|
|
221
|
+
responses: {
|
|
222
|
+
/** @description Successfully retrieved template details */
|
|
223
|
+
200: {
|
|
224
|
+
headers: {
|
|
225
|
+
/** @description Caching directive: public, max-age=300, s-maxage=600 */
|
|
226
|
+
"Cache-Control"?: string;
|
|
227
|
+
/** @description Entity tag for caching, format: "{name}-{language}" */
|
|
228
|
+
ETag?: string;
|
|
229
|
+
[name: string]: unknown;
|
|
230
|
+
};
|
|
231
|
+
content: {
|
|
232
|
+
"application/json": {
|
|
233
|
+
/** @description Unique template identifier */
|
|
234
|
+
name: string;
|
|
235
|
+
/**
|
|
236
|
+
* @description Resource type, always "template"
|
|
237
|
+
* @constant
|
|
238
|
+
*/
|
|
239
|
+
resourceType: "template";
|
|
240
|
+
/** @description URL to README documentation. Empty string when not available. */
|
|
241
|
+
readme: string;
|
|
242
|
+
/** @description URL to template icon image. Empty string when not available. */
|
|
243
|
+
icon: string;
|
|
244
|
+
/** @description Brief description of the template */
|
|
245
|
+
description: string;
|
|
246
|
+
/** @description Git repository URL. Empty string when not available. */
|
|
247
|
+
gitRepo: string;
|
|
248
|
+
/** @description Template categories (e.g., ["ai", "database"]) */
|
|
249
|
+
category: string[];
|
|
250
|
+
/** @description Arguments required for template deployment */
|
|
251
|
+
args: {
|
|
252
|
+
[key: string]: {
|
|
253
|
+
/** @description Human-readable explanation of the argument */
|
|
254
|
+
description: string;
|
|
255
|
+
/** @description Argument type (e.g. "string", "number", "boolean", "password") */
|
|
256
|
+
type: string;
|
|
257
|
+
/** @description Default value used during deployment */
|
|
258
|
+
default: string;
|
|
259
|
+
/** @description Whether this argument is mandatory */
|
|
260
|
+
required: boolean;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
/** @description Number of deployments (includes multiplier for display) */
|
|
264
|
+
deployCount: number;
|
|
265
|
+
/** @description Calculated resource requirements */
|
|
266
|
+
quota: {
|
|
267
|
+
/** @description Required CPU cores in vCPU */
|
|
268
|
+
cpu: number;
|
|
269
|
+
/** @description Required memory in GiB */
|
|
270
|
+
memory: number;
|
|
271
|
+
/** @description Required storage in GiB */
|
|
272
|
+
storage: number;
|
|
273
|
+
/** @description Number of NodePort services required */
|
|
274
|
+
nodeport: number;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
/** @description Bad request - template name is required */
|
|
280
|
+
400: {
|
|
281
|
+
headers: {
|
|
282
|
+
[name: string]: unknown;
|
|
283
|
+
};
|
|
284
|
+
content: {
|
|
285
|
+
"application/json": {
|
|
286
|
+
error: {
|
|
287
|
+
/**
|
|
288
|
+
* @description High-level error type for categorization
|
|
289
|
+
* @enum {string}
|
|
290
|
+
*/
|
|
291
|
+
type: "validation_error";
|
|
292
|
+
/**
|
|
293
|
+
* @description Specific error code for programmatic handling and i18n
|
|
294
|
+
* @enum {string}
|
|
295
|
+
*/
|
|
296
|
+
code: "INVALID_PARAMETER";
|
|
297
|
+
/** @description Human-readable error message */
|
|
298
|
+
message: string;
|
|
299
|
+
/** @description For INVALID_PARAMETER: Array<{ field, message }>. For INVALID_VALUE: optional string. Omitted for other codes. */
|
|
300
|
+
details?: {
|
|
301
|
+
/** @description Field path using dot/bracket notation, e.g. "ports[0].number" */
|
|
302
|
+
field: string;
|
|
303
|
+
/** @description Validation error message for this field */
|
|
304
|
+
message: string;
|
|
305
|
+
}[] | string;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
/** @description Template not found */
|
|
311
|
+
404: {
|
|
312
|
+
headers: {
|
|
313
|
+
[name: string]: unknown;
|
|
314
|
+
};
|
|
315
|
+
content: {
|
|
316
|
+
"application/json": {
|
|
317
|
+
error: {
|
|
318
|
+
/**
|
|
319
|
+
* @description High-level error type for categorization
|
|
320
|
+
* @constant
|
|
321
|
+
*/
|
|
322
|
+
type: "resource_error";
|
|
323
|
+
/**
|
|
324
|
+
* @description Specific error code for programmatic handling and i18n
|
|
325
|
+
* @constant
|
|
326
|
+
*/
|
|
327
|
+
code: "NOT_FOUND";
|
|
328
|
+
/** @description Human-readable error message */
|
|
329
|
+
message: string;
|
|
330
|
+
/** @description Typically omitted. May contain additional context in edge cases. */
|
|
331
|
+
details?: string;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
/** @description Internal server error */
|
|
337
|
+
500: {
|
|
338
|
+
headers: {
|
|
339
|
+
[name: string]: unknown;
|
|
340
|
+
};
|
|
341
|
+
content: {
|
|
342
|
+
"application/json": {
|
|
343
|
+
error: {
|
|
344
|
+
/**
|
|
345
|
+
* @description High-level error type for categorization
|
|
346
|
+
* @enum {string}
|
|
347
|
+
*/
|
|
348
|
+
type: "internal_error";
|
|
349
|
+
/**
|
|
350
|
+
* @description Specific error code for programmatic handling and i18n
|
|
351
|
+
* @enum {string}
|
|
352
|
+
*/
|
|
353
|
+
code: "INTERNAL_ERROR";
|
|
354
|
+
/** @description Human-readable error message */
|
|
355
|
+
message: string;
|
|
356
|
+
/** @description Raw error string from the underlying system, for troubleshooting. */
|
|
357
|
+
details?: string;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
deployRawTemplate: {
|
|
365
|
+
parameters: {
|
|
366
|
+
query?: never;
|
|
367
|
+
header?: never;
|
|
368
|
+
path?: never;
|
|
369
|
+
cookie?: never;
|
|
370
|
+
};
|
|
371
|
+
/** @description Template deployment configuration */
|
|
372
|
+
requestBody: {
|
|
373
|
+
content: {
|
|
374
|
+
"application/json": {
|
|
375
|
+
/**
|
|
376
|
+
* @description Full template YAML string. Must start with a `kind: Template` document, followed by one or more `---`-separated Kubernetes resource documents.
|
|
377
|
+
* @example apiVersion: app.sealos.io/v1
|
|
378
|
+
* kind: Template
|
|
379
|
+
* metadata:
|
|
380
|
+
* name: my-app
|
|
381
|
+
* spec:
|
|
382
|
+
* defaults:
|
|
383
|
+
* app_name:
|
|
384
|
+
* type: string
|
|
385
|
+
* value: my-app-${{ random(8) }}
|
|
386
|
+
* ---
|
|
387
|
+
* apiVersion: apps/v1
|
|
388
|
+
* kind: Deployment
|
|
389
|
+
* metadata:
|
|
390
|
+
* name: ${{ defaults.app_name }}
|
|
391
|
+
* spec:
|
|
392
|
+
* replicas: 1
|
|
393
|
+
* selector:
|
|
394
|
+
* matchLabels:
|
|
395
|
+
* app: ${{ defaults.app_name }}
|
|
396
|
+
* template:
|
|
397
|
+
* metadata:
|
|
398
|
+
* labels:
|
|
399
|
+
* app: ${{ defaults.app_name }}
|
|
400
|
+
* spec:
|
|
401
|
+
* containers:
|
|
402
|
+
* - name: app
|
|
403
|
+
* image: nginx:latest
|
|
404
|
+
* resources:
|
|
405
|
+
* limits:
|
|
406
|
+
* cpu: 100m
|
|
407
|
+
* memory: 256Mi
|
|
408
|
+
*/
|
|
409
|
+
yaml: string;
|
|
410
|
+
/**
|
|
411
|
+
* @description Template variable key-value pairs that override or supply `spec.inputs` fields. Only args without a non-empty default are required.
|
|
412
|
+
* @example {
|
|
413
|
+
* "MY_SECRET": "my-secret-value"
|
|
414
|
+
* }
|
|
415
|
+
*/
|
|
416
|
+
args?: {
|
|
417
|
+
[key: string]: string;
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* @description If true, validates the resources against the Kubernetes API but does not create anything. Returns 200 with a preview. Default: false.
|
|
421
|
+
* @example true
|
|
422
|
+
*/
|
|
423
|
+
dryRun?: boolean;
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
responses: {
|
|
428
|
+
/** @description Dry-run preview — resources validated but not created */
|
|
429
|
+
200: {
|
|
430
|
+
headers: {
|
|
431
|
+
[name: string]: unknown;
|
|
432
|
+
};
|
|
433
|
+
content: {
|
|
434
|
+
"application/json": {
|
|
435
|
+
/** @description Auto-generated instance name from ${{ random(8) }} in spec.defaults */
|
|
436
|
+
name: string;
|
|
437
|
+
/**
|
|
438
|
+
* @description Always "instance"
|
|
439
|
+
* @constant
|
|
440
|
+
*/
|
|
441
|
+
resourceType: "instance";
|
|
442
|
+
/**
|
|
443
|
+
* @description Always true for dry-run responses
|
|
444
|
+
* @constant
|
|
445
|
+
*/
|
|
446
|
+
dryRun: true;
|
|
447
|
+
/** @description Resolved template arguments after merging user-provided values with defaults */
|
|
448
|
+
args: {
|
|
449
|
+
[key: string]: string;
|
|
450
|
+
};
|
|
451
|
+
/** @description Preview of sub-resources that would be created (Instance resource excluded) */
|
|
452
|
+
resources?: {
|
|
453
|
+
/** @description Resource name */
|
|
454
|
+
name: string;
|
|
455
|
+
/** @description Kubernetes UID */
|
|
456
|
+
uid: string;
|
|
457
|
+
/** @description Resource type (lowercase k8s kind) */
|
|
458
|
+
resourceType: string;
|
|
459
|
+
/** @description Resource quota (for Deployment/StatefulSet/Cluster) */
|
|
460
|
+
quota?: {
|
|
461
|
+
/** @description CPU cores */
|
|
462
|
+
cpu?: number;
|
|
463
|
+
/** @description Memory in GiB */
|
|
464
|
+
memory?: number;
|
|
465
|
+
/** @description Storage in GiB */
|
|
466
|
+
storage?: number;
|
|
467
|
+
/** @description Number of replicas */
|
|
468
|
+
replicas?: number;
|
|
469
|
+
};
|
|
470
|
+
}[];
|
|
471
|
+
};
|
|
472
|
+
};
|
|
473
|
+
};
|
|
474
|
+
/** @description Template deployed successfully */
|
|
475
|
+
201: {
|
|
476
|
+
headers: {
|
|
477
|
+
[name: string]: unknown;
|
|
478
|
+
};
|
|
479
|
+
content: {
|
|
480
|
+
"application/json": {
|
|
481
|
+
/** @description Instance name (matches the name specified in the request) */
|
|
482
|
+
name: string;
|
|
483
|
+
/** @description Kubernetes UID of the Instance resource */
|
|
484
|
+
uid: string;
|
|
485
|
+
/**
|
|
486
|
+
* @description Always "instance"
|
|
487
|
+
* @constant
|
|
488
|
+
*/
|
|
489
|
+
resourceType: "instance";
|
|
490
|
+
/** @description Display name */
|
|
491
|
+
displayName: string;
|
|
492
|
+
/** @description ISO 8601 creation timestamp */
|
|
493
|
+
createdAt: string;
|
|
494
|
+
/** @description Resolved template arguments after merging user-provided values with defaults */
|
|
495
|
+
args: {
|
|
496
|
+
[key: string]: string;
|
|
497
|
+
};
|
|
498
|
+
/** @description Sub-resources created for this instance */
|
|
499
|
+
resources?: {
|
|
500
|
+
/** @description Resource name */
|
|
501
|
+
name: string;
|
|
502
|
+
/** @description Kubernetes UID */
|
|
503
|
+
uid: string;
|
|
504
|
+
/** @description Resource type (lowercase k8s kind) */
|
|
505
|
+
resourceType: string;
|
|
506
|
+
/** @description Resource quota (for Deployment/StatefulSet/Cluster) */
|
|
507
|
+
quota?: {
|
|
508
|
+
/** @description CPU cores */
|
|
509
|
+
cpu?: number;
|
|
510
|
+
/** @description Memory in GiB */
|
|
511
|
+
memory?: number;
|
|
512
|
+
/** @description Storage in GiB */
|
|
513
|
+
storage?: number;
|
|
514
|
+
/** @description Number of replicas */
|
|
515
|
+
replicas?: number;
|
|
516
|
+
};
|
|
517
|
+
}[];
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
};
|
|
521
|
+
/** @description Bad request — missing or invalid YAML / missing required args */
|
|
522
|
+
400: {
|
|
523
|
+
headers: {
|
|
524
|
+
[name: string]: unknown;
|
|
525
|
+
};
|
|
526
|
+
content: {
|
|
527
|
+
"application/json": {
|
|
528
|
+
error: {
|
|
529
|
+
/**
|
|
530
|
+
* @description High-level error type for categorization
|
|
531
|
+
* @enum {string}
|
|
532
|
+
*/
|
|
533
|
+
type: "validation_error";
|
|
534
|
+
/**
|
|
535
|
+
* @description Specific error code for programmatic handling and i18n
|
|
536
|
+
* @enum {string}
|
|
537
|
+
*/
|
|
538
|
+
code: "INVALID_PARAMETER" | "INVALID_VALUE";
|
|
539
|
+
/** @description Human-readable error message */
|
|
540
|
+
message: string;
|
|
541
|
+
/** @description For INVALID_PARAMETER: Array<{ field, message }>. For INVALID_VALUE: optional string. Omitted for other codes. */
|
|
542
|
+
details?: {
|
|
543
|
+
/** @description Field path using dot/bracket notation, e.g. "ports[0].number" */
|
|
544
|
+
field: string;
|
|
545
|
+
/** @description Validation error message for this field */
|
|
546
|
+
message: string;
|
|
547
|
+
}[] | string;
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
/** @description Unauthorized — missing or invalid kubeconfig */
|
|
553
|
+
401: {
|
|
554
|
+
headers: {
|
|
555
|
+
[name: string]: unknown;
|
|
556
|
+
};
|
|
557
|
+
content: {
|
|
558
|
+
"application/json": {
|
|
559
|
+
error: {
|
|
560
|
+
/**
|
|
561
|
+
* @description High-level error type for categorization
|
|
562
|
+
* @constant
|
|
563
|
+
*/
|
|
564
|
+
type: "authentication_error";
|
|
565
|
+
/**
|
|
566
|
+
* @description Specific error code for programmatic handling and i18n
|
|
567
|
+
* @constant
|
|
568
|
+
*/
|
|
569
|
+
code: "AUTHENTICATION_REQUIRED";
|
|
570
|
+
/** @description Human-readable error message */
|
|
571
|
+
message: string;
|
|
572
|
+
/** @description Typically omitted. May contain additional context in edge cases. */
|
|
573
|
+
details?: string;
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
/** @description Forbidden — insufficient permissions */
|
|
579
|
+
403: {
|
|
580
|
+
headers: {
|
|
581
|
+
[name: string]: unknown;
|
|
582
|
+
};
|
|
583
|
+
content: {
|
|
584
|
+
"application/json": {
|
|
585
|
+
error: {
|
|
586
|
+
/**
|
|
587
|
+
* @description High-level error type for categorization
|
|
588
|
+
* @constant
|
|
589
|
+
*/
|
|
590
|
+
type: "authorization_error";
|
|
591
|
+
/**
|
|
592
|
+
* @description Specific error code for programmatic handling and i18n
|
|
593
|
+
* @enum {string}
|
|
594
|
+
*/
|
|
595
|
+
code: "PERMISSION_DENIED";
|
|
596
|
+
/** @description Human-readable error message */
|
|
597
|
+
message: string;
|
|
598
|
+
/** @description Typically omitted. May contain additional context in edge cases. */
|
|
599
|
+
details?: string;
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
};
|
|
604
|
+
/** @description Conflict — instance already exists */
|
|
605
|
+
409: {
|
|
606
|
+
headers: {
|
|
607
|
+
[name: string]: unknown;
|
|
608
|
+
};
|
|
609
|
+
content: {
|
|
610
|
+
"application/json": {
|
|
611
|
+
error: {
|
|
612
|
+
/**
|
|
613
|
+
* @description High-level error type for categorization
|
|
614
|
+
* @constant
|
|
615
|
+
*/
|
|
616
|
+
type: "resource_error";
|
|
617
|
+
/**
|
|
618
|
+
* @description Specific error code for programmatic handling and i18n
|
|
619
|
+
* @enum {string}
|
|
620
|
+
*/
|
|
621
|
+
code: "ALREADY_EXISTS";
|
|
622
|
+
/** @description Human-readable error message */
|
|
623
|
+
message: string;
|
|
624
|
+
/** @description Typically omitted. May contain additional context in edge cases. */
|
|
625
|
+
details?: string;
|
|
626
|
+
};
|
|
627
|
+
};
|
|
628
|
+
};
|
|
629
|
+
};
|
|
630
|
+
/** @description Unprocessable Entity — K8s rejected the resource spec */
|
|
631
|
+
422: {
|
|
632
|
+
headers: {
|
|
633
|
+
[name: string]: unknown;
|
|
634
|
+
};
|
|
635
|
+
content: {
|
|
636
|
+
"application/json": {
|
|
637
|
+
error: {
|
|
638
|
+
/**
|
|
639
|
+
* @description High-level error type for categorization
|
|
640
|
+
* @constant
|
|
641
|
+
*/
|
|
642
|
+
type: "operation_error";
|
|
643
|
+
/**
|
|
644
|
+
* @description Specific error code for programmatic handling and i18n
|
|
645
|
+
* @constant
|
|
646
|
+
*/
|
|
647
|
+
code: "INVALID_RESOURCE_SPEC";
|
|
648
|
+
/** @description Human-readable error message */
|
|
649
|
+
message: string;
|
|
650
|
+
/** @description Raw K8s rejection reason (admission webhook message, invalid field error, quota exceeded message). */
|
|
651
|
+
details?: string;
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
};
|
|
656
|
+
/** @description Internal Server Error */
|
|
657
|
+
500: {
|
|
658
|
+
headers: {
|
|
659
|
+
[name: string]: unknown;
|
|
660
|
+
};
|
|
661
|
+
content: {
|
|
662
|
+
"application/json": {
|
|
663
|
+
error: {
|
|
664
|
+
/**
|
|
665
|
+
* @description High-level error type for categorization
|
|
666
|
+
* @enum {string}
|
|
667
|
+
*/
|
|
668
|
+
type: "operation_error" | "internal_error";
|
|
669
|
+
/**
|
|
670
|
+
* @description Specific error code for programmatic handling and i18n
|
|
671
|
+
* @enum {string}
|
|
672
|
+
*/
|
|
673
|
+
code: "KUBERNETES_ERROR" | "INTERNAL_ERROR";
|
|
674
|
+
/** @description Human-readable error message */
|
|
675
|
+
message: string;
|
|
676
|
+
/** @description Raw error string from the underlying system, for troubleshooting. */
|
|
677
|
+
details?: string;
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
/** @description Service Unavailable — Kubernetes cluster temporarily unreachable */
|
|
683
|
+
503: {
|
|
684
|
+
headers: {
|
|
685
|
+
[name: string]: unknown;
|
|
686
|
+
};
|
|
687
|
+
content: {
|
|
688
|
+
"application/json": {
|
|
689
|
+
error: {
|
|
690
|
+
/**
|
|
691
|
+
* @description High-level error type for categorization
|
|
692
|
+
* @constant
|
|
693
|
+
*/
|
|
694
|
+
type: "internal_error";
|
|
695
|
+
/**
|
|
696
|
+
* @description Specific error code for programmatic handling and i18n
|
|
697
|
+
* @constant
|
|
698
|
+
*/
|
|
699
|
+
code: "SERVICE_UNAVAILABLE";
|
|
700
|
+
/** @description Human-readable error message */
|
|
701
|
+
message: string;
|
|
702
|
+
/** @description Raw connection error from the underlying system (e.g. ECONNREFUSED). */
|
|
703
|
+
details?: string;
|
|
704
|
+
};
|
|
705
|
+
};
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
};
|
|
709
|
+
};
|
|
710
|
+
createInstance: {
|
|
711
|
+
parameters: {
|
|
712
|
+
query?: never;
|
|
713
|
+
header?: never;
|
|
714
|
+
path?: never;
|
|
715
|
+
cookie?: never;
|
|
716
|
+
};
|
|
717
|
+
/** @description Instance creation configuration */
|
|
718
|
+
requestBody: {
|
|
719
|
+
content: {
|
|
720
|
+
"application/json": {
|
|
721
|
+
/**
|
|
722
|
+
* @description Instance name. 1–63 lowercase alphanumeric characters or hyphens, must start and end with alphanumeric (Kubernetes DNS subdomain rules). e.g. "my-perplexica-instance"
|
|
723
|
+
* @example my-perplexica-instance
|
|
724
|
+
*/
|
|
725
|
+
name: string;
|
|
726
|
+
/**
|
|
727
|
+
* @description Template name from the catalog. Use GET /templates to list available templates. e.g. "perplexica"
|
|
728
|
+
* @example perplexica
|
|
729
|
+
*/
|
|
730
|
+
template: string;
|
|
731
|
+
/**
|
|
732
|
+
* @description Template variable key-value pairs. Only args without a default value are required. Use GET /templates/{name} to see which args are required and their defaults.
|
|
733
|
+
* @example {
|
|
734
|
+
* "OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxxxxxx",
|
|
735
|
+
* "OPENAI_MODEL_NAME": "gpt-4o"
|
|
736
|
+
* }
|
|
737
|
+
*/
|
|
738
|
+
args?: {
|
|
739
|
+
[key: string]: string;
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
};
|
|
744
|
+
responses: {
|
|
745
|
+
/** @description Instance created successfully */
|
|
746
|
+
201: {
|
|
747
|
+
headers: {
|
|
748
|
+
[name: string]: unknown;
|
|
749
|
+
};
|
|
750
|
+
content: {
|
|
751
|
+
"application/json": {
|
|
752
|
+
/** @description Instance name (matches the name specified in the request) */
|
|
753
|
+
name: string;
|
|
754
|
+
/** @description Kubernetes UID of the Instance resource */
|
|
755
|
+
uid: string;
|
|
756
|
+
/**
|
|
757
|
+
* @description Always "instance"
|
|
758
|
+
* @constant
|
|
759
|
+
*/
|
|
760
|
+
resourceType: "instance";
|
|
761
|
+
/** @description Display name */
|
|
762
|
+
displayName: string;
|
|
763
|
+
/** @description ISO 8601 creation timestamp */
|
|
764
|
+
createdAt: string;
|
|
765
|
+
/** @description Resolved template arguments after merging user-provided values with defaults */
|
|
766
|
+
args: {
|
|
767
|
+
[key: string]: string;
|
|
768
|
+
};
|
|
769
|
+
/** @description Sub-resources created for this instance */
|
|
770
|
+
resources?: {
|
|
771
|
+
/** @description Resource name */
|
|
772
|
+
name: string;
|
|
773
|
+
/** @description Kubernetes UID */
|
|
774
|
+
uid: string;
|
|
775
|
+
/** @description Resource type (lowercase k8s kind) */
|
|
776
|
+
resourceType: string;
|
|
777
|
+
/** @description Resource quota (for Deployment/StatefulSet/Cluster) */
|
|
778
|
+
quota?: {
|
|
779
|
+
/** @description CPU cores */
|
|
780
|
+
cpu?: number;
|
|
781
|
+
/** @description Memory in GiB */
|
|
782
|
+
memory?: number;
|
|
783
|
+
/** @description Storage in GiB */
|
|
784
|
+
storage?: number;
|
|
785
|
+
/** @description Number of replicas */
|
|
786
|
+
replicas?: number;
|
|
787
|
+
};
|
|
788
|
+
}[];
|
|
789
|
+
};
|
|
790
|
+
};
|
|
791
|
+
};
|
|
792
|
+
/** @description Bad request - missing or invalid parameters */
|
|
793
|
+
400: {
|
|
794
|
+
headers: {
|
|
795
|
+
[name: string]: unknown;
|
|
796
|
+
};
|
|
797
|
+
content: {
|
|
798
|
+
"application/json": {
|
|
799
|
+
error: {
|
|
800
|
+
/**
|
|
801
|
+
* @description High-level error type for categorization
|
|
802
|
+
* @enum {string}
|
|
803
|
+
*/
|
|
804
|
+
type: "validation_error";
|
|
805
|
+
/**
|
|
806
|
+
* @description Specific error code for programmatic handling and i18n
|
|
807
|
+
* @enum {string}
|
|
808
|
+
*/
|
|
809
|
+
code: "INVALID_PARAMETER" | "INVALID_VALUE";
|
|
810
|
+
/** @description Human-readable error message */
|
|
811
|
+
message: string;
|
|
812
|
+
/** @description For INVALID_PARAMETER: Array<{ field, message }>. For INVALID_VALUE: optional string. Omitted for other codes. */
|
|
813
|
+
details?: {
|
|
814
|
+
/** @description Field path using dot/bracket notation, e.g. "ports[0].number" */
|
|
815
|
+
field: string;
|
|
816
|
+
/** @description Validation error message for this field */
|
|
817
|
+
message: string;
|
|
818
|
+
}[] | string;
|
|
819
|
+
};
|
|
820
|
+
};
|
|
821
|
+
};
|
|
822
|
+
};
|
|
823
|
+
/** @description Unauthorized - Missing or invalid kubeconfig */
|
|
824
|
+
401: {
|
|
825
|
+
headers: {
|
|
826
|
+
[name: string]: unknown;
|
|
827
|
+
};
|
|
828
|
+
content: {
|
|
829
|
+
"application/json": {
|
|
830
|
+
error: {
|
|
831
|
+
/**
|
|
832
|
+
* @description High-level error type for categorization
|
|
833
|
+
* @constant
|
|
834
|
+
*/
|
|
835
|
+
type: "authentication_error";
|
|
836
|
+
/**
|
|
837
|
+
* @description Specific error code for programmatic handling and i18n
|
|
838
|
+
* @constant
|
|
839
|
+
*/
|
|
840
|
+
code: "AUTHENTICATION_REQUIRED";
|
|
841
|
+
/** @description Human-readable error message */
|
|
842
|
+
message: string;
|
|
843
|
+
/** @description Typically omitted. May contain additional context in edge cases. */
|
|
844
|
+
details?: string;
|
|
845
|
+
};
|
|
846
|
+
};
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
/** @description Forbidden - Insufficient permissions */
|
|
850
|
+
403: {
|
|
851
|
+
headers: {
|
|
852
|
+
[name: string]: unknown;
|
|
853
|
+
};
|
|
854
|
+
content: {
|
|
855
|
+
"application/json": {
|
|
856
|
+
error: {
|
|
857
|
+
/**
|
|
858
|
+
* @description High-level error type for categorization
|
|
859
|
+
* @constant
|
|
860
|
+
*/
|
|
861
|
+
type: "authorization_error";
|
|
862
|
+
/**
|
|
863
|
+
* @description Specific error code for programmatic handling and i18n
|
|
864
|
+
* @enum {string}
|
|
865
|
+
*/
|
|
866
|
+
code: "PERMISSION_DENIED";
|
|
867
|
+
/** @description Human-readable error message */
|
|
868
|
+
message: string;
|
|
869
|
+
/** @description Typically omitted. May contain additional context in edge cases. */
|
|
870
|
+
details?: string;
|
|
871
|
+
};
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
};
|
|
875
|
+
/** @description Not Found - Template not found */
|
|
876
|
+
404: {
|
|
877
|
+
headers: {
|
|
878
|
+
[name: string]: unknown;
|
|
879
|
+
};
|
|
880
|
+
content: {
|
|
881
|
+
"application/json": {
|
|
882
|
+
error: {
|
|
883
|
+
/**
|
|
884
|
+
* @description High-level error type for categorization
|
|
885
|
+
* @constant
|
|
886
|
+
*/
|
|
887
|
+
type: "resource_error";
|
|
888
|
+
/**
|
|
889
|
+
* @description Specific error code for programmatic handling and i18n
|
|
890
|
+
* @constant
|
|
891
|
+
*/
|
|
892
|
+
code: "NOT_FOUND";
|
|
893
|
+
/** @description Human-readable error message */
|
|
894
|
+
message: string;
|
|
895
|
+
/** @description Typically omitted. May contain additional context in edge cases. */
|
|
896
|
+
details?: string;
|
|
897
|
+
};
|
|
898
|
+
};
|
|
899
|
+
};
|
|
900
|
+
};
|
|
901
|
+
/** @description Conflict - Instance already exists */
|
|
902
|
+
409: {
|
|
903
|
+
headers: {
|
|
904
|
+
[name: string]: unknown;
|
|
905
|
+
};
|
|
906
|
+
content: {
|
|
907
|
+
"application/json": {
|
|
908
|
+
error: {
|
|
909
|
+
/**
|
|
910
|
+
* @description High-level error type for categorization
|
|
911
|
+
* @constant
|
|
912
|
+
*/
|
|
913
|
+
type: "resource_error";
|
|
914
|
+
/**
|
|
915
|
+
* @description Specific error code for programmatic handling and i18n
|
|
916
|
+
* @enum {string}
|
|
917
|
+
*/
|
|
918
|
+
code: "ALREADY_EXISTS";
|
|
919
|
+
/** @description Human-readable error message */
|
|
920
|
+
message: string;
|
|
921
|
+
/** @description Typically omitted. May contain additional context in edge cases. */
|
|
922
|
+
details?: string;
|
|
923
|
+
};
|
|
924
|
+
};
|
|
925
|
+
};
|
|
926
|
+
};
|
|
927
|
+
/** @description Unprocessable Entity - K8s rejected the resource (admission webhook, invalid field, quota exceeded) */
|
|
928
|
+
422: {
|
|
929
|
+
headers: {
|
|
930
|
+
[name: string]: unknown;
|
|
931
|
+
};
|
|
932
|
+
content: {
|
|
933
|
+
"application/json": {
|
|
934
|
+
error: {
|
|
935
|
+
/**
|
|
936
|
+
* @description High-level error type for categorization
|
|
937
|
+
* @constant
|
|
938
|
+
*/
|
|
939
|
+
type: "operation_error";
|
|
940
|
+
/**
|
|
941
|
+
* @description Specific error code for programmatic handling and i18n
|
|
942
|
+
* @constant
|
|
943
|
+
*/
|
|
944
|
+
code: "INVALID_RESOURCE_SPEC";
|
|
945
|
+
/** @description Human-readable error message */
|
|
946
|
+
message: string;
|
|
947
|
+
/** @description Raw K8s rejection reason (admission webhook message, invalid field error, quota exceeded message). */
|
|
948
|
+
details?: string;
|
|
949
|
+
};
|
|
950
|
+
};
|
|
951
|
+
};
|
|
952
|
+
};
|
|
953
|
+
/** @description Internal Server Error - Kubernetes API error or unexpected failure */
|
|
954
|
+
500: {
|
|
955
|
+
headers: {
|
|
956
|
+
[name: string]: unknown;
|
|
957
|
+
};
|
|
958
|
+
content: {
|
|
959
|
+
"application/json": {
|
|
960
|
+
error: {
|
|
961
|
+
/**
|
|
962
|
+
* @description High-level error type for categorization
|
|
963
|
+
* @enum {string}
|
|
964
|
+
*/
|
|
965
|
+
type: "operation_error" | "internal_error";
|
|
966
|
+
/**
|
|
967
|
+
* @description Specific error code for programmatic handling and i18n
|
|
968
|
+
* @enum {string}
|
|
969
|
+
*/
|
|
970
|
+
code: "KUBERNETES_ERROR" | "OPERATION_FAILED" | "INTERNAL_ERROR";
|
|
971
|
+
/** @description Human-readable error message */
|
|
972
|
+
message: string;
|
|
973
|
+
/** @description Raw error string from the underlying system, for troubleshooting. */
|
|
974
|
+
details?: string;
|
|
975
|
+
};
|
|
976
|
+
};
|
|
977
|
+
};
|
|
978
|
+
};
|
|
979
|
+
/** @description Service Unavailable - Kubernetes cluster temporarily unreachable */
|
|
980
|
+
503: {
|
|
981
|
+
headers: {
|
|
982
|
+
[name: string]: unknown;
|
|
983
|
+
};
|
|
984
|
+
content: {
|
|
985
|
+
"application/json": {
|
|
986
|
+
error: {
|
|
987
|
+
/**
|
|
988
|
+
* @description High-level error type for categorization
|
|
989
|
+
* @constant
|
|
990
|
+
*/
|
|
991
|
+
type: "internal_error";
|
|
992
|
+
/**
|
|
993
|
+
* @description Specific error code for programmatic handling and i18n
|
|
994
|
+
* @constant
|
|
995
|
+
*/
|
|
996
|
+
code: "SERVICE_UNAVAILABLE";
|
|
997
|
+
/** @description Human-readable error message */
|
|
998
|
+
message: string;
|
|
999
|
+
/** @description Raw connection error from the underlying system (e.g. ECONNREFUSED). */
|
|
1000
|
+
details?: string;
|
|
1001
|
+
};
|
|
1002
|
+
};
|
|
1003
|
+
};
|
|
1004
|
+
};
|
|
1005
|
+
};
|
|
1006
|
+
};
|
|
1007
|
+
}
|