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