Skip to main content

systemprompt_models/api/cloud/
mod.rs

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