pub struct Client { /* private fields */ }Expand description
Talks the SDK ⇆ Gateway /sandboxes REST API and hands back Sandboxes.
Implementations§
Source§impl Client
impl Client
pub fn new(opts: ClientOptions) -> Result<Self, SolariError>
Sourcepub async fn create(&self, opts: CreateOptions) -> Result<Sandbox, SolariError>
pub async fn create(&self, opts: CreateOptions) -> Result<Sandbox, SolariError>
Create a new headless sandbox (POST /sandboxes).
Sourcepub async fn create_desktop(
&self,
opts: CreateOptions,
) -> Result<Sandbox, SolariError>
pub async fn create_desktop( &self, opts: CreateOptions, ) -> Result<Sandbox, SolariError>
Create a GUI desktop VM (POST /sandboxes with kind:"desktop").
Mirrors TS createDesktop() / Python create_desktop(). The returned
handle carries Sandbox::stream_url for the live view, and exposes the
same core namespaces as a sandbox (commands/files/code/git).
Driving the GUI (mouse/keyboard/screenshot) is not part of this surface.
Requires the desktop entitlement on the org’s plan; the gateway
answers 402 FeatureRequiresPlan otherwise.
Sourcepub async fn connect(&self, sandbox_id: &str) -> Result<Sandbox, SolariError>
pub async fn connect(&self, sandbox_id: &str) -> Result<Sandbox, SolariError>
Re-attach to a running sandbox by id (GET /sandboxes/:id).
Sourcepub async fn get(&self, sandbox_id: &str) -> Result<SandboxView, SolariError>
pub async fn get(&self, sandbox_id: &str) -> Result<SandboxView, SolariError>
Fetch a sandbox’s current view (GET /sandboxes/:id).
Sourcepub async fn kill(&self, sandbox_id: &str) -> Result<(), SolariError>
pub async fn kill(&self, sandbox_id: &str) -> Result<(), SolariError>
Destroy a sandbox (DELETE /sandboxes/:id). Idempotent.
Sourcepub async fn pause(&self, sandbox_id: &str) -> Result<(), SolariError>
pub async fn pause(&self, sandbox_id: &str) -> Result<(), SolariError>
Pause a session (POST /sandboxes/:id/pause): snapshot its RAM+disk and
free its host slot. The session keeps its id; bring it back with
Client::resume.
Sourcepub async fn resume(&self, sandbox_id: &str) -> Result<String, SolariError>
pub async fn resume(&self, sandbox_id: &str) -> Result<String, SolariError>
Resume a paused session (POST /sandboxes/:id/resume) and return the
control URL to re-attach to.
The session comes back on a FRESH slot, so its pre-pause control URL is
stale. The gateway normally returns the new one; when it does not, derive
it from the gateway origin exactly as Client::connect does.