@phala/cloud 0.4.0 → 0.5.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.
Files changed (110) hide show
  1. package/README.md +20 -0
  2. package/dist/actions/api_tokens/revoke_current_api_token.d.ts +47 -0
  3. package/dist/actions/apps/app_launch_token.d.ts +121 -0
  4. package/dist/actions/apps/check_app_cvms_is_allowed.d.ts +17 -311
  5. package/dist/actions/apps/check_app_is_allowed.d.ts +20 -32
  6. package/dist/actions/apps/create_app_instance.d.ts +43 -63
  7. package/dist/actions/apps/get_app_attestation.d.ts +113 -779
  8. package/dist/actions/apps/get_app_cvms.d.ts +1 -5
  9. package/dist/actions/apps/get_app_device_allowlist.d.ts +26 -272
  10. package/dist/actions/apps/get_app_filter_options.d.ts +8 -24
  11. package/dist/actions/apps/get_app_info.d.ts +1 -5
  12. package/dist/actions/apps/get_app_list.d.ts +2 -26
  13. package/dist/actions/apps/get_app_revision_detail.d.ts +1 -9
  14. package/dist/actions/apps/get_app_revisions.d.ts +1 -9
  15. package/dist/actions/blockchains/add_compose_hash.d.ts +1 -13
  16. package/dist/actions/blockchains/add_device.d.ts +1 -13
  17. package/dist/actions/blockchains/deploy_app_auth.d.ts +3 -95
  18. package/dist/actions/blockchains/get_allowed_devices.d.ts +2 -12
  19. package/dist/actions/blockchains/remove_device.d.ts +1 -13
  20. package/dist/actions/blockchains/set_allow_any_device.d.ts +1 -13
  21. package/dist/actions/cvms/check_cvm_is_allowed.d.ts +13 -138
  22. package/dist/actions/cvms/commit_cvm_compose_file_update.d.ts +9 -45
  23. package/dist/actions/cvms/commit_cvm_provision.d.ts +32 -422
  24. package/dist/actions/cvms/commit_cvm_update.d.ts +70 -41
  25. package/dist/actions/cvms/confirm_cvm_patch.d.ts +62 -35
  26. package/dist/actions/cvms/cvm_annotations.d.ts +152 -0
  27. package/dist/actions/cvms/delete_cvm.d.ts +8 -14
  28. package/dist/actions/cvms/get_available_os_images.d.ts +70 -111
  29. package/dist/actions/cvms/get_cvm_attestation.d.ts +34 -392
  30. package/dist/actions/cvms/get_cvm_compose_file.d.ts +384 -614
  31. package/dist/actions/cvms/get_cvm_containers_stats.d.ts +25 -91
  32. package/dist/actions/cvms/get_cvm_docker_compose.d.ts +8 -14
  33. package/dist/actions/cvms/get_cvm_info.d.ts +6 -12
  34. package/dist/actions/cvms/get_cvm_init_scripts.d.ts +87 -0
  35. package/dist/actions/cvms/get_cvm_list.d.ts +7 -13
  36. package/dist/actions/cvms/get_cvm_network.d.ts +18 -50
  37. package/dist/actions/cvms/get_cvm_prelaunch_script.d.ts +8 -14
  38. package/dist/actions/cvms/get_cvm_state.d.ts +11 -37
  39. package/dist/actions/cvms/get_cvm_stats.d.ts +23 -149
  40. package/dist/actions/cvms/get_cvm_status_batch.d.ts +19 -209
  41. package/dist/actions/cvms/get_cvm_user_config.d.ts +13 -24
  42. package/dist/actions/cvms/get_prelaunch_script_upgrade_status.d.ts +9 -27
  43. package/dist/actions/cvms/patch_cvm.d.ts +658 -295
  44. package/dist/actions/cvms/provision_cvm.d.ts +326 -1561
  45. package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +550 -953
  46. package/dist/actions/cvms/refresh_cvm_instance_id.d.ts +74 -131
  47. package/dist/actions/cvms/refresh_cvm_instance_ids.d.ts +77 -297
  48. package/dist/actions/cvms/replicate_cvm.d.ts +7 -21
  49. package/dist/actions/cvms/restart_cvm.d.ts +3 -18
  50. package/dist/actions/cvms/shutdown_cvm.d.ts +6 -12
  51. package/dist/actions/cvms/start_cvm.d.ts +6 -12
  52. package/dist/actions/cvms/stop_cvm.d.ts +6 -12
  53. package/dist/actions/cvms/update_cvm_envs.d.ts +136 -203
  54. package/dist/actions/cvms/update_cvm_resources.d.ts +82 -48
  55. package/dist/actions/cvms/update_cvm_visibility.d.ts +90 -132
  56. package/dist/actions/cvms/update_docker_compose.d.ts +127 -202
  57. package/dist/actions/cvms/update_os_image.d.ts +55 -28
  58. package/dist/actions/cvms/update_prelaunch_script.d.ts +127 -202
  59. package/dist/actions/cvms/upgrade_prelaunch_script.d.ts +118 -193
  60. package/dist/actions/cvms/watch_cvm_state.d.ts +5 -15
  61. package/dist/actions/get_available_nodes.d.ts +186 -1067
  62. package/dist/actions/get_cvm_create_resources.d.ts +138 -2489
  63. package/dist/actions/index.d.ts +8 -2
  64. package/dist/actions/kms/get_app_env_encrypt_pubkey.d.ts +11 -23
  65. package/dist/actions/kms/get_kms_contract.d.ts +25 -27
  66. package/dist/actions/kms/get_kms_info.d.ts +3 -7
  67. package/dist/actions/kms/get_kms_list.d.ts +34 -88
  68. package/dist/actions/kms/get_kms_onchain_detail.d.ts +66 -664
  69. package/dist/actions/kms/list_kms_contract_nodes.d.ts +21 -53
  70. package/dist/actions/kms/list_kms_contracts.d.ts +33 -87
  71. package/dist/actions/kms/next_app_ids.d.ts +5 -25
  72. package/dist/actions/list-instance-types.d.ts +77 -257
  73. package/dist/actions/os_images/get_os_images.d.ts +38 -152
  74. package/dist/actions/ssh_keys/create_ssh_key.d.ts +11 -17
  75. package/dist/actions/ssh_keys/delete_ssh_key.d.ts +3 -7
  76. package/dist/actions/ssh_keys/get_cvm_ssh_keys.d.ts +113 -0
  77. package/dist/actions/ssh_keys/import_github_profile.d.ts +7 -21
  78. package/dist/actions/ssh_keys/list_ssh_keys.d.ts +2 -50
  79. package/dist/actions/ssh_keys/sync_github_ssh_keys.d.ts +8 -20
  80. package/dist/actions/ssh_keys/update_cvm_ssh_keys.d.ts +140 -0
  81. package/dist/actions/workspaces/get_workspace.d.ts +32 -28
  82. package/dist/actions/workspaces/get_workspace_nodes.d.ts +34 -321
  83. package/dist/actions/workspaces/get_workspace_quotas.d.ts +107 -1021
  84. package/dist/actions/workspaces/list_workspaces.d.ts +67 -369
  85. package/dist/client.d.ts +23 -4
  86. package/dist/create-client.d.ts +1772 -1
  87. package/dist/credentials/current_user_v20251028.d.ts +1 -17
  88. package/dist/credentials/current_user_v20260121.d.ts +22 -227
  89. package/dist/index.d.ts +0 -1
  90. package/dist/index.js +5010 -4265
  91. package/dist/index.mjs +4892 -4192
  92. package/dist/types/app_compose.d.ts +108 -221
  93. package/dist/types/app_info_v20251028.d.ts +22 -1067
  94. package/dist/types/app_info_v20260121.d.ts +430 -8900
  95. package/dist/types/app_revision.d.ts +15 -371
  96. package/dist/types/client.d.ts +16 -0
  97. package/dist/types/common.d.ts +6 -0
  98. package/dist/types/cvm_id.d.ts +12 -57
  99. package/dist/types/cvm_info.d.ts +33 -460
  100. package/dist/types/cvm_info_v20251028.d.ts +99 -820
  101. package/dist/types/cvm_info_v20260121.d.ts +247 -3160
  102. package/dist/types/kms_contract.d.ts +2 -32
  103. package/dist/types/kms_info.d.ts +34 -68
  104. package/dist/utils/define-action.d.ts +4 -4
  105. package/dist/utils/errors.d.ts +4 -36
  106. package/dist/utils/get_compose_hash.d.ts +36 -5
  107. package/dist/utils/get_mr_config_id.d.ts +94 -3
  108. package/dist/utils/index.d.ts +1 -1
  109. package/dist/utils/placement-request.d.ts +3 -0
  110. package/package.json +4 -4
@@ -2,13 +2,7 @@ import { z } from "zod";
2
2
  export declare const CreateSshKeyRequestSchema: z.ZodObject<{
3
3
  name: z.ZodString;
4
4
  public_key: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- name: string;
7
- public_key: string;
8
- }, {
9
- name: string;
10
- public_key: string;
11
- }>;
5
+ }, z.core.$strip>;
12
6
  export type CreateSshKeyRequest = z.infer<typeof CreateSshKeyRequestSchema>;
13
7
  /**
14
8
  * Create a new SSH key for the current user
@@ -47,15 +41,15 @@ declare const createSshKey: {
47
41
  name: string;
48
42
  public_key: string;
49
43
  }): Promise<{
50
- name: string;
51
44
  id: string;
52
- source: string;
53
- created_at: string;
54
45
  user_id: string;
55
- updated_at: string;
46
+ name: string;
56
47
  public_key: string;
57
48
  fingerprint: string;
58
49
  key_type: string;
50
+ source: string;
51
+ created_at: string;
52
+ updated_at: string;
59
53
  key_metadata?: Record<string, unknown> | null | undefined;
60
54
  last_synced_at?: string | null | undefined;
61
55
  }>;
@@ -64,7 +58,7 @@ declare const createSshKey: {
64
58
  public_key: string;
65
59
  }, parameters: {
66
60
  schema: T;
67
- }): Promise<z.TypeOf<T>>;
61
+ }): Promise<z.core.output<T>>;
68
62
  (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
69
63
  name: string;
70
64
  public_key: string;
@@ -76,15 +70,15 @@ declare const createSshKey: {
76
70
  name: string;
77
71
  public_key: string;
78
72
  }): Promise<import("../..").SafeResult<{
79
- name: string;
80
73
  id: string;
81
- source: string;
82
- created_at: string;
83
74
  user_id: string;
84
- updated_at: string;
75
+ name: string;
85
76
  public_key: string;
86
77
  fingerprint: string;
87
78
  key_type: string;
79
+ source: string;
80
+ created_at: string;
81
+ updated_at: string;
88
82
  key_metadata?: Record<string, unknown> | null | undefined;
89
83
  last_synced_at?: string | null | undefined;
90
84
  }>>;
@@ -93,7 +87,7 @@ declare const createSshKey: {
93
87
  public_key: string;
94
88
  }, parameters: {
95
89
  schema: T;
96
- }): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
90
+ }): Promise<import("../..").SafeResult<z.core.output<T>>>;
97
91
  (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
98
92
  name: string;
99
93
  public_key: string;
@@ -1,11 +1,7 @@
1
1
  import { z } from "zod";
2
2
  export declare const DeleteSshKeyRequestSchema: z.ZodObject<{
3
3
  keyId: z.ZodString;
4
- }, "strip", z.ZodTypeAny, {
5
- keyId: string;
6
- }, {
7
- keyId: string;
8
- }>;
4
+ }, z.core.$strip>;
9
5
  export type DeleteSshKeyRequest = z.infer<typeof DeleteSshKeyRequestSchema>;
10
6
  /**
11
7
  * Delete an SSH key
@@ -41,7 +37,7 @@ declare const deleteSshKey: {
41
37
  keyId: string;
42
38
  }, parameters: {
43
39
  schema: T;
44
- }): Promise<z.TypeOf<T>>;
40
+ }): Promise<z.core.output<T>>;
45
41
  (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
46
42
  keyId: string;
47
43
  }, parameters: {
@@ -55,7 +51,7 @@ declare const deleteSshKey: {
55
51
  keyId: string;
56
52
  }, parameters: {
57
53
  schema: T;
58
- }): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
54
+ }): Promise<import("../..").SafeResult<z.core.output<T>>>;
59
55
  (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
60
56
  keyId: string;
61
57
  }, parameters: {
@@ -0,0 +1,113 @@
1
+ import { z } from "zod";
2
+ import { type CvmIdInput } from "../../types/cvm_id";
3
+ export declare const CvmSshKeySchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ owner_user_id: z.ZodString;
6
+ owner_username: z.ZodString;
7
+ added_by_user_id: z.ZodString;
8
+ name: z.ZodString;
9
+ public_key: z.ZodString;
10
+ fingerprint: z.ZodString;
11
+ key_type: z.ZodString;
12
+ }, z.core.$strip>;
13
+ export type CvmSshKey = z.infer<typeof CvmSshKeySchema>;
14
+ export declare const CvmSshKeysResponseSchema: z.ZodObject<{
15
+ keys: z.ZodArray<z.ZodObject<{
16
+ id: z.ZodString;
17
+ owner_user_id: z.ZodString;
18
+ owner_username: z.ZodString;
19
+ added_by_user_id: z.ZodString;
20
+ name: z.ZodString;
21
+ public_key: z.ZodString;
22
+ fingerprint: z.ZodString;
23
+ key_type: z.ZodString;
24
+ }, z.core.$strip>>;
25
+ restart_required: z.ZodBoolean;
26
+ }, z.core.$strip>;
27
+ export type CvmSshKeysResponse = z.infer<typeof CvmSshKeysResponseSchema>;
28
+ export declare const GetCvmSshKeysRequestSchema: z.ZodPipe<z.ZodObject<{
29
+ id: z.ZodOptional<z.ZodString>;
30
+ uuid: z.ZodOptional<z.ZodString>;
31
+ app_id: z.ZodOptional<z.ZodString>;
32
+ instance_id: z.ZodOptional<z.ZodString>;
33
+ name: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strip>, z.ZodTransform<{
35
+ cvmId: string;
36
+ }, {
37
+ id?: string | undefined;
38
+ uuid?: string | undefined;
39
+ app_id?: string | undefined;
40
+ instance_id?: string | undefined;
41
+ name?: string | undefined;
42
+ }>>;
43
+ export type GetCvmSshKeysRequest = CvmIdInput;
44
+ /**
45
+ * List the SSH keys a CVM is configured to authorize.
46
+ *
47
+ * This is the stored set. It reaches the guest at the next power-on; read
48
+ * `getCvmUserConfig` for what the running VM actually has.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * import { createClient, getCvmSshKeys } from '@phala/cloud'
53
+ *
54
+ * const client = createClient({ apiKey: 'your-api-key' })
55
+ * const result = await getCvmSshKeys(client, { id: 'app_123' })
56
+ * for (const key of result.keys) {
57
+ * console.log(key.owner_username, key.fingerprint)
58
+ * }
59
+ * ```
60
+ *
61
+ * ## Safe Version
62
+ *
63
+ * ```typescript
64
+ * const result = await safeGetCvmSshKeys(client, { id: 'app_123' })
65
+ * if (result.success) {
66
+ * console.log(result.data.restart_required)
67
+ * } else {
68
+ * console.error(result.error.message)
69
+ * }
70
+ * ```
71
+ */
72
+ declare const getCvmSshKeys: {
73
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: CvmIdInput): Promise<{
74
+ keys: {
75
+ id: string;
76
+ owner_user_id: string;
77
+ owner_username: string;
78
+ added_by_user_id: string;
79
+ name: string;
80
+ public_key: string;
81
+ fingerprint: string;
82
+ key_type: string;
83
+ }[];
84
+ restart_required: boolean;
85
+ }>;
86
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: CvmIdInput, parameters: {
87
+ schema: T;
88
+ }): Promise<z.core.output<T>>;
89
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: CvmIdInput, parameters: {
90
+ schema: false;
91
+ }): Promise<unknown>;
92
+ }, safeGetCvmSshKeys: {
93
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: CvmIdInput): Promise<import("../..").SafeResult<{
94
+ keys: {
95
+ id: string;
96
+ owner_user_id: string;
97
+ owner_username: string;
98
+ added_by_user_id: string;
99
+ name: string;
100
+ public_key: string;
101
+ fingerprint: string;
102
+ key_type: string;
103
+ }[];
104
+ restart_required: boolean;
105
+ }>>;
106
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: CvmIdInput, parameters: {
107
+ schema: T;
108
+ }): Promise<import("../..").SafeResult<z.core.output<T>>>;
109
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: CvmIdInput, parameters: {
110
+ schema: false;
111
+ }): Promise<import("../..").SafeResult<unknown>>;
112
+ };
113
+ export { getCvmSshKeys, safeGetCvmSshKeys };
@@ -1,28 +1,14 @@
1
1
  import { z } from "zod";
2
2
  export declare const ImportGithubProfileRequestSchema: z.ZodObject<{
3
3
  github_username: z.ZodString;
4
- }, "strip", z.ZodTypeAny, {
5
- github_username: string;
6
- }, {
7
- github_username: string;
8
- }>;
4
+ }, z.core.$strip>;
9
5
  export type ImportGithubProfileRequest = z.infer<typeof ImportGithubProfileRequestSchema>;
10
6
  export declare const ImportGithubProfileResponseSchema: z.ZodObject<{
11
7
  github_username: z.ZodString;
12
8
  keys_added: z.ZodNumber;
13
9
  keys_skipped: z.ZodNumber;
14
- errors: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
15
- }, "strip", z.ZodTypeAny, {
16
- errors: string[];
17
- github_username: string;
18
- keys_added: number;
19
- keys_skipped: number;
20
- }, {
21
- github_username: string;
22
- keys_added: number;
23
- keys_skipped: number;
24
- errors?: string[] | undefined;
25
- }>;
10
+ errors: z.ZodDefault<z.ZodArray<z.ZodString>>;
11
+ }, z.core.$strip>;
26
12
  export type ImportGithubProfileResponse = z.infer<typeof ImportGithubProfileResponseSchema>;
27
13
  /**
28
14
  * Import SSH keys from a GitHub user's public profile
@@ -55,16 +41,16 @@ declare const importGithubProfileSshKeys: {
55
41
  (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
56
42
  github_username: string;
57
43
  }): Promise<{
58
- errors: string[];
59
44
  github_username: string;
60
45
  keys_added: number;
61
46
  keys_skipped: number;
47
+ errors: string[];
62
48
  }>;
63
49
  <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
64
50
  github_username: string;
65
51
  }, parameters: {
66
52
  schema: T;
67
- }): Promise<z.TypeOf<T>>;
53
+ }): Promise<z.core.output<T>>;
68
54
  (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
69
55
  github_username: string;
70
56
  }, parameters: {
@@ -74,16 +60,16 @@ declare const importGithubProfileSshKeys: {
74
60
  (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
75
61
  github_username: string;
76
62
  }): Promise<import("../..").SafeResult<{
77
- errors: string[];
78
63
  github_username: string;
79
64
  keys_added: number;
80
65
  keys_skipped: number;
66
+ errors: string[];
81
67
  }>>;
82
68
  <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
83
69
  github_username: string;
84
70
  }, parameters: {
85
71
  schema: T;
86
- }): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
72
+ }): Promise<import("../..").SafeResult<z.core.output<T>>>;
87
73
  (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
88
74
  github_username: string;
89
75
  }, parameters: {
@@ -13,31 +13,7 @@ export declare const SshKeySchema: z.ZodObject<{
13
13
  last_synced_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
14
  created_at: z.ZodString;
15
15
  updated_at: z.ZodString;
16
- }, "strip", z.ZodTypeAny, {
17
- name: string;
18
- id: string;
19
- source: string;
20
- created_at: string;
21
- user_id: string;
22
- updated_at: string;
23
- public_key: string;
24
- fingerprint: string;
25
- key_type: string;
26
- key_metadata?: Record<string, unknown> | null | undefined;
27
- last_synced_at?: string | null | undefined;
28
- }, {
29
- name: string;
30
- id: string;
31
- source: string;
32
- created_at: string;
33
- user_id: string;
34
- updated_at: string;
35
- public_key: string;
36
- fingerprint: string;
37
- key_type: string;
38
- key_metadata?: Record<string, unknown> | null | undefined;
39
- last_synced_at?: string | null | undefined;
40
- }>;
16
+ }, z.core.$strip>;
41
17
  export type SshKey = z.infer<typeof SshKeySchema>;
42
18
  export declare const ListSshKeysResponseSchema: z.ZodArray<z.ZodObject<{
43
19
  id: z.ZodString;
@@ -51,31 +27,7 @@ export declare const ListSshKeysResponseSchema: z.ZodArray<z.ZodObject<{
51
27
  last_synced_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
28
  created_at: z.ZodString;
53
29
  updated_at: z.ZodString;
54
- }, "strip", z.ZodTypeAny, {
55
- name: string;
56
- id: string;
57
- source: string;
58
- created_at: string;
59
- user_id: string;
60
- updated_at: string;
61
- public_key: string;
62
- fingerprint: string;
63
- key_type: string;
64
- key_metadata?: Record<string, unknown> | null | undefined;
65
- last_synced_at?: string | null | undefined;
66
- }, {
67
- name: string;
68
- id: string;
69
- source: string;
70
- created_at: string;
71
- user_id: string;
72
- updated_at: string;
73
- public_key: string;
74
- fingerprint: string;
75
- key_type: string;
76
- key_metadata?: Record<string, unknown> | null | undefined;
77
- last_synced_at?: string | null | undefined;
78
- }>, "many">;
30
+ }, z.core.$strip>>;
79
31
  export type ListSshKeysResponse = z.infer<typeof ListSshKeysResponseSchema>;
80
32
  /**
81
33
  * List SSH keys for the current user
@@ -4,20 +4,8 @@ export declare const SyncGithubSshKeysResponseSchema: z.ZodObject<{
4
4
  keys_added: z.ZodNumber;
5
5
  keys_updated: z.ZodNumber;
6
6
  keys_removed: z.ZodNumber;
7
- errors: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
8
- }, "strip", z.ZodTypeAny, {
9
- errors: string[];
10
- keys_added: number;
11
- synced_count: number;
12
- keys_updated: number;
13
- keys_removed: number;
14
- }, {
15
- keys_added: number;
16
- synced_count: number;
17
- keys_updated: number;
18
- keys_removed: number;
19
- errors?: string[] | undefined;
20
- }>;
7
+ errors: z.ZodDefault<z.ZodArray<z.ZodString>>;
8
+ }, z.core.$strip>;
21
9
  export type SyncGithubSshKeysResponse = z.infer<typeof SyncGithubSshKeysResponseSchema>;
22
10
  /**
23
11
  * Sync SSH keys from the user's linked GitHub account
@@ -52,13 +40,13 @@ declare const syncGithubSshKeys: {
52
40
  }): Promise<unknown>;
53
41
  <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, parameters: {
54
42
  schema: T;
55
- }): Promise<z.TypeOf<T>>;
43
+ }): Promise<z.core.output<T>>;
56
44
  (client: import("../..").BaseClient<import("../..").ApiVersion>): Promise<{
57
- errors: string[];
58
- keys_added: number;
59
45
  synced_count: number;
46
+ keys_added: number;
60
47
  keys_updated: number;
61
48
  keys_removed: number;
49
+ errors: string[];
62
50
  }>;
63
51
  }, safeSyncGithubSshKeys: {
64
52
  (client: import("../..").BaseClient<import("../..").ApiVersion>, parameters: {
@@ -66,13 +54,13 @@ declare const syncGithubSshKeys: {
66
54
  }): Promise<import("../..").SafeResult<unknown>>;
67
55
  <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, parameters: {
68
56
  schema: T;
69
- }): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
57
+ }): Promise<import("../..").SafeResult<z.core.output<T>>>;
70
58
  (client: import("../..").BaseClient<import("../..").ApiVersion>): Promise<import("../..").SafeResult<{
71
- errors: string[];
72
- keys_added: number;
73
59
  synced_count: number;
60
+ keys_added: number;
74
61
  keys_updated: number;
75
62
  keys_removed: number;
63
+ errors: string[];
76
64
  }>>;
77
65
  };
78
66
  export { syncGithubSshKeys, safeSyncGithubSshKeys };
@@ -0,0 +1,140 @@
1
+ import { z } from "zod";
2
+ export declare const UpdateCvmSshKeysRequestSchema: z.ZodObject<{
3
+ id: z.ZodOptional<z.ZodString>;
4
+ uuid: z.ZodOptional<z.ZodString>;
5
+ app_id: z.ZodOptional<z.ZodString>;
6
+ instance_id: z.ZodOptional<z.ZodString>;
7
+ name: z.ZodOptional<z.ZodString>;
8
+ ssh_key_ids: z.ZodArray<z.ZodString>;
9
+ usernames: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ apply_now: z.ZodOptional<z.ZodBoolean>;
11
+ }, z.core.$strip>;
12
+ export type UpdateCvmSshKeysRequest = z.input<typeof UpdateCvmSshKeysRequestSchema>;
13
+ /**
14
+ * Replace the SSH keys a CVM authorizes.
15
+ *
16
+ * `ssh_key_ids` is the replacement set. Optional `usernames` are resolved
17
+ * server-side to that member's keys and unioned into the set. Keys take
18
+ * effect at the next power-on, or immediately when `apply_now` restarts the CVM.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * import { createClient, updateCvmSshKeys } from '@phala/cloud'
23
+ *
24
+ * const client = createClient({ apiKey: 'your-api-key' })
25
+ * const result = await updateCvmSshKeys(client, {
26
+ * id: 'app_123',
27
+ * ssh_key_ids: ['sshkey_abc'],
28
+ * usernames: ['alice'],
29
+ * apply_now: false,
30
+ * })
31
+ * ```
32
+ *
33
+ * ## Safe Version
34
+ *
35
+ * ```typescript
36
+ * const result = await safeUpdateCvmSshKeys(client, {
37
+ * id: 'app_123',
38
+ * ssh_key_ids: ['sshkey_abc'],
39
+ * })
40
+ * if (!result.success) {
41
+ * console.error(result.error.message)
42
+ * }
43
+ * ```
44
+ */
45
+ declare const updateCvmSshKeys: {
46
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
47
+ ssh_key_ids: string[];
48
+ id?: string | undefined;
49
+ uuid?: string | undefined;
50
+ app_id?: string | undefined;
51
+ instance_id?: string | undefined;
52
+ name?: string | undefined;
53
+ usernames?: string[] | undefined;
54
+ apply_now?: boolean | undefined;
55
+ }): Promise<{
56
+ keys: {
57
+ id: string;
58
+ owner_user_id: string;
59
+ owner_username: string;
60
+ added_by_user_id: string;
61
+ name: string;
62
+ public_key: string;
63
+ fingerprint: string;
64
+ key_type: string;
65
+ }[];
66
+ restart_required: boolean;
67
+ }>;
68
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
69
+ ssh_key_ids: string[];
70
+ id?: string | undefined;
71
+ uuid?: string | undefined;
72
+ app_id?: string | undefined;
73
+ instance_id?: string | undefined;
74
+ name?: string | undefined;
75
+ usernames?: string[] | undefined;
76
+ apply_now?: boolean | undefined;
77
+ }, parameters: {
78
+ schema: T;
79
+ }): Promise<z.core.output<T>>;
80
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
81
+ ssh_key_ids: string[];
82
+ id?: string | undefined;
83
+ uuid?: string | undefined;
84
+ app_id?: string | undefined;
85
+ instance_id?: string | undefined;
86
+ name?: string | undefined;
87
+ usernames?: string[] | undefined;
88
+ apply_now?: boolean | undefined;
89
+ }, parameters: {
90
+ schema: false;
91
+ }): Promise<unknown>;
92
+ }, safeUpdateCvmSshKeys: {
93
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
94
+ ssh_key_ids: string[];
95
+ id?: string | undefined;
96
+ uuid?: string | undefined;
97
+ app_id?: string | undefined;
98
+ instance_id?: string | undefined;
99
+ name?: string | undefined;
100
+ usernames?: string[] | undefined;
101
+ apply_now?: boolean | undefined;
102
+ }): Promise<import("../..").SafeResult<{
103
+ keys: {
104
+ id: string;
105
+ owner_user_id: string;
106
+ owner_username: string;
107
+ added_by_user_id: string;
108
+ name: string;
109
+ public_key: string;
110
+ fingerprint: string;
111
+ key_type: string;
112
+ }[];
113
+ restart_required: boolean;
114
+ }>>;
115
+ <T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
116
+ ssh_key_ids: string[];
117
+ id?: string | undefined;
118
+ uuid?: string | undefined;
119
+ app_id?: string | undefined;
120
+ instance_id?: string | undefined;
121
+ name?: string | undefined;
122
+ usernames?: string[] | undefined;
123
+ apply_now?: boolean | undefined;
124
+ }, parameters: {
125
+ schema: T;
126
+ }): Promise<import("../..").SafeResult<z.core.output<T>>>;
127
+ (client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
128
+ ssh_key_ids: string[];
129
+ id?: string | undefined;
130
+ uuid?: string | undefined;
131
+ app_id?: string | undefined;
132
+ instance_id?: string | undefined;
133
+ name?: string | undefined;
134
+ usernames?: string[] | undefined;
135
+ apply_now?: boolean | undefined;
136
+ }, parameters: {
137
+ schema: false;
138
+ }): Promise<import("../..").SafeResult<unknown>>;
139
+ };
140
+ export { updateCvmSshKeys, safeUpdateCvmSshKeys };
@@ -64,42 +64,46 @@ import { type Client } from "../../client";
64
64
  * ```
65
65
  */
66
66
  declare const getWorkspace: {
67
- (client: Client<import("../..").ApiVersion>, params: string): Promise<z.objectOutputType<{
68
- id: z.ZodString;
69
- name: z.ZodString;
70
- slug: z.ZodNullable<z.ZodString>;
71
- avatar_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
- tier: z.ZodString;
73
- role: z.ZodString;
74
- is_default: z.ZodBoolean;
75
- created_at: z.ZodString;
76
- confidential_models_enabled: z.ZodOptional<z.ZodBoolean>;
77
- billing_status: z.ZodDefault<z.ZodEnum<["active", "suspended", "abandoned"]>>;
78
- suspended_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
- }, z.ZodTypeAny, "passthrough">>;
67
+ (client: Client<import("../..").ApiVersion>, params: string): Promise<{
68
+ [x: string]: unknown;
69
+ id: string;
70
+ name: string;
71
+ slug: string | null;
72
+ tier: string;
73
+ role: string;
74
+ is_default: boolean;
75
+ created_at: string;
76
+ billing_status: "active" | "suspended" | "abandoned";
77
+ avatar_url?: string | null | undefined;
78
+ description?: string | null | undefined;
79
+ confidential_models_enabled?: boolean | undefined;
80
+ suspended_at?: string | null | undefined;
81
+ }>;
80
82
  <T extends z.ZodTypeAny>(client: Client<import("../..").ApiVersion>, params: string, parameters: {
81
83
  schema: T;
82
- }): Promise<z.TypeOf<T>>;
84
+ }): Promise<z.core.output<T>>;
83
85
  (client: Client<import("../..").ApiVersion>, params: string, parameters: {
84
86
  schema: false;
85
87
  }): Promise<unknown>;
86
88
  }, safeGetWorkspace: {
87
- (client: Client<import("../..").ApiVersion>, params: string): Promise<import("../..").SafeResult<z.objectOutputType<{
88
- id: z.ZodString;
89
- name: z.ZodString;
90
- slug: z.ZodNullable<z.ZodString>;
91
- avatar_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
- tier: z.ZodString;
93
- role: z.ZodString;
94
- is_default: z.ZodBoolean;
95
- created_at: z.ZodString;
96
- confidential_models_enabled: z.ZodOptional<z.ZodBoolean>;
97
- billing_status: z.ZodDefault<z.ZodEnum<["active", "suspended", "abandoned"]>>;
98
- suspended_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
- }, z.ZodTypeAny, "passthrough">>>;
89
+ (client: Client<import("../..").ApiVersion>, params: string): Promise<import("../..").SafeResult<{
90
+ [x: string]: unknown;
91
+ id: string;
92
+ name: string;
93
+ slug: string | null;
94
+ tier: string;
95
+ role: string;
96
+ is_default: boolean;
97
+ created_at: string;
98
+ billing_status: "active" | "suspended" | "abandoned";
99
+ avatar_url?: string | null | undefined;
100
+ description?: string | null | undefined;
101
+ confidential_models_enabled?: boolean | undefined;
102
+ suspended_at?: string | null | undefined;
103
+ }>>;
100
104
  <T extends z.ZodTypeAny>(client: Client<import("../..").ApiVersion>, params: string, parameters: {
101
105
  schema: T;
102
- }): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
106
+ }): Promise<import("../..").SafeResult<z.core.output<T>>>;
103
107
  (client: Client<import("../..").ApiVersion>, params: string, parameters: {
104
108
  schema: false;
105
109
  }): Promise<import("../..").SafeResult<unknown>>;