Skip to main content

systemprompt_cli/commands/cloud/
types.rs

1use chrono::{DateTime, Utc};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5pub use systemprompt_models::profile::ProfileInfo;
6
7#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
8pub struct CredentialsInfo {
9    pub authenticated: bool,
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub user_email: Option<String>,
12    pub token_expired: bool,
13}
14
15#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
16pub struct TenantStatusInfo {
17    pub id: String,
18    pub name: String,
19    pub status: String,
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub url: Option<String>,
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub message: Option<String>,
24    pub configured_in_profile: bool,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
28pub struct CloudStatusOutput {
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub profile: Option<ProfileInfo>,
31    pub credentials: CredentialsInfo,
32    pub tenants: Vec<TenantStatusInfo>,
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
36pub struct TenantPlanInfo {
37    pub name: String,
38    pub memory_mb: i32,
39    pub volume_gb: i32,
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
43pub struct LoginTenantInfo {
44    pub id: String,
45    pub name: String,
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub subscription_status: Option<String>,
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub plan: Option<TenantPlanInfo>,
50    #[serde(skip_serializing_if = "Option::is_none")]
51    pub region: Option<String>,
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub hostname: Option<String>,
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
57pub struct LoginUserInfo {
58    pub id: String,
59    pub email: String,
60    #[serde(skip_serializing_if = "Option::is_none")]
61    pub name: Option<String>,
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
65pub struct LoginCustomerInfo {
66    pub id: String,
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
70pub struct LoginOutput {
71    pub user: LoginUserInfo,
72    #[serde(skip_serializing_if = "Option::is_none")]
73    pub customer: Option<LoginCustomerInfo>,
74    pub tenants: Vec<LoginTenantInfo>,
75    pub credentials_path: String,
76    pub tenants_path: String,
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
80pub struct WhoamiOutput {
81    pub user_email: String,
82    pub api_url: String,
83    pub token_status: String,
84    pub authenticated_at: DateTime<Utc>,
85    pub local_profiles: usize,
86    pub cloud_tenants: usize,
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
90pub struct LogoutOutput {
91    pub message: String,
92    #[serde(skip_serializing_if = "Option::is_none")]
93    pub credentials_path: Option<String>,
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
97pub struct TenantSummary {
98    pub id: String,
99    pub name: String,
100    pub tenant_type: String,
101    pub has_database: bool,
102}
103
104#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
105pub struct TenantListOutput {
106    pub tenants: Vec<TenantSummary>,
107    pub total: usize,
108}
109
110#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
111pub struct TenantDetailOutput {
112    pub id: String,
113    pub name: String,
114    pub tenant_type: String,
115    #[serde(skip_serializing_if = "Option::is_none")]
116    pub app_id: Option<String>,
117    #[serde(skip_serializing_if = "Option::is_none")]
118    pub hostname: Option<String>,
119    #[serde(skip_serializing_if = "Option::is_none")]
120    pub region: Option<String>,
121    pub has_database: bool,
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
125pub struct TenantCreateOutput {
126    pub id: String,
127    pub name: String,
128    pub tenant_type: String,
129    #[serde(skip_serializing_if = "Option::is_none")]
130    pub database_url: Option<String>,
131    #[serde(skip_serializing_if = "Option::is_none")]
132    pub profile_name: Option<String>,
133    pub message: String,
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
137pub struct RotateCredentialsOutput {
138    #[serde(rename = "tenant_id")]
139    pub tenant: String,
140    pub status: String,
141    pub internal_database_url: String,
142    pub external_database_url: String,
143}
144
145#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
146pub struct RotateSyncTokenOutput {
147    #[serde(rename = "tenant_id")]
148    pub tenant: String,
149    pub status: String,
150    pub message: String,
151}
152
153#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
154pub struct ProfileSummary {
155    pub name: String,
156    pub has_secrets: bool,
157    pub is_active: bool,
158}
159
160#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
161pub struct ProfileListOutput {
162    pub profiles: Vec<ProfileSummary>,
163    pub total: usize,
164    #[serde(skip_serializing_if = "Option::is_none")]
165    pub active_profile: Option<String>,
166}
167
168#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
169pub struct DeployOutput {
170    pub tenant_name: String,
171    pub image: String,
172    pub status: String,
173    #[serde(skip_serializing_if = "Option::is_none")]
174    pub url: Option<String>,
175    pub secrets_synced: usize,
176    pub cloud_credentials_synced: usize,
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
180pub struct SyncOutput {
181    pub direction: String,
182    pub dry_run: bool,
183    pub operations: Vec<SyncOperationOutput>,
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
187pub struct SyncOperationOutput {
188    pub operation: String,
189    pub success: bool,
190    pub items_synced: usize,
191    pub errors: Vec<String>,
192}
193
194#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
195pub struct AdminUserSyncResultOutput {
196    pub profile: String,
197    pub success: bool,
198    #[serde(skip_serializing_if = "Option::is_none")]
199    pub message: Option<String>,
200    #[serde(skip_serializing_if = "Option::is_none")]
201    pub error: Option<String>,
202}
203
204#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
205pub struct AdminUserSyncOutput {
206    pub cloud_user_email: String,
207    pub results: Vec<AdminUserSyncResultOutput>,
208}
209
210#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
211pub struct SkillsSyncOutput {
212    pub direction: String,
213    pub dry_run: bool,
214    pub synced: usize,
215    pub created: usize,
216    pub updated: usize,
217    pub deleted: usize,
218    pub errors: Vec<String>,
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
222pub struct SecretsOutput {
223    pub operation: String,
224    pub keys: Vec<String>,
225    #[serde(skip_serializing_if = "Option::is_none")]
226    pub rejected_keys: Option<Vec<String>>,
227}
228
229#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
230pub struct RestartOutput {
231    pub tenant_name: String,
232    pub status: String,
233}
234
235#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
236pub struct DomainOutput {
237    pub tenant_name: String,
238    pub domain: String,
239    pub status: String,
240    #[serde(skip_serializing_if = "Option::is_none")]
241    pub certificate_status: Option<String>,
242}
243
244#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
245pub struct DockerfileOutput {
246    pub content: String,
247}
248
249#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
250pub struct InitOutput {
251    pub message: String,
252    pub created_paths: Vec<String>,
253}
254
255#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
256pub struct CancelSubscriptionOutput {
257    #[serde(rename = "tenant_id")]
258    pub tenant: String,
259    pub tenant_name: String,
260    pub message: String,
261}