@phala/cloud 0.1.2 → 0.2.1-beta.1
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/dist/actions/cvms/commit_cvm_provision.d.ts +69 -21
- package/dist/actions/cvms/get_available_os_images.d.ts +217 -0
- package/dist/actions/cvms/get_cvm_list.d.ts +16 -16
- package/dist/actions/cvms/get_cvm_state.d.ts +93 -0
- package/dist/actions/cvms/provision_cvm.d.ts +132 -50
- package/dist/actions/cvms/update_os_image.d.ts +61 -0
- package/dist/actions/cvms/watch_cvm_state.d.ts +157 -0
- package/dist/actions/get_available_nodes.d.ts +11 -11
- package/dist/actions/get_current_user.d.ts +11 -11
- package/dist/actions/index.d.ts +6 -1
- package/dist/actions/kms/get_kms_list.d.ts +4 -4
- package/dist/actions/kms/next_app_ids.d.ts +73 -0
- package/dist/actions/list-instance-types.d.ts +295 -90
- package/dist/create-client.d.ts +81 -7
- package/dist/index.js +650 -219
- package/dist/index.mjs +620 -215
- package/dist/utils/define-action.d.ts +8 -8
- package/dist/utils/errors.d.ts +137 -20
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,19 @@ import { type Client } from "../../client";
|
|
|
4
4
|
* Commit CVM Provision (Create CVM from provisioned data)
|
|
5
5
|
*
|
|
6
6
|
* This action creates a CVM using previously provisioned data and encrypted environment variables.
|
|
7
|
-
* It
|
|
7
|
+
* It MUST be called after `provisionCvm` to complete the CVM deployment process.
|
|
8
|
+
*
|
|
9
|
+
* ## Two-Step Deployment Flow
|
|
10
|
+
*
|
|
11
|
+
* 1. **Provision** (`provisionCvm`): Prepares resources and returns `compose_hash` (and `app_id` for PHALA KMS)
|
|
12
|
+
* 2. **Commit** (this function): Creates the actual CVM using provisioned data
|
|
13
|
+
*
|
|
14
|
+
* ## KMS Type and app_id Source
|
|
15
|
+
*
|
|
16
|
+
* The `app_id` source depends on the KMS type used during provisioning:
|
|
17
|
+
*
|
|
18
|
+
* - **PHALA KMS** (default): `app_id` is obtained from centralized KMS - returned by `provisionCvm()`
|
|
19
|
+
* - **ETHEREUM/BASE KMS** (on-chain): `app_id` must be obtained by deploying your contract and interacting with the on-chain KMS - NOT provided by `provisionCvm()`
|
|
8
20
|
*
|
|
9
21
|
* @example
|
|
10
22
|
* ```typescript
|
|
@@ -12,20 +24,43 @@ import { type Client } from "../../client";
|
|
|
12
24
|
*
|
|
13
25
|
* const client = createClient();
|
|
14
26
|
*
|
|
15
|
-
* //
|
|
16
|
-
* const provision = await provisionCvm(client,
|
|
27
|
+
* // Example 1: PHALA KMS (default - app_id from provision)
|
|
28
|
+
* const provision = await provisionCvm(client, {
|
|
29
|
+
* name: "my-cvm",
|
|
30
|
+
* instance_type: "tdx.small",
|
|
31
|
+
* kms: "PHALA", // or omit for default
|
|
32
|
+
* compose_file: { docker_compose_file: "..." },
|
|
33
|
+
* });
|
|
17
34
|
*
|
|
18
|
-
* //
|
|
35
|
+
* // app_id is provided by provision API
|
|
19
36
|
* const cvm = await commitCvmProvision(client, {
|
|
20
|
-
*
|
|
21
|
-
* app_id: provision.app_id,
|
|
37
|
+
* app_id: provision.app_id, // From provision response
|
|
22
38
|
* compose_hash: provision.compose_hash,
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
39
|
+
* encrypted_env: "...",
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // Example 2: On-chain KMS (app_id from contract deployment)
|
|
43
|
+
* const provision = await provisionCvm(client, {
|
|
44
|
+
* name: "my-cvm",
|
|
45
|
+
* instance_type: "tdx.small",
|
|
46
|
+
* kms: "ETHEREUM", // or "BASE" for Base network
|
|
47
|
+
* compose_file: { docker_compose_file: "..." },
|
|
26
48
|
* });
|
|
27
49
|
*
|
|
28
|
-
*
|
|
50
|
+
* // Step 1: Deploy your contract and get app_id from on-chain KMS
|
|
51
|
+
* const contractTx = await deployContract({
|
|
52
|
+
* kmsContract: "0x...",
|
|
53
|
+
* // ... contract deployment params
|
|
54
|
+
* });
|
|
55
|
+
* const appId = await getAppIdFromKms(contractTx);
|
|
56
|
+
*
|
|
57
|
+
* // Step 2: Commit with app_id from on-chain interaction
|
|
58
|
+
* const cvm = await commitCvmProvision(client, {
|
|
59
|
+
* app_id: appId, // From on-chain KMS, NOT from provision
|
|
60
|
+
* compose_hash: provision.compose_hash, // From provision response
|
|
61
|
+
* contract_address: "0x123...", // Your deployed contract
|
|
62
|
+
* deployer_address: "0x456...", // Deployer address
|
|
63
|
+
* });
|
|
29
64
|
* ```
|
|
30
65
|
*
|
|
31
66
|
* ## Returns
|
|
@@ -34,9 +69,22 @@ import { type Client } from "../../client";
|
|
|
34
69
|
*
|
|
35
70
|
* The created CVM details including id, name, status, and other metadata. Return type depends on schema parameter.
|
|
36
71
|
*
|
|
37
|
-
* ## Parameters
|
|
72
|
+
* ## Required Parameters
|
|
73
|
+
*
|
|
74
|
+
* - **app_id**: Application identifier
|
|
75
|
+
* - For PHALA KMS: Use `provision.app_id` from `provisionCvm()` response
|
|
76
|
+
* - For ETHEREUM/BASE KMS (on-chain): Obtain from your on-chain KMS contract deployment
|
|
77
|
+
* - **compose_hash**: Must be obtained from `provisionCvm()` response (used to retrieve provision data from Redis)
|
|
78
|
+
*
|
|
79
|
+
* ## Optional Parameters
|
|
80
|
+
*
|
|
81
|
+
* - **encrypted_env**: Hex-encoded encrypted environment variables
|
|
82
|
+
* - **env_keys**: List of environment variable keys to allow
|
|
83
|
+
* - **kms_id**: KMS instance identifier (if using specific KMS)
|
|
84
|
+
* - **contract_address**: On-chain KMS contract address (required for ETHEREUM/BASE KMS)
|
|
85
|
+
* - **deployer_address**: Deployer address for on-chain verification (required for ETHEREUM/BASE KMS)
|
|
38
86
|
*
|
|
39
|
-
*
|
|
87
|
+
* ## Schema Parameter
|
|
40
88
|
*
|
|
41
89
|
* - **Type:** `ZodSchema | false`
|
|
42
90
|
* - **Default:** `CommitCvmProvisionSchema`
|
|
@@ -178,7 +226,7 @@ export type CommitCvmProvision = z.infer<typeof CommitCvmProvisionSchema>;
|
|
|
178
226
|
export declare const CommitCvmProvisionRequestSchema: z.ZodObject<{
|
|
179
227
|
encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
180
228
|
app_id: z.ZodString;
|
|
181
|
-
compose_hash: z.
|
|
229
|
+
compose_hash: z.ZodString;
|
|
182
230
|
kms_id: z.ZodOptional<z.ZodString>;
|
|
183
231
|
contract_address: z.ZodOptional<z.ZodString>;
|
|
184
232
|
deployer_address: z.ZodOptional<z.ZodString>;
|
|
@@ -186,7 +234,7 @@ export declare const CommitCvmProvisionRequestSchema: z.ZodObject<{
|
|
|
186
234
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
187
235
|
encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
188
236
|
app_id: z.ZodString;
|
|
189
|
-
compose_hash: z.
|
|
237
|
+
compose_hash: z.ZodString;
|
|
190
238
|
kms_id: z.ZodOptional<z.ZodString>;
|
|
191
239
|
contract_address: z.ZodOptional<z.ZodString>;
|
|
192
240
|
deployer_address: z.ZodOptional<z.ZodString>;
|
|
@@ -194,7 +242,7 @@ export declare const CommitCvmProvisionRequestSchema: z.ZodObject<{
|
|
|
194
242
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
195
243
|
encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
196
244
|
app_id: z.ZodString;
|
|
197
|
-
compose_hash: z.
|
|
245
|
+
compose_hash: z.ZodString;
|
|
198
246
|
kms_id: z.ZodOptional<z.ZodString>;
|
|
199
247
|
contract_address: z.ZodOptional<z.ZodString>;
|
|
200
248
|
deployer_address: z.ZodOptional<z.ZodString>;
|
|
@@ -205,7 +253,7 @@ declare const commitCvmProvision: {
|
|
|
205
253
|
(client: Client, params: z.objectOutputType<{
|
|
206
254
|
encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
207
255
|
app_id: z.ZodString;
|
|
208
|
-
compose_hash: z.
|
|
256
|
+
compose_hash: z.ZodString;
|
|
209
257
|
kms_id: z.ZodOptional<z.ZodString>;
|
|
210
258
|
contract_address: z.ZodOptional<z.ZodString>;
|
|
211
259
|
deployer_address: z.ZodOptional<z.ZodString>;
|
|
@@ -247,7 +295,7 @@ declare const commitCvmProvision: {
|
|
|
247
295
|
<T extends z.ZodTypeAny>(client: Client, params: z.objectOutputType<{
|
|
248
296
|
encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
249
297
|
app_id: z.ZodString;
|
|
250
|
-
compose_hash: z.
|
|
298
|
+
compose_hash: z.ZodString;
|
|
251
299
|
kms_id: z.ZodOptional<z.ZodString>;
|
|
252
300
|
contract_address: z.ZodOptional<z.ZodString>;
|
|
253
301
|
deployer_address: z.ZodOptional<z.ZodString>;
|
|
@@ -258,7 +306,7 @@ declare const commitCvmProvision: {
|
|
|
258
306
|
(client: Client, params: z.objectOutputType<{
|
|
259
307
|
encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
260
308
|
app_id: z.ZodString;
|
|
261
|
-
compose_hash: z.
|
|
309
|
+
compose_hash: z.ZodString;
|
|
262
310
|
kms_id: z.ZodOptional<z.ZodString>;
|
|
263
311
|
contract_address: z.ZodOptional<z.ZodString>;
|
|
264
312
|
deployer_address: z.ZodOptional<z.ZodString>;
|
|
@@ -270,7 +318,7 @@ declare const commitCvmProvision: {
|
|
|
270
318
|
(client: Client, params: z.objectOutputType<{
|
|
271
319
|
encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
272
320
|
app_id: z.ZodString;
|
|
273
|
-
compose_hash: z.
|
|
321
|
+
compose_hash: z.ZodString;
|
|
274
322
|
kms_id: z.ZodOptional<z.ZodString>;
|
|
275
323
|
contract_address: z.ZodOptional<z.ZodString>;
|
|
276
324
|
deployer_address: z.ZodOptional<z.ZodString>;
|
|
@@ -312,7 +360,7 @@ declare const commitCvmProvision: {
|
|
|
312
360
|
<T extends z.ZodTypeAny>(client: Client, params: z.objectOutputType<{
|
|
313
361
|
encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
314
362
|
app_id: z.ZodString;
|
|
315
|
-
compose_hash: z.
|
|
363
|
+
compose_hash: z.ZodString;
|
|
316
364
|
kms_id: z.ZodOptional<z.ZodString>;
|
|
317
365
|
contract_address: z.ZodOptional<z.ZodString>;
|
|
318
366
|
deployer_address: z.ZodOptional<z.ZodString>;
|
|
@@ -323,7 +371,7 @@ declare const commitCvmProvision: {
|
|
|
323
371
|
(client: Client, params: z.objectOutputType<{
|
|
324
372
|
encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
325
373
|
app_id: z.ZodString;
|
|
326
|
-
compose_hash: z.
|
|
374
|
+
compose_hash: z.ZodString;
|
|
327
375
|
kms_id: z.ZodOptional<z.ZodString>;
|
|
328
376
|
contract_address: z.ZodOptional<z.ZodString>;
|
|
329
377
|
deployer_address: z.ZodOptional<z.ZodString>;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type CvmIdInput } from "../../types/cvm_id";
|
|
3
|
+
/**
|
|
4
|
+
* OS image variant (prod or dev)
|
|
5
|
+
*/
|
|
6
|
+
export declare const OSImageVariantSchema: z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
9
|
+
is_current: z.ZodBoolean;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
name: string;
|
|
12
|
+
os_image_hash: string | null;
|
|
13
|
+
is_current: boolean;
|
|
14
|
+
}, {
|
|
15
|
+
name: string;
|
|
16
|
+
os_image_hash: string | null;
|
|
17
|
+
is_current: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
export type OSImageVariant = z.infer<typeof OSImageVariantSchema>;
|
|
20
|
+
/**
|
|
21
|
+
* Available OS image information with prod/dev variants
|
|
22
|
+
*/
|
|
23
|
+
export declare const AvailableOSImageSchema: z.ZodObject<{
|
|
24
|
+
version: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>]>;
|
|
25
|
+
prod: z.ZodNullable<z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
28
|
+
is_current: z.ZodBoolean;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
name: string;
|
|
31
|
+
os_image_hash: string | null;
|
|
32
|
+
is_current: boolean;
|
|
33
|
+
}, {
|
|
34
|
+
name: string;
|
|
35
|
+
os_image_hash: string | null;
|
|
36
|
+
is_current: boolean;
|
|
37
|
+
}>>;
|
|
38
|
+
dev: z.ZodNullable<z.ZodObject<{
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
41
|
+
is_current: z.ZodBoolean;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
name: string;
|
|
44
|
+
os_image_hash: string | null;
|
|
45
|
+
is_current: boolean;
|
|
46
|
+
}, {
|
|
47
|
+
name: string;
|
|
48
|
+
os_image_hash: string | null;
|
|
49
|
+
is_current: boolean;
|
|
50
|
+
}>>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
version: [number, number, number] | [number, number, number, number];
|
|
53
|
+
prod: {
|
|
54
|
+
name: string;
|
|
55
|
+
os_image_hash: string | null;
|
|
56
|
+
is_current: boolean;
|
|
57
|
+
} | null;
|
|
58
|
+
dev: {
|
|
59
|
+
name: string;
|
|
60
|
+
os_image_hash: string | null;
|
|
61
|
+
is_current: boolean;
|
|
62
|
+
} | null;
|
|
63
|
+
}, {
|
|
64
|
+
version: [number, number, number] | [number, number, number, number];
|
|
65
|
+
prod: {
|
|
66
|
+
name: string;
|
|
67
|
+
os_image_hash: string | null;
|
|
68
|
+
is_current: boolean;
|
|
69
|
+
} | null;
|
|
70
|
+
dev: {
|
|
71
|
+
name: string;
|
|
72
|
+
os_image_hash: string | null;
|
|
73
|
+
is_current: boolean;
|
|
74
|
+
} | null;
|
|
75
|
+
}>;
|
|
76
|
+
export type AvailableOSImage = z.infer<typeof AvailableOSImageSchema>;
|
|
77
|
+
/**
|
|
78
|
+
* Response schema for available OS images
|
|
79
|
+
*/
|
|
80
|
+
export declare const GetAvailableOSImagesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
81
|
+
version: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>]>;
|
|
82
|
+
prod: z.ZodNullable<z.ZodObject<{
|
|
83
|
+
name: z.ZodString;
|
|
84
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
85
|
+
is_current: z.ZodBoolean;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
name: string;
|
|
88
|
+
os_image_hash: string | null;
|
|
89
|
+
is_current: boolean;
|
|
90
|
+
}, {
|
|
91
|
+
name: string;
|
|
92
|
+
os_image_hash: string | null;
|
|
93
|
+
is_current: boolean;
|
|
94
|
+
}>>;
|
|
95
|
+
dev: z.ZodNullable<z.ZodObject<{
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
98
|
+
is_current: z.ZodBoolean;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
name: string;
|
|
101
|
+
os_image_hash: string | null;
|
|
102
|
+
is_current: boolean;
|
|
103
|
+
}, {
|
|
104
|
+
name: string;
|
|
105
|
+
os_image_hash: string | null;
|
|
106
|
+
is_current: boolean;
|
|
107
|
+
}>>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
version: [number, number, number] | [number, number, number, number];
|
|
110
|
+
prod: {
|
|
111
|
+
name: string;
|
|
112
|
+
os_image_hash: string | null;
|
|
113
|
+
is_current: boolean;
|
|
114
|
+
} | null;
|
|
115
|
+
dev: {
|
|
116
|
+
name: string;
|
|
117
|
+
os_image_hash: string | null;
|
|
118
|
+
is_current: boolean;
|
|
119
|
+
} | null;
|
|
120
|
+
}, {
|
|
121
|
+
version: [number, number, number] | [number, number, number, number];
|
|
122
|
+
prod: {
|
|
123
|
+
name: string;
|
|
124
|
+
os_image_hash: string | null;
|
|
125
|
+
is_current: boolean;
|
|
126
|
+
} | null;
|
|
127
|
+
dev: {
|
|
128
|
+
name: string;
|
|
129
|
+
os_image_hash: string | null;
|
|
130
|
+
is_current: boolean;
|
|
131
|
+
} | null;
|
|
132
|
+
}>, "many">;
|
|
133
|
+
export type GetAvailableOSImagesResponse = z.infer<typeof GetAvailableOSImagesResponseSchema>;
|
|
134
|
+
export declare const GetAvailableOSImagesRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
135
|
+
id: z.ZodOptional<z.ZodString>;
|
|
136
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
137
|
+
app_id: z.ZodOptional<z.ZodString>;
|
|
138
|
+
instance_id: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
id?: string | undefined;
|
|
141
|
+
app_id?: string | undefined;
|
|
142
|
+
instance_id?: string | undefined;
|
|
143
|
+
uuid?: string | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
id?: string | undefined;
|
|
146
|
+
app_id?: string | undefined;
|
|
147
|
+
instance_id?: string | undefined;
|
|
148
|
+
uuid?: string | undefined;
|
|
149
|
+
}>, any, any>, {
|
|
150
|
+
cvmId: string;
|
|
151
|
+
}, any>;
|
|
152
|
+
export type GetAvailableOSImagesRequest = CvmIdInput;
|
|
153
|
+
/**
|
|
154
|
+
* Get available OS images for CVM upgrade
|
|
155
|
+
*
|
|
156
|
+
* Returns list of OS images that this CVM can upgrade to.
|
|
157
|
+
* The response includes only images that:
|
|
158
|
+
* 1. Are deployed on the CVM's teepod
|
|
159
|
+
* 2. Are allowed by the CVM's KMS if applicable
|
|
160
|
+
* 3. Follow dev/non-dev upgrade rules
|
|
161
|
+
* 4. Match GPU requirements
|
|
162
|
+
*
|
|
163
|
+
* @param client - The API client
|
|
164
|
+
* @param request - Request parameters
|
|
165
|
+
* @param request.cvmId - ID of the CVM
|
|
166
|
+
* @returns Array of available OS images grouped by version
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* const images = await getAvailableOsImages(client, { cvmId: "cvm-123" })
|
|
171
|
+
* console.log(images[0].version) // [0, 3, 5]
|
|
172
|
+
* console.log(images[0].prod?.name) // "prod-0.3.5"
|
|
173
|
+
* console.log(images[0].dev?.name) // "dev-0.3.5"
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
declare const getAvailableOsImages: {
|
|
177
|
+
(client: import("../..").BaseClient, params: CvmIdInput): Promise<{
|
|
178
|
+
version: [number, number, number] | [number, number, number, number];
|
|
179
|
+
prod: {
|
|
180
|
+
name: string;
|
|
181
|
+
os_image_hash: string | null;
|
|
182
|
+
is_current: boolean;
|
|
183
|
+
} | null;
|
|
184
|
+
dev: {
|
|
185
|
+
name: string;
|
|
186
|
+
os_image_hash: string | null;
|
|
187
|
+
is_current: boolean;
|
|
188
|
+
} | null;
|
|
189
|
+
}[]>;
|
|
190
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
191
|
+
schema: T;
|
|
192
|
+
}): Promise<z.TypeOf<T>>;
|
|
193
|
+
(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
194
|
+
schema: false;
|
|
195
|
+
}): Promise<unknown>;
|
|
196
|
+
}, safeGetAvailableOsImages: {
|
|
197
|
+
(client: import("../..").BaseClient, params: CvmIdInput): Promise<import("../..").SafeResult<{
|
|
198
|
+
version: [number, number, number] | [number, number, number, number];
|
|
199
|
+
prod: {
|
|
200
|
+
name: string;
|
|
201
|
+
os_image_hash: string | null;
|
|
202
|
+
is_current: boolean;
|
|
203
|
+
} | null;
|
|
204
|
+
dev: {
|
|
205
|
+
name: string;
|
|
206
|
+
os_image_hash: string | null;
|
|
207
|
+
is_current: boolean;
|
|
208
|
+
} | null;
|
|
209
|
+
}[]>>;
|
|
210
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
211
|
+
schema: T;
|
|
212
|
+
}): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
213
|
+
(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
214
|
+
schema: false;
|
|
215
|
+
}): Promise<import("../..").SafeResult<unknown>>;
|
|
216
|
+
};
|
|
217
|
+
export { getAvailableOsImages, safeGetAvailableOsImages };
|
|
@@ -8,15 +8,15 @@ export declare const GetCvmListRequestSchema: z.ZodObject<{
|
|
|
8
8
|
user_id: z.ZodOptional<z.ZodString>;
|
|
9
9
|
}, "strict", z.ZodTypeAny, {
|
|
10
10
|
teepod_id?: number | undefined;
|
|
11
|
+
user_id?: string | undefined;
|
|
11
12
|
page?: number | undefined;
|
|
12
13
|
page_size?: number | undefined;
|
|
13
|
-
user_id?: string | undefined;
|
|
14
14
|
node_id?: number | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
teepod_id?: number | undefined;
|
|
17
|
+
user_id?: string | undefined;
|
|
17
18
|
page?: number | undefined;
|
|
18
19
|
page_size?: number | undefined;
|
|
19
|
-
user_id?: string | undefined;
|
|
20
20
|
node_id?: number | undefined;
|
|
21
21
|
}>;
|
|
22
22
|
export declare const GetCvmListSchema: z.ZodObject<{
|
|
@@ -262,8 +262,6 @@ export declare const GetCvmListSchema: z.ZodObject<{
|
|
|
262
262
|
page_size: z.ZodNumber;
|
|
263
263
|
pages: z.ZodNumber;
|
|
264
264
|
}, "strict", z.ZodTypeAny, {
|
|
265
|
-
page: number;
|
|
266
|
-
page_size: number;
|
|
267
265
|
items: {
|
|
268
266
|
status: string;
|
|
269
267
|
name: string;
|
|
@@ -318,10 +316,10 @@ export declare const GetCvmListSchema: z.ZodObject<{
|
|
|
318
316
|
}[];
|
|
319
317
|
}[];
|
|
320
318
|
total: number;
|
|
321
|
-
pages: number;
|
|
322
|
-
}, {
|
|
323
319
|
page: number;
|
|
324
320
|
page_size: number;
|
|
321
|
+
pages: number;
|
|
322
|
+
}, {
|
|
325
323
|
items: {
|
|
326
324
|
status: string;
|
|
327
325
|
name: string;
|
|
@@ -376,6 +374,8 @@ export declare const GetCvmListSchema: z.ZodObject<{
|
|
|
376
374
|
allow_upgrade?: boolean | undefined;
|
|
377
375
|
}[];
|
|
378
376
|
total: number;
|
|
377
|
+
page: number;
|
|
378
|
+
page_size: number;
|
|
379
379
|
pages: number;
|
|
380
380
|
}>;
|
|
381
381
|
export type GetCvmListRequest = z.infer<typeof GetCvmListRequestSchema>;
|
|
@@ -405,13 +405,11 @@ export type GetCvmListResponse = z.infer<typeof GetCvmListSchema>;
|
|
|
405
405
|
declare const getCvmList: {
|
|
406
406
|
(client: Client, params?: {
|
|
407
407
|
teepod_id?: number | undefined;
|
|
408
|
+
user_id?: string | undefined;
|
|
408
409
|
page?: number | undefined;
|
|
409
410
|
page_size?: number | undefined;
|
|
410
|
-
user_id?: string | undefined;
|
|
411
411
|
node_id?: number | undefined;
|
|
412
412
|
} | undefined): Promise<{
|
|
413
|
-
page: number;
|
|
414
|
-
page_size: number;
|
|
415
413
|
items: {
|
|
416
414
|
status: string;
|
|
417
415
|
name: string;
|
|
@@ -466,22 +464,24 @@ declare const getCvmList: {
|
|
|
466
464
|
}[];
|
|
467
465
|
}[];
|
|
468
466
|
total: number;
|
|
467
|
+
page: number;
|
|
468
|
+
page_size: number;
|
|
469
469
|
pages: number;
|
|
470
470
|
}>;
|
|
471
471
|
<T extends z.ZodTypeAny>(client: Client, params?: {
|
|
472
472
|
teepod_id?: number | undefined;
|
|
473
|
+
user_id?: string | undefined;
|
|
473
474
|
page?: number | undefined;
|
|
474
475
|
page_size?: number | undefined;
|
|
475
|
-
user_id?: string | undefined;
|
|
476
476
|
node_id?: number | undefined;
|
|
477
477
|
} | undefined, parameters?: {
|
|
478
478
|
schema: T;
|
|
479
479
|
} | undefined): Promise<z.TypeOf<T>>;
|
|
480
480
|
(client: Client, params?: {
|
|
481
481
|
teepod_id?: number | undefined;
|
|
482
|
+
user_id?: string | undefined;
|
|
482
483
|
page?: number | undefined;
|
|
483
484
|
page_size?: number | undefined;
|
|
484
|
-
user_id?: string | undefined;
|
|
485
485
|
node_id?: number | undefined;
|
|
486
486
|
} | undefined, parameters?: {
|
|
487
487
|
schema: false;
|
|
@@ -489,13 +489,11 @@ declare const getCvmList: {
|
|
|
489
489
|
}, safeGetCvmList: {
|
|
490
490
|
(client: Client, params?: {
|
|
491
491
|
teepod_id?: number | undefined;
|
|
492
|
+
user_id?: string | undefined;
|
|
492
493
|
page?: number | undefined;
|
|
493
494
|
page_size?: number | undefined;
|
|
494
|
-
user_id?: string | undefined;
|
|
495
495
|
node_id?: number | undefined;
|
|
496
496
|
} | undefined): Promise<import("../..").SafeResult<{
|
|
497
|
-
page: number;
|
|
498
|
-
page_size: number;
|
|
499
497
|
items: {
|
|
500
498
|
status: string;
|
|
501
499
|
name: string;
|
|
@@ -550,22 +548,24 @@ declare const getCvmList: {
|
|
|
550
548
|
}[];
|
|
551
549
|
}[];
|
|
552
550
|
total: number;
|
|
551
|
+
page: number;
|
|
552
|
+
page_size: number;
|
|
553
553
|
pages: number;
|
|
554
554
|
}>>;
|
|
555
555
|
<T extends z.ZodTypeAny>(client: Client, params?: {
|
|
556
556
|
teepod_id?: number | undefined;
|
|
557
|
+
user_id?: string | undefined;
|
|
557
558
|
page?: number | undefined;
|
|
558
559
|
page_size?: number | undefined;
|
|
559
|
-
user_id?: string | undefined;
|
|
560
560
|
node_id?: number | undefined;
|
|
561
561
|
} | undefined, parameters?: {
|
|
562
562
|
schema: T;
|
|
563
563
|
} | undefined): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
564
564
|
(client: Client, params?: {
|
|
565
565
|
teepod_id?: number | undefined;
|
|
566
|
+
user_id?: string | undefined;
|
|
566
567
|
page?: number | undefined;
|
|
567
568
|
page_size?: number | undefined;
|
|
568
|
-
user_id?: string | undefined;
|
|
569
569
|
node_id?: number | undefined;
|
|
570
570
|
} | undefined, parameters?: {
|
|
571
571
|
schema: false;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type Client } from "../../client";
|
|
3
|
+
import { type CvmIdInput } from "../../types/cvm_id";
|
|
4
|
+
/**
|
|
5
|
+
* CVM state response schema
|
|
6
|
+
*/
|
|
7
|
+
export declare const CvmStateSchema: z.ZodObject<{
|
|
8
|
+
status: z.ZodString;
|
|
9
|
+
derived_status: z.ZodOptional<z.ZodString>;
|
|
10
|
+
vm_uuid: z.ZodOptional<z.ZodString>;
|
|
11
|
+
instance_id: z.ZodOptional<z.ZodString>;
|
|
12
|
+
uptime: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
status: string;
|
|
15
|
+
uptime?: string | undefined;
|
|
16
|
+
instance_id?: string | undefined;
|
|
17
|
+
vm_uuid?: string | undefined;
|
|
18
|
+
derived_status?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
status: string;
|
|
21
|
+
uptime?: string | undefined;
|
|
22
|
+
instance_id?: string | undefined;
|
|
23
|
+
vm_uuid?: string | undefined;
|
|
24
|
+
derived_status?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export type CvmState = z.infer<typeof CvmStateSchema>;
|
|
27
|
+
export declare const GetCvmStateRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
28
|
+
id: z.ZodOptional<z.ZodString>;
|
|
29
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
30
|
+
app_id: z.ZodOptional<z.ZodString>;
|
|
31
|
+
instance_id: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
id?: string | undefined;
|
|
34
|
+
app_id?: string | undefined;
|
|
35
|
+
instance_id?: string | undefined;
|
|
36
|
+
uuid?: string | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
id?: string | undefined;
|
|
39
|
+
app_id?: string | undefined;
|
|
40
|
+
instance_id?: string | undefined;
|
|
41
|
+
uuid?: string | undefined;
|
|
42
|
+
}>, any, any>, {
|
|
43
|
+
cvmId: string;
|
|
44
|
+
}, any>;
|
|
45
|
+
export type GetCvmStateRequest = CvmIdInput;
|
|
46
|
+
/**
|
|
47
|
+
* Get current state of a CVM (one-shot, immediate return)
|
|
48
|
+
*
|
|
49
|
+
* This action retrieves the current state of a CVM without waiting or streaming.
|
|
50
|
+
* For monitoring state changes until a target status is reached, use `watchCvmState` instead.
|
|
51
|
+
*
|
|
52
|
+
* @param client - The API client
|
|
53
|
+
* @param request - Request parameters
|
|
54
|
+
* @param request.cvmId - ID of the CVM to get state for
|
|
55
|
+
* @param parameters - Optional behavior parameters
|
|
56
|
+
* @returns Current CVM state
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const state = await getCvmState(client, { cvmId: "cvm-123" })
|
|
61
|
+
* console.log(state.status) // "running", "stopped", etc.
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const getCvmState: {
|
|
65
|
+
(client: Client, params: CvmIdInput): Promise<{
|
|
66
|
+
status: string;
|
|
67
|
+
uptime?: string | undefined;
|
|
68
|
+
instance_id?: string | undefined;
|
|
69
|
+
vm_uuid?: string | undefined;
|
|
70
|
+
derived_status?: string | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
<T extends z.ZodTypeAny>(client: Client, params: CvmIdInput, parameters: {
|
|
73
|
+
schema: T;
|
|
74
|
+
}): Promise<z.TypeOf<T>>;
|
|
75
|
+
(client: Client, params: CvmIdInput, parameters: {
|
|
76
|
+
schema: false;
|
|
77
|
+
}): Promise<unknown>;
|
|
78
|
+
}, safeGetCvmState: {
|
|
79
|
+
(client: Client, params: CvmIdInput): Promise<import("../..").SafeResult<{
|
|
80
|
+
status: string;
|
|
81
|
+
uptime?: string | undefined;
|
|
82
|
+
instance_id?: string | undefined;
|
|
83
|
+
vm_uuid?: string | undefined;
|
|
84
|
+
derived_status?: string | undefined;
|
|
85
|
+
}>>;
|
|
86
|
+
<T extends z.ZodTypeAny>(client: Client, params: CvmIdInput, parameters: {
|
|
87
|
+
schema: T;
|
|
88
|
+
}): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
89
|
+
(client: Client, params: CvmIdInput, parameters: {
|
|
90
|
+
schema: false;
|
|
91
|
+
}): Promise<import("../..").SafeResult<unknown>>;
|
|
92
|
+
};
|
|
93
|
+
export { getCvmState, safeGetCvmState };
|