pub struct Sandbox { /* private fields */ }Expand description
A handle on one sandbox.
Implementations§
Source§impl Sandbox
impl Sandbox
Sourcepub fn create(client: &Client, spec: &SandboxSpec) -> Result<Sandbox>
pub fn create(client: &Client, spec: &SandboxSpec) -> Result<Sandbox>
Create and start a new sandbox; fails if it already exists. Relative bind paths resolve against the current directory.
pub fn create_with( client: &Client, spec: &SandboxSpec, defs: &VolumeDefs, opts: EnsureOptions, report: Reporter<'_>, ) -> Result<Sandbox>
Sourcepub fn connect_or_create(client: &Client, spec: &SandboxSpec) -> Result<Sandbox>
pub fn connect_or_create(client: &Client, spec: &SandboxSpec) -> Result<Sandbox>
Reconcile a sandbox to spec, creating it if needed: only what differs is
changed, and a correct device is never touched.
pub fn connect_or_create_with( client: &Client, spec: &SandboxSpec, defs: &VolumeDefs, opts: EnsureOptions, report: Reporter<'_>, ) -> Result<(Sandbox, ApplyReport)>
Sourcepub fn connect_or_create_with_base(
client: &Client,
spec: &SandboxSpec,
defs: &VolumeDefs,
base: &Path,
opts: EnsureOptions,
report: Reporter<'_>,
) -> Result<(Sandbox, ApplyReport)>
pub fn connect_or_create_with_base( client: &Client, spec: &SandboxSpec, defs: &VolumeDefs, base: &Path, opts: EnsureOptions, report: Reporter<'_>, ) -> Result<(Sandbox, ApplyReport)>
Sandbox::connect_or_create_with, with relative bind paths
resolving against base instead of the current directory.
Sourcepub fn list(client: &Client) -> Result<Vec<SandboxInfo>>
pub fn list(client: &Client) -> Result<Vec<SandboxInfo>>
All instances in the client’s project.
Sourcepub fn list_with(
client: &Client,
labels: &[LabelFilter],
) -> Result<Vec<SandboxInfo>>
pub fn list_with( client: &Client, labels: &[LabelFilter], ) -> Result<Vec<SandboxInfo>>
Instances whose labels match every filter.
Sourcepub fn remove(client: &Client, name: &str, force: bool) -> Result<()>
pub fn remove(client: &Client, name: &str, force: bool) -> Result<()>
Delete a sandbox. A running one needs force (it is stopped first).
pub fn name(&self) -> &str
pub fn client(&self) -> &Client
Sourcepub fn with_exec_defaults(self, d: ExecDefaults) -> Self
pub fn with_exec_defaults(self, d: ExecDefaults) -> Self
Use these exec defaults for this handle.
pub fn info(&self) -> Result<SandboxInfo>
pub fn labels(&self) -> Result<BTreeMap<String, String>>
pub fn start(&self) -> Result<()>
Sourcepub fn stop(&self, force: bool, timeout: Duration) -> Result<()>
pub fn stop(&self, force: bool, timeout: Duration) -> Result<()>
Stop. force kills instead of a clean shutdown; timeout bounds the
clean shutdown.
pub fn restart(&self) -> Result<()>
Sourcepub fn wait_ready(&self) -> Result<()>
pub fn wait_ready(&self) -> Result<()>
Run this handle’s readiness checks.
Sourcepub fn exec<I, S>(&self, argv: I) -> Result<ExecOutput>
pub fn exec<I, S>(&self, argv: I) -> Result<ExecOutput>
Run a command and capture its output. argv[0] is the program; nothing is
joined into a shell string.
pub fn exec_with<I, S>(&self, argv: I, opts: ExecOptions) -> Result<ExecOutput>
Sourcepub fn exec_stream<I, S>(
&self,
argv: I,
opts: ExecOptions,
) -> Result<ExecStream>
pub fn exec_stream<I, S>( &self, argv: I, opts: ExecOptions, ) -> Result<ExecStream>
Start a command and stream its output as it is produced.
Sourcepub fn attach<I, S>(&self, argv: I, opts: ExecOptions) -> Result<i32>
pub fn attach<I, S>(&self, argv: I, opts: ExecOptions) -> Result<i32>
Run attached to this process’s stdio (and terminal, with opts.tty),
forwarding signals. Returns the exit code.
Sourcepub fn add_port(&self, port: &PortSpec) -> Result<String>
pub fn add_port(&self, port: &PortSpec) -> Result<String>
Add (or correct) a proxy device. Host-bound ports with search step past
taken ports. Returns the listen address in use. A correct device is left
untouched.
Sourcepub fn remove_device(&self, device: &str) -> Result<bool>
pub fn remove_device(&self, device: &str) -> Result<bool>
Remove an instance-local device. Ok(false) if it was not there.