Skip to main content

systemprompt_models/api/cloud/
mod.rs

1//! Cloud Management API types shared between CLI and API server.
2
3mod domain;
4mod provisioning;
5mod tenant;
6mod usage;
7
8pub use domain::{CustomDomainResponse, DnsInstructions, SetCustomDomainRequest};
9pub use provisioning::{
10    ActivityData, ActivityRequest, CheckoutEvent, CheckoutRequest, CheckoutResponse,
11    DeployResponse, ProvisioningEvent, ProvisioningEventType,
12};
13pub use tenant::{
14    CloudEnterpriseLicenseInfo, CloudPlan, CloudPlanInfo, CloudTenant, CloudTenantInfo,
15    CloudTenantSecrets, CloudTenantStatus, CloudTenantStatusResponse, ExternalDbAccessResponse,
16    RotateCredentialsResponse, RotateSyncTokenResponse, SetExternalDbAccessRequest,
17    SubscriptionStatus,
18};
19pub use usage::{
20    BridgeProfileUsage, ConversationGroup, ConversationSummary, ModelShare,
21    RecentConversationSummary, UsageWindow,
22};
23
24use schemars::JsonSchema;
25use serde::{Deserialize, Serialize};
26use std::collections::HashMap;
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct CloudApiResponse<T> {
30    pub data: T,
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct CloudApiError {
35    pub error: CloudApiErrorDetail,
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
39pub struct CloudApiErrorDetail {
40    pub code: String,
41    pub message: String,
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
45pub struct CloudUserInfo {
46    pub id: systemprompt_identifiers::UserId,
47    pub email: String,
48    #[serde(default, skip_serializing_if = "Option::is_none")]
49    pub name: Option<String>,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
53pub struct CloudCustomerInfo {
54    pub id: String,
55    #[serde(default, skip_serializing_if = "Option::is_none")]
56    pub status: Option<String>,
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
60pub struct UserMeResponse {
61    pub user: CloudUserInfo,
62    #[serde(default, skip_serializing_if = "Option::is_none")]
63    pub customer: Option<CloudCustomerInfo>,
64    #[serde(default)]
65    pub tenants: Vec<CloudTenantInfo>,
66    #[serde(default, skip_serializing_if = "Option::is_none")]
67    pub enterprise: Option<CloudEnterpriseLicenseInfo>,
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
71pub struct CloudListResponse<T> {
72    pub data: Vec<T>,
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
76pub struct RegistryToken {
77    pub registry: String,
78    pub username: String,
79    pub token: String,
80    pub repository: String,
81    pub tag: String,
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
85pub struct CloudStatusResponse {
86    pub status: String,
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize)]
90pub struct SetSecretsRequest {
91    pub secrets: HashMap<String, String>,
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
95pub struct CloudLogEntry {
96    pub timestamp: String,
97    pub message: String,
98    #[serde(default, skip_serializing_if = "Option::is_none")]
99    pub level: Option<String>,
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
103pub struct CloudLogsResponse {
104    pub logs: Vec<CloudLogEntry>,
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
108pub struct ListSecretsResponse {
109    pub keys: Vec<String>,
110}
111
112pub type ApiResponse<T> = CloudApiResponse<T>;
113pub type ApiError = CloudApiError;
114pub type ApiErrorDetail = CloudApiErrorDetail;
115pub type UserInfo = CloudUserInfo;
116pub type CustomerInfo = CloudCustomerInfo;
117pub type PlanInfo = CloudPlanInfo;
118pub type Plan = CloudPlan;
119pub type TenantInfo = CloudTenantInfo;
120pub type Tenant = CloudTenant;
121pub type TenantStatus = CloudTenantStatusResponse;
122pub type TenantSecrets = CloudTenantSecrets;
123pub type ListResponse<T> = CloudListResponse<T>;
124pub type StatusResponse = CloudStatusResponse;
125pub type LogEntry = CloudLogEntry;
126pub type LogsResponse = CloudLogsResponse;
127pub type EnterpriseLicenseInfo = CloudEnterpriseLicenseInfo;