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: StringSandbox id.
commands: CommandsCommand runner for this sandbox.
files: FilesystemFilesystem helper for this sandbox.
pty: PtyPTY helper for this sandbox.
git: GitGit helper for this sandbox.
Implementations§
Source§impl Sandbox
impl Sandbox
Sourcepub async fn create(opts: CreateOptions) -> Result<Self>
pub async fn create(opts: CreateOptions) -> Result<Self>
Create a sandbox and return it only after the API supplies a data-plane session.
Sourcepub async fn connect(
sandbox_id: impl ToString,
connection: ConnectionOptions,
) -> Result<Self>
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.
Sourcepub async fn list(opts: ListOptions) -> Result<SandboxListPage>
pub async fn list(opts: ListOptions) -> Result<SandboxListPage>
List sandboxes visible to the configured API token.
Sourcepub async fn list_snapshots_page(
opts: SnapshotListOptions,
) -> Result<SnapshotListPage>
pub async fn list_snapshots_page( opts: SnapshotListOptions, ) -> Result<SnapshotListPage>
List snapshots visible to the configured API token.
Sourcepub async fn resume_by_id(
sandbox_id: impl ToString,
connection: ConnectionOptions,
) -> Result<bool>
pub async fn resume_by_id( sandbox_id: impl ToString, connection: ConnectionOptions, ) -> Result<bool>
Resume a paused sandbox by id.
Sourcepub async fn resume(&mut self) -> Result<bool>
pub async fn resume(&mut self) -> Result<bool>
Resume this sandbox and refresh its data-plane session.
Sourcepub async fn beta_pause_by_id(
sandbox_id: impl ToString,
connection: ConnectionOptions,
) -> Result<bool>
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.
Sourcepub async fn beta_pause(&self) -> Result<bool>
pub async fn beta_pause(&self) -> Result<bool>
Pause this sandbox. Returns false if it is already paused.
Sourcepub async fn pause_by_id(
sandbox_id: impl ToString,
connection: ConnectionOptions,
) -> Result<bool>
pub async fn pause_by_id( sandbox_id: impl ToString, connection: ConnectionOptions, ) -> Result<bool>
Pause a sandbox by id.
Sourcepub async fn get_metrics_by_id(
sandbox_id: impl ToString,
connection: ConnectionOptions,
) -> Result<Vec<SandboxMetrics>>
pub async fn get_metrics_by_id( sandbox_id: impl ToString, connection: ConnectionOptions, ) -> Result<Vec<SandboxMetrics>>
Fetch sandbox metrics by id.
Sourcepub async fn get_metrics(&self) -> Result<Vec<SandboxMetrics>>
pub async fn get_metrics(&self) -> Result<Vec<SandboxMetrics>>
Fetch latest sandbox metrics.
Sourcepub async fn create_snapshot(
&self,
opts: CreateSnapshotOptions,
) -> Result<SnapshotInfo>
pub async fn create_snapshot( &self, opts: CreateSnapshotOptions, ) -> Result<SnapshotInfo>
Create a Watasu checkpoint using snapshot naming.
Sourcepub async fn list_snapshots(&self) -> Result<Vec<SnapshotInfo>>
pub async fn list_snapshots(&self) -> Result<Vec<SnapshotInfo>>
List checkpoints for this sandbox using snapshot naming.
Sourcepub async fn delete_snapshot(&self, snapshot_id: impl ToString) -> Result<bool>
pub async fn delete_snapshot(&self, snapshot_id: impl ToString) -> Result<bool>
Delete a snapshot by id.
Sourcepub async fn delete_snapshot_by_id(
snapshot_id: impl ToString,
connection: ConnectionOptions,
) -> Result<bool>
pub async fn delete_snapshot_by_id( snapshot_id: impl ToString, connection: ConnectionOptions, ) -> Result<bool>
Delete a snapshot by id using explicit connection options.
Sourcepub async fn upload_url(
&self,
path: &str,
opts: FileUrlOptions,
) -> Result<String>
pub async fn upload_url( &self, path: &str, opts: FileUrlOptions, ) -> Result<String>
Get a signed URL for uploading a file with a POST request.
Sourcepub async fn download_url(
&self,
path: &str,
opts: FileUrlOptions,
) -> Result<String>
pub async fn download_url( &self, path: &str, opts: FileUrlOptions, ) -> Result<String>
Get a signed URL for downloading a file with a GET request.
Sourcepub async fn upload_url_info(
&self,
path: &str,
opts: FileUrlOptions,
) -> Result<FileUrlInfo>
pub async fn upload_url_info( &self, path: &str, opts: FileUrlOptions, ) -> Result<FileUrlInfo>
Get signed upload URL metadata.
Sourcepub async fn download_url_info(
&self,
path: &str,
opts: FileUrlOptions,
) -> Result<FileUrlInfo>
pub async fn download_url_info( &self, path: &str, opts: FileUrlOptions, ) -> Result<FileUrlInfo>
Get signed download URL metadata.
Sourcepub async fn update_network(&mut self, opts: NetworkUpdateOptions) -> Result<()>
pub async fn update_network(&mut self, opts: NetworkUpdateOptions) -> Result<()>
Atomically replace this sandbox’s network egress policy.
Sourcepub async fn update_network_by_id(
sandbox_id: impl ToString,
opts: NetworkUpdateOptions,
connection: ConnectionOptions,
) -> Result<()>
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.
Sourcepub async fn restore(&self, opts: RestoreOptions) -> Result<SandboxInfo>
pub async fn restore(&self, opts: RestoreOptions) -> Result<SandboxInfo>
Restore a checkpoint into a new sandbox and return its control-plane metadata.
Sourcepub async fn set_timeout(&self, timeout_seconds: u64) -> Result<()>
pub async fn set_timeout(&self, timeout_seconds: u64) -> Result<()>
Set this sandbox’s lifetime in seconds.
Sourcepub async fn get_info(&self) -> Result<SandboxInfo>
pub async fn get_info(&self) -> Result<SandboxInfo>
Fetch latest control-plane metadata for this sandbox.
Sourcepub async fn get_host(&self, port: u16) -> Result<String>
pub async fn get_host(&self, port: u16) -> Result<String>
Return the public hostname for an exposed sandbox port.
Sourcepub async fn get_mcp_url(&self) -> Result<String>
pub async fn get_mcp_url(&self) -> Result<String>
Return the conventional MCP URL for this sandbox.
Sourcepub async fn get_mcp_token(&mut self) -> Result<Option<String>>
pub async fn get_mcp_token(&mut self) -> Result<Option<String>>
Return the MCP gateway token when the sandbox contains one.