@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.
@@ -0,0 +1,67 @@
1
+ import { z } from "zod";
2
+ import { type CvmIdInput } from "../../types/cvm_id";
3
+ /**
4
+ * Delete a CVM (Confidential Virtual Machine)
5
+ *
6
+ * This action permanently deletes a CVM instance and all its data.
7
+ * This operation cannot be undone.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { createClient, deleteCvm } from '@phala/cloud'
12
+ *
13
+ * const client = createClient();
14
+ * await deleteCvm(client, { id: 'my-cvm-id' });
15
+ * console.log('CVM deleted');
16
+ * ```
17
+ *
18
+ * ## Safe Version
19
+ *
20
+ * Use `safeDeleteCvm` for error handling without exceptions:
21
+ *
22
+ * ```typescript
23
+ * const result = await safeDeleteCvm(client, { id: 'my-cvm-id' });
24
+ * if (result.success) {
25
+ * console.log('CVM successfully deleted');
26
+ * } else {
27
+ * console.error('Failed to delete CVM:', result.error.message);
28
+ * }
29
+ * ```
30
+ */
31
+ export declare const DeleteCvmRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
32
+ id: z.ZodOptional<z.ZodString>;
33
+ uuid: z.ZodOptional<z.ZodString>;
34
+ app_id: z.ZodOptional<z.ZodString>;
35
+ instance_id: z.ZodOptional<z.ZodString>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ id?: string | undefined;
38
+ app_id?: string | undefined;
39
+ instance_id?: string | undefined;
40
+ uuid?: string | undefined;
41
+ }, {
42
+ id?: string | undefined;
43
+ app_id?: string | undefined;
44
+ instance_id?: string | undefined;
45
+ uuid?: string | undefined;
46
+ }>, any, any>, {
47
+ cvmId: string;
48
+ }, any>;
49
+ export type DeleteCvmRequest = CvmIdInput;
50
+ declare const deleteCvm: {
51
+ (client: import("../..").BaseClient, params: CvmIdInput): Promise<void>;
52
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
53
+ schema: T;
54
+ }): Promise<z.TypeOf<T>>;
55
+ (client: import("../..").BaseClient, params: CvmIdInput, parameters: {
56
+ schema: false;
57
+ }): Promise<unknown>;
58
+ }, safeDeleteCvm: {
59
+ (client: import("../..").BaseClient, params: CvmIdInput): Promise<import("../..").SafeResult<void>>;
60
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
61
+ schema: T;
62
+ }): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
63
+ (client: import("../..").BaseClient, params: CvmIdInput, parameters: {
64
+ schema: false;
65
+ }): Promise<import("../..").SafeResult<unknown>>;
66
+ };
67
+ export { deleteCvm, safeDeleteCvm };
@@ -0,0 +1,393 @@
1
+ import { z } from "zod";
2
+ import { type CvmIdInput } from "../../types/cvm_id";
3
+ export declare const CvmAttestationSchema: z.ZodObject<{
4
+ name: z.ZodNullable<z.ZodString>;
5
+ is_online: z.ZodBoolean;
6
+ is_public: z.ZodDefault<z.ZodBoolean>;
7
+ error: z.ZodNullable<z.ZodString>;
8
+ app_certificates: z.ZodNullable<z.ZodArray<z.ZodObject<{
9
+ subject: z.ZodObject<{
10
+ common_name: z.ZodNullable<z.ZodString>;
11
+ organization: z.ZodNullable<z.ZodString>;
12
+ country: z.ZodNullable<z.ZodString>;
13
+ state: z.ZodNullable<z.ZodString>;
14
+ locality: z.ZodNullable<z.ZodString>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ state: string | null;
17
+ common_name: string | null;
18
+ organization: string | null;
19
+ country: string | null;
20
+ locality: string | null;
21
+ }, {
22
+ state: string | null;
23
+ common_name: string | null;
24
+ organization: string | null;
25
+ country: string | null;
26
+ locality: string | null;
27
+ }>;
28
+ issuer: z.ZodObject<{
29
+ common_name: z.ZodNullable<z.ZodString>;
30
+ organization: z.ZodNullable<z.ZodString>;
31
+ country: z.ZodNullable<z.ZodString>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ common_name: string | null;
34
+ organization: string | null;
35
+ country: string | null;
36
+ }, {
37
+ common_name: string | null;
38
+ organization: string | null;
39
+ country: string | null;
40
+ }>;
41
+ serial_number: z.ZodString;
42
+ not_before: z.ZodString;
43
+ not_after: z.ZodString;
44
+ version: z.ZodString;
45
+ fingerprint: z.ZodString;
46
+ signature_algorithm: z.ZodString;
47
+ sans: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
48
+ is_ca: z.ZodBoolean;
49
+ position_in_chain: z.ZodNullable<z.ZodNumber>;
50
+ quote: z.ZodNullable<z.ZodString>;
51
+ app_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ cert_usage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ version: string;
55
+ subject: {
56
+ state: string | null;
57
+ common_name: string | null;
58
+ organization: string | null;
59
+ country: string | null;
60
+ locality: string | null;
61
+ };
62
+ issuer: {
63
+ common_name: string | null;
64
+ organization: string | null;
65
+ country: string | null;
66
+ };
67
+ serial_number: string;
68
+ not_before: string;
69
+ not_after: string;
70
+ fingerprint: string;
71
+ signature_algorithm: string;
72
+ sans: string[] | null;
73
+ is_ca: boolean;
74
+ position_in_chain: number | null;
75
+ quote: string | null;
76
+ app_id?: string | null | undefined;
77
+ cert_usage?: string | null | undefined;
78
+ }, {
79
+ version: string;
80
+ subject: {
81
+ state: string | null;
82
+ common_name: string | null;
83
+ organization: string | null;
84
+ country: string | null;
85
+ locality: string | null;
86
+ };
87
+ issuer: {
88
+ common_name: string | null;
89
+ organization: string | null;
90
+ country: string | null;
91
+ };
92
+ serial_number: string;
93
+ not_before: string;
94
+ not_after: string;
95
+ fingerprint: string;
96
+ signature_algorithm: string;
97
+ sans: string[] | null;
98
+ is_ca: boolean;
99
+ position_in_chain: number | null;
100
+ quote: string | null;
101
+ app_id?: string | null | undefined;
102
+ cert_usage?: string | null | undefined;
103
+ }>, "many">>;
104
+ tcb_info: z.ZodNullable<z.ZodObject<{
105
+ mrtd: z.ZodString;
106
+ rootfs_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
107
+ rtmr0: z.ZodString;
108
+ rtmr1: z.ZodString;
109
+ rtmr2: z.ZodString;
110
+ rtmr3: z.ZodString;
111
+ event_log: z.ZodArray<z.ZodObject<{
112
+ imr: z.ZodNumber;
113
+ event_type: z.ZodNumber;
114
+ digest: z.ZodString;
115
+ event: z.ZodString;
116
+ event_payload: z.ZodString;
117
+ }, "strip", z.ZodTypeAny, {
118
+ imr: number;
119
+ event_type: number;
120
+ digest: string;
121
+ event: string;
122
+ event_payload: string;
123
+ }, {
124
+ imr: number;
125
+ event_type: number;
126
+ digest: string;
127
+ event: string;
128
+ event_payload: string;
129
+ }>, "many">;
130
+ app_compose: z.ZodString;
131
+ }, "strip", z.ZodTypeAny, {
132
+ app_compose: string;
133
+ mrtd: string;
134
+ rtmr0: string;
135
+ rtmr1: string;
136
+ rtmr2: string;
137
+ rtmr3: string;
138
+ event_log: {
139
+ imr: number;
140
+ event_type: number;
141
+ digest: string;
142
+ event: string;
143
+ event_payload: string;
144
+ }[];
145
+ rootfs_hash?: string | null | undefined;
146
+ }, {
147
+ app_compose: string;
148
+ mrtd: string;
149
+ rtmr0: string;
150
+ rtmr1: string;
151
+ rtmr2: string;
152
+ rtmr3: string;
153
+ event_log: {
154
+ imr: number;
155
+ event_type: number;
156
+ digest: string;
157
+ event: string;
158
+ event_payload: string;
159
+ }[];
160
+ rootfs_hash?: string | null | undefined;
161
+ }>>;
162
+ compose_file: z.ZodNullable<z.ZodString>;
163
+ }, "strip", z.ZodTypeAny, {
164
+ error: string | null;
165
+ name: string | null;
166
+ compose_file: string | null;
167
+ is_online: boolean;
168
+ is_public: boolean;
169
+ app_certificates: {
170
+ version: string;
171
+ subject: {
172
+ state: string | null;
173
+ common_name: string | null;
174
+ organization: string | null;
175
+ country: string | null;
176
+ locality: string | null;
177
+ };
178
+ issuer: {
179
+ common_name: string | null;
180
+ organization: string | null;
181
+ country: string | null;
182
+ };
183
+ serial_number: string;
184
+ not_before: string;
185
+ not_after: string;
186
+ fingerprint: string;
187
+ signature_algorithm: string;
188
+ sans: string[] | null;
189
+ is_ca: boolean;
190
+ position_in_chain: number | null;
191
+ quote: string | null;
192
+ app_id?: string | null | undefined;
193
+ cert_usage?: string | null | undefined;
194
+ }[] | null;
195
+ tcb_info: {
196
+ app_compose: string;
197
+ mrtd: string;
198
+ rtmr0: string;
199
+ rtmr1: string;
200
+ rtmr2: string;
201
+ rtmr3: string;
202
+ event_log: {
203
+ imr: number;
204
+ event_type: number;
205
+ digest: string;
206
+ event: string;
207
+ event_payload: string;
208
+ }[];
209
+ rootfs_hash?: string | null | undefined;
210
+ } | null;
211
+ }, {
212
+ error: string | null;
213
+ name: string | null;
214
+ compose_file: string | null;
215
+ is_online: boolean;
216
+ app_certificates: {
217
+ version: string;
218
+ subject: {
219
+ state: string | null;
220
+ common_name: string | null;
221
+ organization: string | null;
222
+ country: string | null;
223
+ locality: string | null;
224
+ };
225
+ issuer: {
226
+ common_name: string | null;
227
+ organization: string | null;
228
+ country: string | null;
229
+ };
230
+ serial_number: string;
231
+ not_before: string;
232
+ not_after: string;
233
+ fingerprint: string;
234
+ signature_algorithm: string;
235
+ sans: string[] | null;
236
+ is_ca: boolean;
237
+ position_in_chain: number | null;
238
+ quote: string | null;
239
+ app_id?: string | null | undefined;
240
+ cert_usage?: string | null | undefined;
241
+ }[] | null;
242
+ tcb_info: {
243
+ app_compose: string;
244
+ mrtd: string;
245
+ rtmr0: string;
246
+ rtmr1: string;
247
+ rtmr2: string;
248
+ rtmr3: string;
249
+ event_log: {
250
+ imr: number;
251
+ event_type: number;
252
+ digest: string;
253
+ event: string;
254
+ event_payload: string;
255
+ }[];
256
+ rootfs_hash?: string | null | undefined;
257
+ } | null;
258
+ is_public?: boolean | undefined;
259
+ }>;
260
+ export type CvmAttestation = z.infer<typeof CvmAttestationSchema>;
261
+ export declare const GetCvmAttestationRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
262
+ id: z.ZodOptional<z.ZodString>;
263
+ uuid: z.ZodOptional<z.ZodString>;
264
+ app_id: z.ZodOptional<z.ZodString>;
265
+ instance_id: z.ZodOptional<z.ZodString>;
266
+ }, "strip", z.ZodTypeAny, {
267
+ id?: string | undefined;
268
+ app_id?: string | undefined;
269
+ instance_id?: string | undefined;
270
+ uuid?: string | undefined;
271
+ }, {
272
+ id?: string | undefined;
273
+ app_id?: string | undefined;
274
+ instance_id?: string | undefined;
275
+ uuid?: string | undefined;
276
+ }>, any, any>, {
277
+ cvmId: string;
278
+ }, any>;
279
+ export type GetCvmAttestationRequest = CvmIdInput;
280
+ declare const getCvmAttestation: {
281
+ (client: import("../..").BaseClient, params: CvmIdInput): Promise<{
282
+ error: string | null;
283
+ name: string | null;
284
+ compose_file: string | null;
285
+ is_online: boolean;
286
+ is_public: boolean;
287
+ app_certificates: {
288
+ version: string;
289
+ subject: {
290
+ state: string | null;
291
+ common_name: string | null;
292
+ organization: string | null;
293
+ country: string | null;
294
+ locality: string | null;
295
+ };
296
+ issuer: {
297
+ common_name: string | null;
298
+ organization: string | null;
299
+ country: string | null;
300
+ };
301
+ serial_number: string;
302
+ not_before: string;
303
+ not_after: string;
304
+ fingerprint: string;
305
+ signature_algorithm: string;
306
+ sans: string[] | null;
307
+ is_ca: boolean;
308
+ position_in_chain: number | null;
309
+ quote: string | null;
310
+ app_id?: string | null | undefined;
311
+ cert_usage?: string | null | undefined;
312
+ }[] | null;
313
+ tcb_info: {
314
+ app_compose: string;
315
+ mrtd: string;
316
+ rtmr0: string;
317
+ rtmr1: string;
318
+ rtmr2: string;
319
+ rtmr3: string;
320
+ event_log: {
321
+ imr: number;
322
+ event_type: number;
323
+ digest: string;
324
+ event: string;
325
+ event_payload: string;
326
+ }[];
327
+ rootfs_hash?: string | null | undefined;
328
+ } | null;
329
+ }>;
330
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
331
+ schema: T;
332
+ }): Promise<z.TypeOf<T>>;
333
+ (client: import("../..").BaseClient, params: CvmIdInput, parameters: {
334
+ schema: false;
335
+ }): Promise<unknown>;
336
+ }, safeGetCvmAttestation: {
337
+ (client: import("../..").BaseClient, params: CvmIdInput): Promise<import("../..").SafeResult<{
338
+ error: string | null;
339
+ name: string | null;
340
+ compose_file: string | null;
341
+ is_online: boolean;
342
+ is_public: boolean;
343
+ app_certificates: {
344
+ version: string;
345
+ subject: {
346
+ state: string | null;
347
+ common_name: string | null;
348
+ organization: string | null;
349
+ country: string | null;
350
+ locality: string | null;
351
+ };
352
+ issuer: {
353
+ common_name: string | null;
354
+ organization: string | null;
355
+ country: string | null;
356
+ };
357
+ serial_number: string;
358
+ not_before: string;
359
+ not_after: string;
360
+ fingerprint: string;
361
+ signature_algorithm: string;
362
+ sans: string[] | null;
363
+ is_ca: boolean;
364
+ position_in_chain: number | null;
365
+ quote: string | null;
366
+ app_id?: string | null | undefined;
367
+ cert_usage?: string | null | undefined;
368
+ }[] | null;
369
+ tcb_info: {
370
+ app_compose: string;
371
+ mrtd: string;
372
+ rtmr0: string;
373
+ rtmr1: string;
374
+ rtmr2: string;
375
+ rtmr3: string;
376
+ event_log: {
377
+ imr: number;
378
+ event_type: number;
379
+ digest: string;
380
+ event: string;
381
+ event_payload: string;
382
+ }[];
383
+ rootfs_hash?: string | null | undefined;
384
+ } | null;
385
+ }>>;
386
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient, params: CvmIdInput, parameters: {
387
+ schema: T;
388
+ }): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
389
+ (client: import("../..").BaseClient, params: CvmIdInput, parameters: {
390
+ schema: false;
391
+ }): Promise<import("../..").SafeResult<unknown>>;
392
+ };
393
+ export { getCvmAttestation, safeGetCvmAttestation };