pub struct CloudClient { /* private fields */ }Expand description
Cloud API client. JWT is held in-memory only.
Implementations§
Source§impl CloudClient
impl CloudClient
Sourcepub fn new(base_url: &str) -> Self
pub fn new(base_url: &str) -> Self
Create a new client pointing at the given cloud API base URL.
Sourcepub fn set_jwt(&mut self, token: String)
pub fn set_jwt(&mut self, token: String)
Store the JWT token (in-memory only) after successful verification.
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Whether the client has been authenticated.
Sourcepub async fn cli_login(
&self,
email: &str,
) -> Result<CliLoginResponse, CloudError>
pub async fn cli_login( &self, email: &str, ) -> Result<CliLoginResponse, CloudError>
Request a CLI login code. Sends a 6-digit verification code to the email.
Sourcepub async fn cli_verify(
&self,
request_id: &str,
code: &str,
) -> Result<CliVerifyResponse, CloudError>
pub async fn cli_verify( &self, request_id: &str, code: &str, ) -> Result<CliVerifyResponse, CloudError>
Verify the CLI login code and receive a JWT.
Sourcepub async fn list_projects(&self) -> Result<Vec<Project>, CloudError>
pub async fn list_projects(&self) -> Result<Vec<Project>, CloudError>
List all projects for the authenticated user.
Sourcepub async fn create_project(
&self,
name: &str,
slug: &str,
) -> Result<Project, CloudError>
pub async fn create_project( &self, name: &str, slug: &str, ) -> Result<Project, CloudError>
Create a new project.
Sourcepub async fn list_servers(
&self,
project_id: &str,
) -> Result<Vec<Server>, CloudError>
pub async fn list_servers( &self, project_id: &str, ) -> Result<Vec<Server>, CloudError>
List servers in a project.
Sourcepub async fn create_server(
&self,
project_id: &str,
name: &str,
slug: &str,
) -> Result<Server, CloudError>
pub async fn create_server( &self, project_id: &str, name: &str, slug: &str, ) -> Result<Server, CloudError>
Create a new server in a project.
Sourcepub async fn list_endpoints_by_server(
&self,
server_id: &str,
) -> Result<Vec<Endpoint>, CloudError>
pub async fn list_endpoints_by_server( &self, server_id: &str, ) -> Result<Vec<Endpoint>, CloudError>
List endpoints for a server.
Sourcepub async fn create_endpoint_by_server(
&self,
server_id: &str,
name: &str,
) -> Result<Endpoint, CloudError>
pub async fn create_endpoint_by_server( &self, server_id: &str, name: &str, ) -> Result<Endpoint, CloudError>
Create a new endpoint (tunnel subdomain) for a server.
Sourcepub async fn create_project_token(
&self,
project_id: &str,
name: Option<&str>,
) -> Result<TunnelToken, CloudError>
pub async fn create_project_token( &self, project_id: &str, name: Option<&str>, ) -> Result<TunnelToken, CloudError>
Create a project-scoped token (works for both tunnel auth and cloud ingest).
Auto Trait Implementations§
impl Freeze for CloudClient
impl !RefUnwindSafe for CloudClient
impl Send for CloudClient
impl Sync for CloudClient
impl Unpin for CloudClient
impl UnsafeUnpin for CloudClient
impl !UnwindSafe for CloudClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more