Skip to main content

Sandbox

Struct Sandbox 

Source
pub struct Sandbox {
    pub sandbox_id: String,
    pub commands: Commands,
    pub files: Filesystem,
    pub pty: Pty,
    pub git: Git,
    /* private fields */
}
Expand description

Running Watasu sandbox with ready commands and files helpers.

Fields§

§sandbox_id: String

Sandbox id.

§commands: Commands

Command runner for this sandbox.

§files: Filesystem

Filesystem helper for this sandbox.

§pty: Pty

PTY helper for this sandbox.

§git: Git

Git helper for this sandbox.

Implementations§

Source§

impl Sandbox

Source

pub const MCP_PORT: u16 = 50005

Conventional MCP gateway port.

Source

pub async fn create(opts: CreateOptions) -> Result<Self>

Create a sandbox and return it only after the API supplies a data-plane session.

Source

pub async fn connect( sandbox_id: impl ToString, connection: ConnectionOptions, ) -> Result<Self>

Connect to an existing sandbox and return it with a fresh data-plane session.

Source

pub async fn list(opts: ListOptions) -> Result<SandboxListPage>

List sandboxes visible to the configured API token.

Source

pub async fn list_snapshots_page( opts: SnapshotListOptions, ) -> Result<SnapshotListPage>

List snapshots visible to the configured API token.

Source

pub async fn resume_by_id( sandbox_id: impl ToString, connection: ConnectionOptions, ) -> Result<bool>

Resume a paused sandbox by id.

Source

pub async fn resume(&mut self) -> Result<bool>

Resume this sandbox and refresh its data-plane session.

Source

pub async fn beta_pause_by_id( sandbox_id: impl ToString, connection: ConnectionOptions, ) -> Result<bool>

Pause a sandbox by id. Returns false if it is already paused.

Source

pub async fn beta_pause(&self) -> Result<bool>

Pause this sandbox. Returns false if it is already paused.

Source

pub async fn pause_by_id( sandbox_id: impl ToString, connection: ConnectionOptions, ) -> Result<bool>

Pause a sandbox by id.

Source

pub async fn pause(&self) -> Result<bool>

Pause this sandbox.

Source

pub async fn kill(&self) -> Result<bool>

Destroy this sandbox.

Source

pub async fn get_metrics_by_id( sandbox_id: impl ToString, connection: ConnectionOptions, ) -> Result<Vec<SandboxMetrics>>

Fetch sandbox metrics by id.

Source

pub async fn get_metrics(&self) -> Result<Vec<SandboxMetrics>>

Fetch latest sandbox metrics.

Source

pub async fn create_snapshot( &self, opts: CreateSnapshotOptions, ) -> Result<SnapshotInfo>

Create a Watasu checkpoint using snapshot naming.

Source

pub async fn list_snapshots(&self) -> Result<Vec<SnapshotInfo>>

List checkpoints for this sandbox using snapshot naming.

Source

pub async fn delete_snapshot(&self, snapshot_id: impl ToString) -> Result<bool>

Delete a snapshot by id.

Source

pub async fn delete_snapshot_by_id( snapshot_id: impl ToString, connection: ConnectionOptions, ) -> Result<bool>

Delete a snapshot by id using explicit connection options.

Source

pub async fn upload_url( &self, path: &str, opts: FileUrlOptions, ) -> Result<String>

Get a signed URL for uploading a file with a POST request.

Source

pub async fn download_url( &self, path: &str, opts: FileUrlOptions, ) -> Result<String>

Get a signed URL for downloading a file with a GET request.

Source

pub async fn upload_url_info( &self, path: &str, opts: FileUrlOptions, ) -> Result<FileUrlInfo>

Get signed upload URL metadata.

Source

pub async fn download_url_info( &self, path: &str, opts: FileUrlOptions, ) -> Result<FileUrlInfo>

Get signed download URL metadata.

Source

pub async fn update_network(&mut self, opts: NetworkUpdateOptions) -> Result<()>

Atomically replace this sandbox’s network egress policy.

Source

pub async fn update_network_by_id( sandbox_id: impl ToString, opts: NetworkUpdateOptions, connection: ConnectionOptions, ) -> Result<()>

Atomically replace a sandbox network egress policy by id.

Source

pub async fn restore(&self, opts: RestoreOptions) -> Result<SandboxInfo>

Restore a checkpoint into a new sandbox and return its control-plane metadata.

Source

pub async fn set_timeout(&self, timeout_seconds: u64) -> Result<()>

Set this sandbox’s lifetime in seconds.

Source

pub async fn get_info(&self) -> Result<SandboxInfo>

Fetch latest control-plane metadata for this sandbox.

Source

pub async fn get_host(&self, port: u16) -> Result<String>

Return the public hostname for an exposed sandbox port.

Source

pub async fn get_mcp_url(&self) -> Result<String>

Return the conventional MCP URL for this sandbox.

Source

pub async fn get_mcp_token(&mut self) -> Result<Option<String>>

Return the MCP gateway token when the sandbox contains one.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more