Skip to main content

systemprompt_cloud/
lib.rs

1#![allow(
2    clippy::significant_drop_in_scrutinee,
3    clippy::cognitive_complexity,
4    clippy::too_many_lines,
5    clippy::clone_on_ref_ptr,
6    clippy::if_not_else,
7    clippy::single_match_else,
8    clippy::ignored_unit_patterns,
9    clippy::map_unwrap_or,
10    clippy::manual_let_else,
11    clippy::missing_const_for_fn,
12    clippy::option_if_let_else
13)]
14
15pub mod api_client;
16pub mod auth;
17pub mod checkout;
18pub mod cli_session;
19pub mod constants;
20pub mod context;
21pub mod credentials;
22pub mod credentials_bootstrap;
23pub mod error;
24pub mod oauth;
25pub mod paths;
26pub mod tenants;
27
28pub use api_client::{
29    CheckoutEvent, CheckoutResponse, CloudApiClient, DeployResponse, ListSecretsResponse, Plan,
30    ProvisioningEvent, ProvisioningEventType, RegistryToken, StatusResponse, SubscriptionStatus,
31    Tenant, TenantInfo, TenantSecrets, TenantStatus, UserInfo, UserMeResponse,
32};
33pub use checkout::{
34    run_checkout_callback_flow, wait_for_provisioning, CheckoutCallbackResult, CheckoutTemplates,
35};
36pub use cli_session::{CliSession, SessionKey, SessionStore, LOCAL_SESSION_KEY};
37pub use constants::api::{PRODUCTION_URL, SANDBOX_URL};
38pub use context::{CloudContext, ResolvedTenant};
39pub use credentials::CloudCredentials;
40pub use credentials_bootstrap::{CredentialsBootstrap, CredentialsBootstrapError};
41pub use error::{CloudError, CloudResult};
42pub use oauth::{run_oauth_flow, OAuthTemplates};
43pub use paths::{
44    expand_home, get_cloud_paths, resolve_path, CloudPath, CloudPaths, DiscoveredProject,
45    ProfilePath, ProjectContext, ProjectPath, UnifiedContext,
46};
47pub use tenants::{StoredTenant, TenantStore, TenantType};
48
49use clap::ValueEnum;
50
51#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, ValueEnum)]
52pub enum Environment {
53    #[default]
54    Production,
55    Sandbox,
56}
57
58impl Environment {
59    #[must_use]
60    pub const fn api_url(&self) -> &'static str {
61        match self {
62            Self::Production => PRODUCTION_URL,
63            Self::Sandbox => SANDBOX_URL,
64        }
65    }
66}
67
68#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
69pub enum OAuthProvider {
70    Github,
71    Google,
72}
73
74impl OAuthProvider {
75    #[must_use]
76    pub const fn as_str(&self) -> &'static str {
77        match self {
78            Self::Github => "github",
79            Self::Google => "google",
80        }
81    }
82
83    #[must_use]
84    pub const fn display_name(&self) -> &'static str {
85        match self {
86            Self::Github => "GitHub",
87            Self::Google => "Google",
88        }
89    }
90}