@phala/cloud 0.1.1-beta.2 → 0.1.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/delete_cvm.d.ts +67 -0
- package/dist/actions/cvms/get_cvm_attestation.d.ts +393 -0
- package/dist/actions/cvms/get_cvm_compose_file.d.ts +126 -64
- package/dist/actions/cvms/get_cvm_containers_stats.d.ts +161 -0
- package/dist/actions/cvms/get_cvm_docker_compose.d.ts +39 -0
- package/dist/actions/cvms/get_cvm_info.d.ts +13 -38
- package/dist/actions/cvms/get_cvm_list.d.ts +195 -177
- package/dist/actions/cvms/get_cvm_network.d.ts +97 -0
- package/dist/actions/cvms/get_cvm_stats.d.ts +257 -0
- package/dist/actions/cvms/provision_cvm.d.ts +7 -7
- package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +58 -26
- package/dist/actions/cvms/restart_cvm.d.ts +123 -0
- package/dist/actions/cvms/shutdown_cvm.d.ts +116 -0
- package/dist/actions/cvms/start_cvm.d.ts +117 -0
- package/dist/actions/cvms/stop_cvm.d.ts +118 -0
- package/dist/actions/cvms/update_cvm_resources.d.ts +73 -0
- package/dist/actions/cvms/update_cvm_visibility.d.ts +147 -0
- package/dist/actions/index.d.ts +12 -0
- package/dist/create-client.d.ts +181 -0
- package/dist/index.js +615 -175
- package/dist/index.mjs +563 -172
- package/dist/types/app_compose.d.ts +6 -0
- package/dist/types/cvm_id.d.ts +110 -0
- package/dist/types/cvm_info.d.ts +243 -155
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/get_compose_hash.d.ts +21 -4
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Restart a CVM (Confidential Virtual Machine)
|
|
4
|
+
*
|
|
5
|
+
* This action performs a graceful restart of a running CVM instance,
|
|
6
|
+
* shutting down cleanly and then starting it again.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { createClient, restartCvm } from '@phala/cloud'
|
|
11
|
+
*
|
|
12
|
+
* const client = createClient();
|
|
13
|
+
* const result = await restartCvm(client, { id: 'my-cvm-id' });
|
|
14
|
+
* console.log(result.status); // "restarting"
|
|
15
|
+
*
|
|
16
|
+
* // Force restart (may skip graceful shutdown)
|
|
17
|
+
* const forceResult = await restartCvm(client, { id: 'my-cvm-id', force: true });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* ## Safe Version
|
|
21
|
+
*
|
|
22
|
+
* Use `safeRestartCvm` for error handling without exceptions:
|
|
23
|
+
*
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const result = await safeRestartCvm(client, { id: 'my-cvm-id' });
|
|
26
|
+
* if (result.success) {
|
|
27
|
+
* console.log('CVM restarting:', result.data.status);
|
|
28
|
+
* } else {
|
|
29
|
+
* console.error('Failed to restart CVM:', result.error.message);
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const RestartCvmRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
34
|
+
id: z.ZodOptional<z.ZodString>;
|
|
35
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
36
|
+
app_id: z.ZodOptional<z.ZodString>;
|
|
37
|
+
instance_id: z.ZodOptional<z.ZodString>;
|
|
38
|
+
} & {
|
|
39
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
id?: string | undefined;
|
|
42
|
+
app_id?: string | undefined;
|
|
43
|
+
instance_id?: string | undefined;
|
|
44
|
+
uuid?: string | undefined;
|
|
45
|
+
force?: boolean | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
id?: string | undefined;
|
|
48
|
+
app_id?: string | undefined;
|
|
49
|
+
instance_id?: string | undefined;
|
|
50
|
+
uuid?: string | undefined;
|
|
51
|
+
force?: boolean | undefined;
|
|
52
|
+
}>, any, any>;
|
|
53
|
+
export type RestartCvmRequest = z.infer<typeof RestartCvmRequestSchema>;
|
|
54
|
+
declare const restartCvm: {
|
|
55
|
+
(client: import("../..").BaseClient, params?: any): Promise<{
|
|
56
|
+
status: string;
|
|
57
|
+
name: string;
|
|
58
|
+
id: number;
|
|
59
|
+
teepod_id: number;
|
|
60
|
+
vcpu: number;
|
|
61
|
+
created_at: string;
|
|
62
|
+
app_id: string;
|
|
63
|
+
instance_id: string | null;
|
|
64
|
+
memory: number;
|
|
65
|
+
disk_size: number;
|
|
66
|
+
vm_uuid: string | null;
|
|
67
|
+
base_image: string | null;
|
|
68
|
+
encrypted_env_pubkey: string | null;
|
|
69
|
+
version?: string | null | undefined;
|
|
70
|
+
app_url?: string | null | undefined;
|
|
71
|
+
teepod?: {
|
|
72
|
+
name: string;
|
|
73
|
+
id: number;
|
|
74
|
+
region_identifier?: string | null | undefined;
|
|
75
|
+
} | null | undefined;
|
|
76
|
+
user_id?: number | null | undefined;
|
|
77
|
+
manifest_version?: number | null | undefined;
|
|
78
|
+
runner?: string | null | undefined;
|
|
79
|
+
docker_compose_file?: string | null | undefined;
|
|
80
|
+
features?: string[] | null | undefined;
|
|
81
|
+
}>;
|
|
82
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
83
|
+
schema: T;
|
|
84
|
+
} | undefined): Promise<z.TypeOf<T>>;
|
|
85
|
+
(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
86
|
+
schema: false;
|
|
87
|
+
} | undefined): Promise<unknown>;
|
|
88
|
+
}, safeRestartCvm: {
|
|
89
|
+
(client: import("../..").BaseClient, params?: any): Promise<import("../..").SafeResult<{
|
|
90
|
+
status: string;
|
|
91
|
+
name: string;
|
|
92
|
+
id: number;
|
|
93
|
+
teepod_id: number;
|
|
94
|
+
vcpu: number;
|
|
95
|
+
created_at: string;
|
|
96
|
+
app_id: string;
|
|
97
|
+
instance_id: string | null;
|
|
98
|
+
memory: number;
|
|
99
|
+
disk_size: number;
|
|
100
|
+
vm_uuid: string | null;
|
|
101
|
+
base_image: string | null;
|
|
102
|
+
encrypted_env_pubkey: string | null;
|
|
103
|
+
version?: string | null | undefined;
|
|
104
|
+
app_url?: string | null | undefined;
|
|
105
|
+
teepod?: {
|
|
106
|
+
name: string;
|
|
107
|
+
id: number;
|
|
108
|
+
region_identifier?: string | null | undefined;
|
|
109
|
+
} | null | undefined;
|
|
110
|
+
user_id?: number | null | undefined;
|
|
111
|
+
manifest_version?: number | null | undefined;
|
|
112
|
+
runner?: string | null | undefined;
|
|
113
|
+
docker_compose_file?: string | null | undefined;
|
|
114
|
+
features?: string[] | null | undefined;
|
|
115
|
+
}>>;
|
|
116
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
117
|
+
schema: T;
|
|
118
|
+
} | undefined): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
119
|
+
(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
120
|
+
schema: false;
|
|
121
|
+
} | undefined): Promise<import("../..").SafeResult<unknown>>;
|
|
122
|
+
};
|
|
123
|
+
export { restartCvm, safeRestartCvm };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type CvmIdInput } from "../../types/cvm_id";
|
|
2
|
+
/**
|
|
3
|
+
* Shutdown a CVM (Confidential Virtual Machine) gracefully
|
|
4
|
+
*
|
|
5
|
+
* This action performs a graceful shutdown of a running CVM instance,
|
|
6
|
+
* allowing the guest OS to shut down cleanly.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { createClient, shutdownCvm } from '@phala/cloud'
|
|
11
|
+
*
|
|
12
|
+
* const client = createClient();
|
|
13
|
+
* console.log(result.status); // "shutting_down"
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* ## Safe Version
|
|
17
|
+
*
|
|
18
|
+
* Use `safeShutdownCvm` for error handling without exceptions:
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* if (result.success) {
|
|
22
|
+
* console.log('CVM shutting down:', result.data.status);
|
|
23
|
+
* } else {
|
|
24
|
+
* console.error('Failed to shutdown CVM:', result.error.message);
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const ShutdownCvmRequestSchema: import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodObject<{
|
|
29
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
30
|
+
uuid: import("zod").ZodOptional<import("zod").ZodString>;
|
|
31
|
+
app_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
32
|
+
instance_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
33
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
34
|
+
id?: string | undefined;
|
|
35
|
+
app_id?: string | undefined;
|
|
36
|
+
instance_id?: string | undefined;
|
|
37
|
+
uuid?: string | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
id?: string | undefined;
|
|
40
|
+
app_id?: string | undefined;
|
|
41
|
+
instance_id?: string | undefined;
|
|
42
|
+
uuid?: string | undefined;
|
|
43
|
+
}>, any, any>, {
|
|
44
|
+
cvmId: string;
|
|
45
|
+
}, any>;
|
|
46
|
+
export type ShutdownCvmRequest = CvmIdInput;
|
|
47
|
+
declare const shutdownCvm: {
|
|
48
|
+
(client: import("../..").BaseClient, params: CvmIdInput): Promise<{
|
|
49
|
+
status: string;
|
|
50
|
+
name: string;
|
|
51
|
+
id: number;
|
|
52
|
+
teepod_id: number;
|
|
53
|
+
vcpu: number;
|
|
54
|
+
created_at: string;
|
|
55
|
+
app_id: string;
|
|
56
|
+
instance_id: string | null;
|
|
57
|
+
memory: number;
|
|
58
|
+
disk_size: number;
|
|
59
|
+
vm_uuid: string | null;
|
|
60
|
+
base_image: string | null;
|
|
61
|
+
encrypted_env_pubkey: string | null;
|
|
62
|
+
version?: string | null | undefined;
|
|
63
|
+
app_url?: string | null | undefined;
|
|
64
|
+
teepod?: {
|
|
65
|
+
name: string;
|
|
66
|
+
id: number;
|
|
67
|
+
region_identifier?: string | null | undefined;
|
|
68
|
+
} | null | undefined;
|
|
69
|
+
user_id?: number | null | undefined;
|
|
70
|
+
manifest_version?: number | null | undefined;
|
|
71
|
+
runner?: string | null | undefined;
|
|
72
|
+
docker_compose_file?: string | null | undefined;
|
|
73
|
+
features?: string[] | null | undefined;
|
|
74
|
+
}>;
|
|
75
|
+
<T extends import("zod").ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
76
|
+
schema: T;
|
|
77
|
+
}): Promise<import("zod").TypeOf<T>>;
|
|
78
|
+
(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
79
|
+
schema: false;
|
|
80
|
+
}): Promise<unknown>;
|
|
81
|
+
}, safeShutdownCvm: {
|
|
82
|
+
(client: import("../..").BaseClient, params: CvmIdInput): Promise<import("../..").SafeResult<{
|
|
83
|
+
status: string;
|
|
84
|
+
name: string;
|
|
85
|
+
id: number;
|
|
86
|
+
teepod_id: number;
|
|
87
|
+
vcpu: number;
|
|
88
|
+
created_at: string;
|
|
89
|
+
app_id: string;
|
|
90
|
+
instance_id: string | null;
|
|
91
|
+
memory: number;
|
|
92
|
+
disk_size: number;
|
|
93
|
+
vm_uuid: string | null;
|
|
94
|
+
base_image: string | null;
|
|
95
|
+
encrypted_env_pubkey: string | null;
|
|
96
|
+
version?: string | null | undefined;
|
|
97
|
+
app_url?: string | null | undefined;
|
|
98
|
+
teepod?: {
|
|
99
|
+
name: string;
|
|
100
|
+
id: number;
|
|
101
|
+
region_identifier?: string | null | undefined;
|
|
102
|
+
} | null | undefined;
|
|
103
|
+
user_id?: number | null | undefined;
|
|
104
|
+
manifest_version?: number | null | undefined;
|
|
105
|
+
runner?: string | null | undefined;
|
|
106
|
+
docker_compose_file?: string | null | undefined;
|
|
107
|
+
features?: string[] | null | undefined;
|
|
108
|
+
}>>;
|
|
109
|
+
<T extends import("zod").ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
110
|
+
schema: T;
|
|
111
|
+
}): Promise<import("../..").SafeResult<import("zod").TypeOf<T>>>;
|
|
112
|
+
(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
113
|
+
schema: false;
|
|
114
|
+
}): Promise<import("../..").SafeResult<unknown>>;
|
|
115
|
+
};
|
|
116
|
+
export { shutdownCvm, safeShutdownCvm };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type CvmIdInput } from "../../types/cvm_id";
|
|
2
|
+
/**
|
|
3
|
+
* Start a CVM (Confidential Virtual Machine)
|
|
4
|
+
*
|
|
5
|
+
* This action starts a stopped or shutdown CVM instance.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createClient, startCvm } from '@phala/cloud'
|
|
10
|
+
*
|
|
11
|
+
* const client = createClient();
|
|
12
|
+
* const result = await startCvm(client, { id: 'my-cvm-id' });
|
|
13
|
+
* console.log(result.status); // "starting"
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* ## Safe Version
|
|
17
|
+
*
|
|
18
|
+
* Use `safeStartCvm` for error handling without exceptions:
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const result = await safeStartCvm(client, { id: 'my-cvm-id' });
|
|
22
|
+
* if (result.success) {
|
|
23
|
+
* console.log('CVM started:', result.data.status);
|
|
24
|
+
* } else {
|
|
25
|
+
* console.error('Failed to start CVM:', result.error.message);
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const StartCvmRequestSchema: import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodObject<{
|
|
30
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
31
|
+
uuid: import("zod").ZodOptional<import("zod").ZodString>;
|
|
32
|
+
app_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
33
|
+
instance_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
34
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
35
|
+
id?: string | undefined;
|
|
36
|
+
app_id?: string | undefined;
|
|
37
|
+
instance_id?: string | undefined;
|
|
38
|
+
uuid?: string | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
id?: string | undefined;
|
|
41
|
+
app_id?: string | undefined;
|
|
42
|
+
instance_id?: string | undefined;
|
|
43
|
+
uuid?: string | undefined;
|
|
44
|
+
}>, any, any>, {
|
|
45
|
+
cvmId: string;
|
|
46
|
+
}, any>;
|
|
47
|
+
export type StartCvmRequest = CvmIdInput;
|
|
48
|
+
declare const startCvm: {
|
|
49
|
+
(client: import("../..").BaseClient, params: CvmIdInput): Promise<{
|
|
50
|
+
status: string;
|
|
51
|
+
name: string;
|
|
52
|
+
id: number;
|
|
53
|
+
teepod_id: number;
|
|
54
|
+
vcpu: number;
|
|
55
|
+
created_at: string;
|
|
56
|
+
app_id: string;
|
|
57
|
+
instance_id: string | null;
|
|
58
|
+
memory: number;
|
|
59
|
+
disk_size: number;
|
|
60
|
+
vm_uuid: string | null;
|
|
61
|
+
base_image: string | null;
|
|
62
|
+
encrypted_env_pubkey: string | null;
|
|
63
|
+
version?: string | null | undefined;
|
|
64
|
+
app_url?: string | null | undefined;
|
|
65
|
+
teepod?: {
|
|
66
|
+
name: string;
|
|
67
|
+
id: number;
|
|
68
|
+
region_identifier?: string | null | undefined;
|
|
69
|
+
} | null | undefined;
|
|
70
|
+
user_id?: number | null | undefined;
|
|
71
|
+
manifest_version?: number | null | undefined;
|
|
72
|
+
runner?: string | null | undefined;
|
|
73
|
+
docker_compose_file?: string | null | undefined;
|
|
74
|
+
features?: string[] | null | undefined;
|
|
75
|
+
}>;
|
|
76
|
+
<T extends import("zod").ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
77
|
+
schema: T;
|
|
78
|
+
}): Promise<import("zod").TypeOf<T>>;
|
|
79
|
+
(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
80
|
+
schema: false;
|
|
81
|
+
}): Promise<unknown>;
|
|
82
|
+
}, safeStartCvm: {
|
|
83
|
+
(client: import("../..").BaseClient, params: CvmIdInput): Promise<import("../..").SafeResult<{
|
|
84
|
+
status: string;
|
|
85
|
+
name: string;
|
|
86
|
+
id: number;
|
|
87
|
+
teepod_id: number;
|
|
88
|
+
vcpu: number;
|
|
89
|
+
created_at: string;
|
|
90
|
+
app_id: string;
|
|
91
|
+
instance_id: string | null;
|
|
92
|
+
memory: number;
|
|
93
|
+
disk_size: number;
|
|
94
|
+
vm_uuid: string | null;
|
|
95
|
+
base_image: string | null;
|
|
96
|
+
encrypted_env_pubkey: string | null;
|
|
97
|
+
version?: string | null | undefined;
|
|
98
|
+
app_url?: string | null | undefined;
|
|
99
|
+
teepod?: {
|
|
100
|
+
name: string;
|
|
101
|
+
id: number;
|
|
102
|
+
region_identifier?: string | null | undefined;
|
|
103
|
+
} | null | undefined;
|
|
104
|
+
user_id?: number | null | undefined;
|
|
105
|
+
manifest_version?: number | null | undefined;
|
|
106
|
+
runner?: string | null | undefined;
|
|
107
|
+
docker_compose_file?: string | null | undefined;
|
|
108
|
+
features?: string[] | null | undefined;
|
|
109
|
+
}>>;
|
|
110
|
+
<T extends import("zod").ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
111
|
+
schema: T;
|
|
112
|
+
}): Promise<import("../..").SafeResult<import("zod").TypeOf<T>>>;
|
|
113
|
+
(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
114
|
+
schema: false;
|
|
115
|
+
}): Promise<import("../..").SafeResult<unknown>>;
|
|
116
|
+
};
|
|
117
|
+
export { startCvm, safeStartCvm };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { type CvmIdInput } from "../../types/cvm_id";
|
|
2
|
+
/**
|
|
3
|
+
* Force stop a CVM (Confidential Virtual Machine)
|
|
4
|
+
*
|
|
5
|
+
* This action forcefully stops a running CVM instance immediately,
|
|
6
|
+
* similar to pulling the power plug. Use shutdown for graceful stops.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { createClient, stopCvm } from '@phala/cloud'
|
|
11
|
+
*
|
|
12
|
+
* const client = createClient();
|
|
13
|
+
* const result = await stopCvm(client, { id: 'my-cvm-id' });
|
|
14
|
+
* console.log(result.status); // "stopped"
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ## Safe Version
|
|
18
|
+
*
|
|
19
|
+
* Use `safeStopCvm` for error handling without exceptions:
|
|
20
|
+
*
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const result = await safeStopCvm(client, { id: 'my-cvm-id' });
|
|
23
|
+
* if (result.success) {
|
|
24
|
+
* console.log('CVM stopped:', result.data.status);
|
|
25
|
+
* } else {
|
|
26
|
+
* console.error('Failed to stop CVM:', result.error.message);
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const StopCvmRequestSchema: import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodObject<{
|
|
31
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
32
|
+
uuid: import("zod").ZodOptional<import("zod").ZodString>;
|
|
33
|
+
app_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
34
|
+
instance_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
35
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
36
|
+
id?: string | undefined;
|
|
37
|
+
app_id?: string | undefined;
|
|
38
|
+
instance_id?: string | undefined;
|
|
39
|
+
uuid?: string | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
id?: string | undefined;
|
|
42
|
+
app_id?: string | undefined;
|
|
43
|
+
instance_id?: string | undefined;
|
|
44
|
+
uuid?: string | undefined;
|
|
45
|
+
}>, any, any>, {
|
|
46
|
+
cvmId: string;
|
|
47
|
+
}, any>;
|
|
48
|
+
export type StopCvmRequest = CvmIdInput;
|
|
49
|
+
declare const stopCvm: {
|
|
50
|
+
(client: import("../..").BaseClient, params: CvmIdInput): Promise<{
|
|
51
|
+
status: string;
|
|
52
|
+
name: string;
|
|
53
|
+
id: number;
|
|
54
|
+
teepod_id: number;
|
|
55
|
+
vcpu: number;
|
|
56
|
+
created_at: string;
|
|
57
|
+
app_id: string;
|
|
58
|
+
instance_id: string | null;
|
|
59
|
+
memory: number;
|
|
60
|
+
disk_size: number;
|
|
61
|
+
vm_uuid: string | null;
|
|
62
|
+
base_image: string | null;
|
|
63
|
+
encrypted_env_pubkey: string | null;
|
|
64
|
+
version?: string | null | undefined;
|
|
65
|
+
app_url?: string | null | undefined;
|
|
66
|
+
teepod?: {
|
|
67
|
+
name: string;
|
|
68
|
+
id: number;
|
|
69
|
+
region_identifier?: string | null | undefined;
|
|
70
|
+
} | null | undefined;
|
|
71
|
+
user_id?: number | null | undefined;
|
|
72
|
+
manifest_version?: number | null | undefined;
|
|
73
|
+
runner?: string | null | undefined;
|
|
74
|
+
docker_compose_file?: string | null | undefined;
|
|
75
|
+
features?: string[] | null | undefined;
|
|
76
|
+
}>;
|
|
77
|
+
<T extends import("zod").ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
78
|
+
schema: T;
|
|
79
|
+
}): Promise<import("zod").TypeOf<T>>;
|
|
80
|
+
(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
81
|
+
schema: false;
|
|
82
|
+
}): Promise<unknown>;
|
|
83
|
+
}, safeStopCvm: {
|
|
84
|
+
(client: import("../..").BaseClient, params: CvmIdInput): Promise<import("../..").SafeResult<{
|
|
85
|
+
status: string;
|
|
86
|
+
name: string;
|
|
87
|
+
id: number;
|
|
88
|
+
teepod_id: number;
|
|
89
|
+
vcpu: number;
|
|
90
|
+
created_at: string;
|
|
91
|
+
app_id: string;
|
|
92
|
+
instance_id: string | null;
|
|
93
|
+
memory: number;
|
|
94
|
+
disk_size: number;
|
|
95
|
+
vm_uuid: string | null;
|
|
96
|
+
base_image: string | null;
|
|
97
|
+
encrypted_env_pubkey: string | null;
|
|
98
|
+
version?: string | null | undefined;
|
|
99
|
+
app_url?: string | null | undefined;
|
|
100
|
+
teepod?: {
|
|
101
|
+
name: string;
|
|
102
|
+
id: number;
|
|
103
|
+
region_identifier?: string | null | undefined;
|
|
104
|
+
} | null | undefined;
|
|
105
|
+
user_id?: number | null | undefined;
|
|
106
|
+
manifest_version?: number | null | undefined;
|
|
107
|
+
runner?: string | null | undefined;
|
|
108
|
+
docker_compose_file?: string | null | undefined;
|
|
109
|
+
features?: string[] | null | undefined;
|
|
110
|
+
}>>;
|
|
111
|
+
<T extends import("zod").ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
112
|
+
schema: T;
|
|
113
|
+
}): Promise<import("../..").SafeResult<import("zod").TypeOf<T>>>;
|
|
114
|
+
(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
|
|
115
|
+
schema: false;
|
|
116
|
+
}): Promise<import("../..").SafeResult<unknown>>;
|
|
117
|
+
};
|
|
118
|
+
export { stopCvm, safeStopCvm };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Update CVM resources (resize)
|
|
4
|
+
*
|
|
5
|
+
* This action updates the resource allocation (CPU, memory, disk) for a CVM.
|
|
6
|
+
* Returns 202 Accepted as the operation may take time to complete.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { createClient, updateCvmResources } from '@phala/cloud'
|
|
11
|
+
*
|
|
12
|
+
* const client = createClient();
|
|
13
|
+
* await updateCvmResources(client, {
|
|
14
|
+
* id: 'my-cvm-id',
|
|
15
|
+
* vcpu: 4,
|
|
16
|
+
* memory: 8192,
|
|
17
|
+
* disk_size: 50,
|
|
18
|
+
* allow_restart: true
|
|
19
|
+
* });
|
|
20
|
+
* console.log('Resource update initiated');
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const UpdateCvmResourcesRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
24
|
+
id: z.ZodOptional<z.ZodString>;
|
|
25
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
26
|
+
app_id: z.ZodOptional<z.ZodString>;
|
|
27
|
+
instance_id: z.ZodOptional<z.ZodString>;
|
|
28
|
+
} & {
|
|
29
|
+
vcpu: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
memory: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
disk_size: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
instance_type: z.ZodOptional<z.ZodString>;
|
|
33
|
+
allow_restart: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
id?: string | undefined;
|
|
36
|
+
vcpu?: number | undefined;
|
|
37
|
+
app_id?: string | undefined;
|
|
38
|
+
instance_id?: string | undefined;
|
|
39
|
+
memory?: number | undefined;
|
|
40
|
+
disk_size?: number | undefined;
|
|
41
|
+
uuid?: string | undefined;
|
|
42
|
+
instance_type?: string | undefined;
|
|
43
|
+
allow_restart?: boolean | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
id?: string | undefined;
|
|
46
|
+
vcpu?: number | undefined;
|
|
47
|
+
app_id?: string | undefined;
|
|
48
|
+
instance_id?: string | undefined;
|
|
49
|
+
memory?: number | undefined;
|
|
50
|
+
disk_size?: number | undefined;
|
|
51
|
+
uuid?: string | undefined;
|
|
52
|
+
instance_type?: string | undefined;
|
|
53
|
+
allow_restart?: boolean | undefined;
|
|
54
|
+
}>, any, any>;
|
|
55
|
+
export type UpdateCvmResourcesRequest = z.infer<typeof UpdateCvmResourcesRequestSchema>;
|
|
56
|
+
declare const updateCvmResources: {
|
|
57
|
+
(client: import("../..").BaseClient, params?: any): Promise<void>;
|
|
58
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
59
|
+
schema: T;
|
|
60
|
+
} | undefined): Promise<z.TypeOf<T>>;
|
|
61
|
+
(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
62
|
+
schema: false;
|
|
63
|
+
} | undefined): Promise<unknown>;
|
|
64
|
+
}, safeUpdateCvmResources: {
|
|
65
|
+
(client: import("../..").BaseClient, params?: any): Promise<import("../..").SafeResult<void>>;
|
|
66
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
67
|
+
schema: T;
|
|
68
|
+
} | undefined): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
69
|
+
(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
70
|
+
schema: false;
|
|
71
|
+
} | undefined): Promise<import("../..").SafeResult<unknown>>;
|
|
72
|
+
};
|
|
73
|
+
export { updateCvmResources, safeUpdateCvmResources };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Update CVM visibility settings
|
|
4
|
+
*
|
|
5
|
+
* This action updates whether system info and logs are publicly accessible.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createClient, updateCvmVisibility } from '@phala/cloud'
|
|
10
|
+
*
|
|
11
|
+
* const client = createClient();
|
|
12
|
+
* const result = await updateCvmVisibility(client, {
|
|
13
|
+
* id: 'my-cvm-id',
|
|
14
|
+
* public_sysinfo: true,
|
|
15
|
+
* public_logs: false
|
|
16
|
+
* });
|
|
17
|
+
* console.log(result.public_sysinfo, result.public_logs);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const UpdateCvmVisibilityRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
21
|
+
id: z.ZodOptional<z.ZodString>;
|
|
22
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
23
|
+
app_id: z.ZodOptional<z.ZodString>;
|
|
24
|
+
instance_id: z.ZodOptional<z.ZodString>;
|
|
25
|
+
} & {
|
|
26
|
+
public_sysinfo: z.ZodBoolean;
|
|
27
|
+
public_logs: z.ZodBoolean;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
public_sysinfo: boolean;
|
|
30
|
+
public_logs: boolean;
|
|
31
|
+
id?: string | undefined;
|
|
32
|
+
app_id?: string | undefined;
|
|
33
|
+
instance_id?: string | undefined;
|
|
34
|
+
uuid?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
public_sysinfo: boolean;
|
|
37
|
+
public_logs: boolean;
|
|
38
|
+
id?: string | undefined;
|
|
39
|
+
app_id?: string | undefined;
|
|
40
|
+
instance_id?: string | undefined;
|
|
41
|
+
uuid?: string | undefined;
|
|
42
|
+
}>, any, any>;
|
|
43
|
+
export type UpdateCvmVisibilityRequest = z.infer<typeof UpdateCvmVisibilityRequestSchema>;
|
|
44
|
+
declare const updateCvmVisibility: {
|
|
45
|
+
(client: import("../..").BaseClient, params?: any): Promise<{
|
|
46
|
+
status: string;
|
|
47
|
+
name: string;
|
|
48
|
+
id: number;
|
|
49
|
+
teepod_id: number | null;
|
|
50
|
+
listed: boolean;
|
|
51
|
+
vcpu: number;
|
|
52
|
+
app_id: string;
|
|
53
|
+
instance_id: string | null;
|
|
54
|
+
in_progress: boolean;
|
|
55
|
+
memory: number;
|
|
56
|
+
disk_size: number;
|
|
57
|
+
public_urls: {
|
|
58
|
+
app: string;
|
|
59
|
+
instance: string;
|
|
60
|
+
}[];
|
|
61
|
+
vm_uuid: string | null;
|
|
62
|
+
base_image: string | null;
|
|
63
|
+
encrypted_env_pubkey: string | null;
|
|
64
|
+
public_sysinfo: boolean;
|
|
65
|
+
public_logs: boolean;
|
|
66
|
+
dapp_dashboard_url?: string | null | undefined;
|
|
67
|
+
syslog_endpoint?: string | null | undefined;
|
|
68
|
+
project_id?: string | null | undefined;
|
|
69
|
+
project_type?: string | null | undefined;
|
|
70
|
+
kms_info?: z.objectOutputType<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
73
|
+
url: z.ZodString;
|
|
74
|
+
version: z.ZodString;
|
|
75
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
76
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
77
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
78
|
+
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
79
|
+
gateway_domain?: string | null | undefined;
|
|
80
|
+
teepod?: {
|
|
81
|
+
name: string;
|
|
82
|
+
id: number;
|
|
83
|
+
region_identifier?: string | null | undefined;
|
|
84
|
+
} | null | undefined;
|
|
85
|
+
contract_address?: string | null | undefined;
|
|
86
|
+
deployer_address?: string | null | undefined;
|
|
87
|
+
scheduled_delete_at?: string | null | undefined;
|
|
88
|
+
}>;
|
|
89
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
90
|
+
schema: T;
|
|
91
|
+
} | undefined): Promise<z.TypeOf<T>>;
|
|
92
|
+
(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
93
|
+
schema: false;
|
|
94
|
+
} | undefined): Promise<unknown>;
|
|
95
|
+
}, safeUpdateCvmVisibility: {
|
|
96
|
+
(client: import("../..").BaseClient, params?: any): Promise<import("../..").SafeResult<{
|
|
97
|
+
status: string;
|
|
98
|
+
name: string;
|
|
99
|
+
id: number;
|
|
100
|
+
teepod_id: number | null;
|
|
101
|
+
listed: boolean;
|
|
102
|
+
vcpu: number;
|
|
103
|
+
app_id: string;
|
|
104
|
+
instance_id: string | null;
|
|
105
|
+
in_progress: boolean;
|
|
106
|
+
memory: number;
|
|
107
|
+
disk_size: number;
|
|
108
|
+
public_urls: {
|
|
109
|
+
app: string;
|
|
110
|
+
instance: string;
|
|
111
|
+
}[];
|
|
112
|
+
vm_uuid: string | null;
|
|
113
|
+
base_image: string | null;
|
|
114
|
+
encrypted_env_pubkey: string | null;
|
|
115
|
+
public_sysinfo: boolean;
|
|
116
|
+
public_logs: boolean;
|
|
117
|
+
dapp_dashboard_url?: string | null | undefined;
|
|
118
|
+
syslog_endpoint?: string | null | undefined;
|
|
119
|
+
project_id?: string | null | undefined;
|
|
120
|
+
project_type?: string | null | undefined;
|
|
121
|
+
kms_info?: z.objectOutputType<{
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
124
|
+
url: z.ZodString;
|
|
125
|
+
version: z.ZodString;
|
|
126
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
127
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
128
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
129
|
+
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
130
|
+
gateway_domain?: string | null | undefined;
|
|
131
|
+
teepod?: {
|
|
132
|
+
name: string;
|
|
133
|
+
id: number;
|
|
134
|
+
region_identifier?: string | null | undefined;
|
|
135
|
+
} | null | undefined;
|
|
136
|
+
contract_address?: string | null | undefined;
|
|
137
|
+
deployer_address?: string | null | undefined;
|
|
138
|
+
scheduled_delete_at?: string | null | undefined;
|
|
139
|
+
}>>;
|
|
140
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
141
|
+
schema: T;
|
|
142
|
+
} | undefined): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
143
|
+
(client: import("../..").BaseClient, params?: any, parameters?: {
|
|
144
|
+
schema: false;
|
|
145
|
+
} | undefined): Promise<import("../..").SafeResult<unknown>>;
|
|
146
|
+
};
|
|
147
|
+
export { updateCvmVisibility, safeUpdateCvmVisibility };
|