Skip to main content
Create and control a microVM sandbox: boot it from an image, run commands, stream logs and metrics, then shut it down. See Overview for configuration examples and Lifecycle for state management. For local runtime installation and verification, see Runtime setup.

Sandbox

Sandbox::builder()

Create a builder for configuring a new sandbox. The builder lets you set the image, resources, volumes, networking, secrets, and other options before booting the VM. Sandbox names must be non-empty and no longer than 128 UTF-8 bytes. See SandboxBuilder for all available options.

Parameters

nameimpl Into<String>
Sandbox name - must be unique and no longer than 128 UTF-8 bytes.

Returns

Builder for configuring the sandbox.

Sandbox::get()

Get a handle to an existing sandbox (running or stopped). The handle provides status, configuration, and lifecycle control without requiring a full connection to the guest agent.

Parameters

name&str
Sandbox name, up to 128 UTF-8 bytes.

Returns

Handle with status and lifecycle control.

Sandbox::list()

Return the first page of sandboxes (running, stopped, and crashed), ordered newest first. The default page size is 20.

Returns

SandboxPage
Handles in this page and an optional cursor for the next page.

Sandbox::list_with()

Return a configured page of sandboxes. Limits must be between 1 and 100. Labels are AND-matched before pagination.

Sandbox::remove()

Delete a stopped sandbox by name. Locally, this removes the same state as sb.remove_persisted(); see Remove for the exact deletion scope. Unlike remove_persisted(), this associated function routes through the default backend and also supports cloud sandboxes. Fails if the sandbox is still running. Stop it first.

Parameters

name&str
Sandbox name, up to 128 UTF-8 bytes.

Sandbox::start()

Restart a previously stopped sandbox. The VM reboots using the persisted configuration. Local handles enter attached mode and stop the sandbox when the client process exits; cloud handles do not own the service-managed VM.

Parameters

name&str
Name of a stopped sandbox, up to 128 UTF-8 bytes.

Returns

Running sandbox.

Sandbox::start_detached()

Restart a stopped sandbox in detached mode. The sandbox survives after your process exits.

Parameters

name&str
Name of a stopped sandbox, up to 128 UTF-8 bytes.

Returns

Running sandbox.

Instance methods

sb.config()

Access the sandbox’s full configuration.

Returns

Sandbox configuration.

sb.detach()

Release the handle without stopping the sandbox. The sandbox continues running as a background process. Reconnect later with Sandbox::get().

sb.drain()

Start a graceful drain. Existing commands run to completion, but new exec calls are rejected. The sandbox transitions to Stopped when all in-flight commands finish. Useful for zero-downtime rotation of worker sandboxes.

sb.request_drain()

Request graceful drain and return once the request is sent. Pair with wait_until_stopped() when the caller needs stopped-state observation.

sb.fs()

Get a filesystem handle for reading and writing files inside the running sandbox. See Filesystem for API details.

Returns

Filesystem handle.

sb.kill()

Force-terminate the sandbox immediately with SIGKILL. No graceful shutdown - use when the sandbox is unresponsive. Waits up to five seconds for stopped-state observation after the kill request. Pending writes that the workload hasn’t fsync’d may be lost, same durability semantics as a sudden power loss on a physical machine. Prefer stop() for graceful shutdown that gives the workload a chance to flush.

sb.kill_with_timeout()

Force-terminate the sandbox and wait up to timeout for stopped-state observation.

sb.request_kill()

Request force termination and return once the request is sent, without waiting for stopped-state observation.

sb.metrics()

Get a point-in-time snapshot of the sandbox’s resource usage: CPU, memory, disk I/O, network I/O, optional upper disk usage, and uptime.

Returns

Resource metrics.

sb.metrics_stream()

Stream resource metrics at a regular interval. Returns an async stream that yields a new snapshot every interval duration.

Parameters

intervalDuration
Time between metric snapshots.

Returns

Async stream yielding a snapshot each interval.

sb.logs()

Read captured output from the sandbox’s exec.log. Backed by an on-disk JSON Lines file the runtime writes via the relay tap. Works on running and stopped sandboxes alike; there is no protocol traffic. The same method is available on SandboxHandle for callers that don’t want to start the sandbox first. The default sources are Stdout, Stderr, and Output (PTY-merged). Pass LogSource::System to also include synthetic lifecycle markers and runtime/kernel diagnostic lines. logs() is synchronous because it’s a pure file read.

Parameters

Filters: tail, since, until, sources. LogOptions::default() returns everything for the default sources.

Returns

Matching entries in chronological order.

sb.ping()

Check whether the running sandbox’s guest agent is reachable. This sends core.ping, returns the SDK-measured round-trip latency, and does not refresh the sandbox idle timer.

Returns

Sandbox name and ping latency.

sb.touch()

Explicitly refresh the running sandbox’s idle timer. This sends core.touch; use it when keeping an idle sandbox alive is intentional.

Returns

Sandbox name and agent activity sequence after the touch.

sb.modify()

Plan or apply a configuration change. Set what to change (CPUs, memory, env vars, labels, workdir, secrets), then call dry_run() to preview or apply() to commit; both return a SandboxModificationPlan labeling each change live, next start, requires restart, or unsupported. Apply is all-or-nothing. CPU and memory resize live within the max_cpus / max_memory ceilings; raising a ceiling requires a restart. Env and workdir changes affect future execs only. On a stopped sandbox, changes are saved for the next boot. See SandboxModificationBuilder for all setters and msb modify for the CLI.

Returns

Fluent builder; terminate with dry_run() or apply().

sb.name()

Get the sandbox name.

Returns

&str
Sandbox name, up to 128 UTF-8 bytes.

sb.owns_lifecycle()

Whether this handle owns the sandbox lifecycle. Local attached handles return true; local detached handles and all cloud handles return false, because the cloud worker owns the sandbox process.

Returns

bool
true for a local attached handle.

sb.remove_persisted()

Delete this stopped sandbox’s persisted state. This receiver-based form is useful when you still hold the Sandbox instance; it has exactly the same deletion scope as Sandbox::remove(name). It does not perform additional cleanup. See Remove for what is deleted and which external resources are preserved.

sb.request_stop()

Request graceful shutdown and return once the request is sent, without waiting for stopped-state observation. Pair with wait_until_stopped() when the caller needs the terminal state.

sb.stop()

Gracefully shut down the sandbox. Lets the sandbox finish writing any pending data to disk before it exits, so files written inside the sandbox aren’t lost across a later restart. Waits up to ten seconds for a clean exit; if the sandbox is still running after that, it is force-killed.

sb.stop_with_timeout()

Gracefully shut down the sandbox with an explicit timeout before escalation. Duration::ZERO skips graceful shutdown and force-kills immediately.

sb.stop_and_wait()

Stop the sandbox and wait for the exit status. This is a local-backend compatibility helper; prefer stop() or stop_with_timeout() when the caller only needs stopped-state observation.

Returns

Exit code and success flag.

sb.wait()

Block until the sandbox exits on its own (without triggering a stop). Returns the exit status.

Returns

Exit code and success flag.

sb.wait_until_stopped()

Block until the sandbox is observed in a terminal non-running state. Owned local sandboxes can include process exit details; detached, name-addressed, and cloud-backed sandboxes report the observed backend state. Returns

SandboxBuilder

Builder for configuring a sandbox before creation. Obtained via Sandbox::builder(name). Every setter returns Self, so calls chain. Examples are shown on the methods where usage is non-obvious.

sandbox.slug()

Request a globally unique cloud slug. When omitted, microsandbox cloud assigns one; creation fails if the requested slug is already taken.

Parameters

slugimpl Into<String>
Requested cloud slug.

sandbox.build()

Materialize the SandboxConfig without booting the sandbox. Validates the configuration and, if from_snapshot was called, opens the snapshot manifest to pin its image reference and upper-layer source. For booting, use create instead; call detached(true) first for background mode. create() calls build internally.

Returns

Validated, ready-to-boot configuration.

sandbox.cpus()

Set the number of virtual CPUs. This is a limit, not a reservation. Default: 1.

Parameters

countu8
Number of vCPUs.

sandbox.max_cpus()

Set the boot-time maximum possible virtual CPU capacity. This reserves the envelope a sandbox can use after restart-backed changes and future live CPU activation; it does not increase the effective vCPU count by itself.

Parameters

countu8
Maximum possible vCPUs.

sandbox.create()

Boot the sandbox. Local handles use attached mode and stop the sandbox when the client process exits; cloud handles do not own the service-managed VM, so stop or remove cloud sandboxes explicitly.

Returns

Running sandbox.

sandbox.detached()

Choose whether the sandbox is created in detached/background mode. Detached sandboxes survive the creating process. Defaults to false.

Parameters

detachedbool
When true, create the sandbox in detached mode.

sandbox.create_detached()

Boot the sandbox in detached mode. This is a compatibility helper for .detached(true).create(). Prefer detached(true) with create() for new code so attached and detached creation use the same flow.

Returns

Running sandbox.

sandbox.disable_network()

Fully disable networking. No network interface is created.

sandbox.entrypoint()

Override the image ENTRYPOINT used by default-workload execution. Sandbox::exec_default combines it with the effective CMD. Literal Sandbox::exec, Sandbox::attach, and Sandbox::shell calls ignore it.

Parameters

cmdimpl IntoIterator
Entrypoint command and arguments.

sandbox.env()

Set an environment variable visible to all commands. Can be called multiple times. Per-command env vars (via exec_with) are merged on top.

Parameters

keyimpl Into<String>
Variable name.
valueimpl Into<String>
Variable value.

sandbox.hostname()

Set the guest hostname.

Parameters

hostnameimpl Into<String>
Hostname.

sandbox.idle_timeout()

Auto-drain the sandbox after this many seconds of inactivity (no active exec sessions). Enforced on the host side.

Parameters

secsu64
Idle timeout in seconds.

sandbox.cmd()

Override the image CMD used by default-workload execution. An empty array explicitly clears the image CMD. This describes durable configuration and does not execute anything during create().

sandbox.init()

Hand off PID 1 inside the guest to cmd after agentd finishes its boot-time setup. The agent forks; the parent execs the init and becomes PID 1, the agent continues as a child process. See Custom init system for image picks, shutdown semantics, and tradeoffs. cmd is either an absolute path inside the guest rootfs or the literal "auto". Auto first honors a known init at the start of the image ENTRYPOINT, such as /init in s6-overlay images, then falls back to probing /sbin/init, /lib/systemd/systemd, and /usr/lib/systemd/systemd inside the guest. When attached msb run uses an image-declared init entrypoint, the remaining ENTRYPOINT plus CMD or trailing command is passed to that init instead of direct-executed through agentd. For init binaries that take argv or extra env (rare), use init_with.

Parameters

cmdimpl Into<PathBuf>
Absolute path inside the guest, or “auto”.

sandbox.init_with()

Like init, but with a closure-builder for argv and env vars. Mirrors exec_with in shape. The builder exposes arg, args, env, and envs. Calling init or init_with more than once overwrites, unlike env, which appends. The init is one-shot pre-boot.

Parameters

cmdimpl Into<PathBuf>
Absolute path to the init binary inside the guest.
fFnOnce(InitOptionsBuilder)
Closure populating argv and env.

sandbox.image()

Set the root filesystem source. Accepts OCI image names, local directory paths, or disk image paths. The format is auto-detected.

Parameters

imageimpl IntoImage
OCI image name, local directory path, or disk image path.

sandbox.image_with()

Configure an explicit rootfs source. Use this for OCI-only settings such as the writable root disk, or for disk images when the filesystem type can’t be auto-detected.

Parameters

fFnOnce(ImageBuilder)
Configure the rootfs source.

sandbox.log_level()

Override the sandbox process’s log verbosity.

Parameters

Log level.

sandbox.max_duration()

Set the maximum sandbox lifetime in seconds. When exceeded, the sandbox is drained and stopped. Enforced on the host side - the guest cannot override it.

Parameters

secsu64
Maximum lifetime in seconds.

sandbox.memory()

Set the guest memory size. Physical pages are only allocated as the guest touches them, so this is a limit, not an upfront reservation. Default: 512 MiB.

Parameters

sizeimpl Into<Mebibytes>
Memory in MiB.

sandbox.max_memory()

Set the boot-time maximum hotpluggable guest memory. This reserves the envelope a sandbox can use after restart-backed changes and future live memory activation; it does not increase the effective memory by itself.

Parameters

sizeimpl Into<Mebibytes>
Maximum memory in MiB.

sandbox.thp()

Select the guest transparent huge-page policy applied through the kernel command line at boot. Default: TransparentHugePagePolicy::Madvise.

Parameters

policyTransparentHugePagePolicy
Always, Madvise, or Never.

sandbox.network()

Configure networking. See Networking for the full builder API.

Parameters

Configure the network.

sandbox.patch()

Modify the rootfs before the VM boots. Patches go into the writable layer - the base image is untouched. See PatchBuilder for the operations.

Parameters

Configure rootfs patches.

sandbox.port()

Publish a TCP port from the sandbox to the host. The default host bind address is 127.0.0.1.

Parameters

host_portu16
Port on the host.
guest_portu16
Port inside the sandbox.

sandbox.port_bind()

Publish a TCP port on a specific host bind address, such as 0.0.0.0.

Parameters

host_bindIpAddr
Host bind address.
host_portu16
Port on the host.
guest_portu16
Port inside the sandbox.

sandbox.port_udp()

Publish a UDP port. The default host bind address is 127.0.0.1.

Parameters

host_portu16
Port on the host.
guest_portu16
Port inside the sandbox.

sandbox.port_udp_bind()

Publish a UDP port on a specific host bind address.

Parameters

host_bindIpAddr
Host bind address.
host_portu16
Port on the host.
guest_portu16
Port inside the sandbox.

sandbox.pull_policy()

Control when the OCI image is pulled from the registry.

Parameters

Pull behavior.

sandbox.registry()

Configure registry connection settings for the sandbox image pull, including explicit auth, insecure HTTP, and custom CA certificates.

Parameters

Closure that configures registry auth and TLS options.

sandbox.replace()

If a sandbox with the same name already exists, stop it, remove it, and create a fresh one. Without this, creation fails on name conflict.

sandbox.script()

Add a named script at /.msb/scripts/ inside the guest. Scripts are added to PATH and can be called by name via exec() or shell().

Parameters

nameimpl Into<String>
Script name (becomes the filename).
contentimpl Into<String>
Script content.

sandbox.secret()

Add a secret with full configuration. See Secrets for the builder API. Automatically enables TLS interception.

Parameters

Configure the secret.

sandbox.secret_env()

Shorthand for adding a header-injected secret. Equivalent to .secret(|s| s.env(env_var).value(value).allow_host(allowed_host)).
Plaintext at rest. The value is persisted verbatim in the durable sandbox config until a later modify rotate migrates the entry to a source reference. Prefer .secret(|s| s.source(..)) when the value can be referenced; use this path when you hold only a value. A future host-side secret store will switch this method to import-then-reference with no signature change.

Parameters

env_varimpl Into<String>
Environment variable name (non-empty, no = or NUL).
valueimpl Into<String>
Secret value.
allowed_hostimpl Into<String>
Allowed destination host.

sandbox.shell()

Set the shell used by Sandbox::shell(). Default: /bin/sh.

Parameters

shellimpl Into<String>
Shell path (e.g. “/bin/bash”).

sandbox.user()

Set the default guest user for all commands.

Parameters

userimpl Into<String>
User name or UID.

sandbox.volume()

Add a volume mount. See Volumes for mount types.

Parameters

guest_pathimpl Into<String>
Mount point inside the sandbox.
Configure the mount.

sandbox.workdir()

Set the default working directory for all commands.

Parameters

pathimpl Into<String>
Absolute path inside the guest.

PatchBuilder

Builder for pre-boot root filesystem patches.

patch.append()

Append content to an existing file at path. If the file lives in a lower image layer, it’s copied up first.

Parameters

pathimpl Into<String>
Absolute path inside the guest.
contentimpl Into<String>
Text to append.

patch.copy_dir()

Recursively copy a host directory at src into the guest rootfs at dst.

Parameters

srcimpl Into<PathBuf>
Host source directory.
dstimpl Into<String>
Absolute destination path inside the guest.
replacebool
When true, overwrite an existing path at dst.

patch.copy_file()

Copy a single host file at src into the guest rootfs at dst.

Parameters

srcimpl Into<PathBuf>
Host source file.
dstimpl Into<String>
Absolute destination path inside the guest.
modeOption<u32>
File mode, e.g. Some(0o644). None keeps the source mode.
replacebool
When true, overwrite an existing path at dst.

patch.file()

Write raw bytes at path.

Parameters

pathimpl Into<String>
Absolute path inside the guest.
contentimpl Into<Vec<u8>>
Raw byte content.
modeOption<u32>
File mode, e.g. Some(0o644).
replacebool
When true, overwrite an existing path.

patch.mkdir()

Create a directory at path. Idempotent: a no-op if the directory already exists.

Parameters

pathimpl Into<String>
Absolute path inside the guest.
modeOption<u32>
Directory mode, e.g. Some(0o755).

patch.remove()

Delete a file or directory at path. Idempotent: a no-op if the path doesn’t exist.

Parameters

pathimpl Into<String>
Absolute path inside the guest.
Create a symlink at link pointing to target.

Parameters

targetimpl Into<String>
What the symlink points to (literal symlink target text).
linkimpl Into<String>
Absolute path of the symlink itself.
replacebool
When true, overwrite an existing path at link.

patch.text()

Write UTF-8 text content at path.

Parameters

pathimpl Into<String>
Absolute path inside the guest.
contentimpl Into<String>
Text content.
modeOption<u32>
File mode, e.g. Some(0o644).
replacebool
When true, overwrite an existing path.

SandboxModificationBuilder

Builder for planning or applying sandbox configuration changes.

modification.apply()

Apply the changes. Live changes are made to the running sandbox first, and the new config is saved only after they succeed, so a failed apply leaves the old config in place. Changes for a stopped sandbox, or requested with next_start(), are saved and take effect on the next start. With restart(), the sandbox is stopped and started so that restart-required changes take effect. A live CPU or memory resize can take a moment to settle. The returned plan’s resize_status reports progress per resource; see ResourceResizeStatus.

Returns

The applied plan, with applied: true and live resize outcomes in resize_status.

modification.cpus()

Set the desired effective vCPU count. Applies live to a running sandbox when the target fits inside the booted max_cpus; otherwise it requires a restart.

Parameters

cpusu8
Number of vCPUs.

modification.max_cpus()

Set the desired boot-time maximum possible vCPU count. Capacity is fixed at boot, so this is always restart-backed on a running sandbox.

Parameters

max_cpusu8
Maximum possible vCPUs.

modification.dry_run()

Compute the modification plan without applying anything. Use it to preview how each change classifies and whether conflicts block the patch.

Returns

The plan, with applied: false.

modification.env()

Set an environment variable for future execs. Can be called multiple times. On a running sandbox this applies to future execs only; running processes keep their current environment.

Parameters

keyimpl Into<String>
Variable name.
valueimpl Into<String>
Variable value.

modification.remove_env()

Remove an environment variable. Same future-execs-only semantics as env().

Parameters

keyimpl Into<String>
Variable name to remove.

modification.label()

Set a sandbox label. Can be called multiple times.

Parameters

keyimpl Into<String>
Label key.
valueimpl Into<String>
Label value.

modification.remove_label()

Remove a sandbox label.

Parameters

keyimpl Into<String>
Label key to remove.

modification.memory()

Set the desired effective guest memory. Applies live to a running sandbox when the target fits inside the booted max_memory; otherwise it requires a restart.

Parameters

sizeimpl Into<Mebibytes>
Memory in MiB.

modification.memory_mib()

Set the desired effective guest memory in MiB. Same as memory() with an explicit unit.

Parameters

memory_mibu32
Memory in MiB.

modification.max_memory()

Set the desired boot-time maximum hotpluggable memory. Capacity is fixed at boot, so this is always restart-backed on a running sandbox.

Parameters

sizeimpl Into<Mebibytes>
Maximum memory in MiB.

modification.max_memory_mib()

Set the desired boot-time maximum hotpluggable memory in MiB. Same as max_memory() with an explicit unit.

Parameters

max_memory_mibu32
Maximum memory in MiB.

modification.next_start()

Persist the requested changes for the next start, leaving any running VM unchanged. Every change classifies as next start.

modification.restart()

Plan under restart-backed apply semantics. When the patch contains restart-required changes, apply() stops the sandbox, persists the config, and starts it again so the changes become active now.

modification.secret()

Declare the desired state of one secret via a SecretPatchBuilder closure. The spec mirrors the create-time SecretBuilder vocabulary, and the planner diffs it against the existing config to infer the change: a secret that does not exist yet is added, material on an existing secret rotated, and host or placeholder differences update those aspects. Declaring the same secret again replaces the earlier spec; removal is always explicit through remove_secret().

Parameters

fFnOnce(SecretPatchBuilder)
Closure declaring the secret’s desired state.

modification.remove_secret()

Remove a secret. Removal is always explicit; omitting a secret from the patch never removes it.

Parameters

nameimpl Into<String>
Secret name (its environment variable name).

modification.workdir()

Set the working directory for future execs. On a running sandbox this applies to future execs only.

Parameters

pathimpl Into<String>
Absolute path inside the guest.

RegistryConfigBuilder

Used by registry()

Builder passed to registry() for per-sandbox registry connection settings.

registry.auth()

Set explicit credentials for the image registry

registry.insecure()

Use plain HTTP for the registry

registry.ca_certs()

Trust additional PEM-encoded CA certificates

SandboxListBuilder

Fluent configuration passed to Sandbox::list_with(). Keep the labels and limit unchanged when continuing with a cursor.

list.limit()

Set a page size from 1 through 100

list.cursor()

Continue after a previous page’s next_cursor

list.label()

Require one label; repeated calls are AND-matched

list.labels()

Add several AND-matched labels

SandboxHandle

Returned by Sandbox::get() · Sandbox::list()

A sandbox metadata and lifecycle handle that does not require an active guest-agent connection.

h.config()

Parsed configuration

Returns

Result<SandboxConfig>

h.config_json()

Raw JSON configuration

Returns

&str

h.connect()

Connect to a running sandbox; returns an error if it doesn’t respond within ten seconds

Returns

Result<Sandbox>

h.connect_with_timeout()

Same as connect() with an explicit timeout

Returns

Result<Sandbox>

h.created_at()

Creation timestamp

Returns

Option<DateTime<Utc>>

h.kill()

Force terminate and wait until stopped state is observed

Returns

Result<()>

h.kill_with_timeout()

Same as kill() with an explicit observation timeout

Returns

Result<()>

h.logs()

Read captured exec.log (works without starting)

Returns

Result<Vec<LogEntry>>

h.metrics()

Point-in-time resource metrics

Returns

Result<SandboxMetrics>

h.modify()

Start planning a configuration change (works without starting; changes on a stopped sandbox persist for the next boot)

Returns

SandboxModificationBuilder

h.name()

Sandbox name, up to 128 UTF-8 bytes

Returns

&str

h.ping()

Check agent reachability without refreshing idle activity

Returns

Result<SandboxPingResult>

h.remove()

Delete sandbox and state

Returns

Result<()>

h.request_drain()

Request graceful drain without waiting

Returns

Result<()>

h.request_kill()

Request force termination without waiting

Returns

Result<()>

h.request_stop()

Request graceful shutdown without waiting

Returns

Result<()>

h.start()

Start the sandbox. The returned local handle is attached; a cloud handle does not own the service-managed VM.

Returns

Result<Sandbox>

h.start_detached()

Start in detached mode

Returns

Result<Sandbox>

h.status()

Current status

Returns

SandboxStatus

h.stop()

Gracefully shut down. Waits up to ten seconds for pending writes to flush, then force-kills

Returns

Result<()>

h.stop_with_timeout()

Same as stop() with an explicit timeout; Duration::ZERO force-kills immediately

Returns

Result<()>

h.touch()

Explicitly refresh the sandbox idle timer

Returns

Result<SandboxTouchResult>

h.updated_at()

Last update timestamp

Returns

Option<DateTime<Utc>>

h.wait_until_stopped()

Block until terminal state is observed

Returns

Result<SandboxStopResult>

SecretPatchBuilder

Used by secret()

Builder for one declarative secret change.

secret.env()

Name the secret. This is the environment variable that exposes the placeholder inside the guest. Required.

Parameters

nameimpl Into<String>
Secret name, usually the environment variable name.

secret.source()

Provide the secret material as a host-side SecretSource reference. The durable config records only the reference, and the value is resolved host-side when the change applies. Mutually exclusive with value(...).

Parameters

Host-side reference for the secret material.

secret.value()

Provide the secret material as a raw value, for embedders that hold only a value. The value is zeroized on drop, redacted from Debug, and never enters the plan. Applying a value persists it into the durable config until a later source-based rotate migrates it to a reference, the same at-rest property as secret_env(). Mutually exclusive with source(...).

Parameters

valueimpl Into<String>
Raw secret value held by the embedding process.

secret.placeholder()

Set the guest-visible placeholder. Placeholder changes cannot reach already-running processes, so they classify as requires restart on a running sandbox.

Parameters

placeholderimpl Into<String>
Guest-visible placeholder string.

secret.allow_host()

Add an allowed host pattern, such as api.example.com, *.example.org, or *. A non-empty list replaces the secret’s current allow-list; an empty list leaves it unchanged. A new secret needs at least one.

Parameters

hostimpl Into<String>
Allowed exact host, wildcard host pattern, or *.

Types

LogEntry

Returned by logs()

A single captured log entry returned by logs().

LogLevel

Used by log_level()

Sandbox process log verbosity.

LogOptions

Used by logs()

Filters passed to logs(). All fields optional. LogOptions::default() returns everything for the default sources (Stdout + Stderr + Output).

LogSource

Used by LogEntry.source · LogOptions.sources

Tag indicating where a captured log entry came from.

SandboxPingResult

Returned by ping() · SandboxHandle.ping()

Result of a successful agent reachability check.

SandboxTouchResult

Returned by touch() · SandboxHandle.touch()

Result of an explicit idle-timer refresh.

PullPolicy

Used by pull_policy()

Controls when the SDK fetches an OCI image from the registry.

RegistryAuth

Used by registry()

Credentials for authenticating to a private container registry.

SandboxConfig

Returned by config() · build()

The full configuration of a sandbox. Obtained via config() or built via SandboxBuilder. Contains all settings used to create the sandbox.

SandboxPage

One stable, newest-first page returned by Sandbox::list() or Sandbox::list_with().

SandboxModificationPlan

Returned by dry_run() · apply()

Dry-run or apply plan for a sandbox modification. Values never appear in a plan: secret entries carry only guest-visible references.

SecretSource

Used by SecretPatchBuilder.source()

Host-side source for secret material. The source is resolved when the modification applies, and plans only show guest-visible references. Import path: microsandbox::sandbox::SecretSource.

PlannedChange

Used by SandboxModificationPlan.changes

One planned modification entry. This enum has a Config variant for ordinary configuration fields and a Secret variant for secret changes.

ConfigPlannedChange

Variant of PlannedChange::Config

Ordinary configuration change in a modification plan.

SecretPlannedChange

Variant of PlannedChange::Secret

Secret change in a modification plan. Values are omitted by construction; before_ref and after_ref are guest-visible references.

ModificationDisposition

Used by ConfigPlannedChange.disposition · SecretPlannedChange.disposition

When or whether a planned change can take effect. Serializes as the quoted strings below.

ResourceResizeStatus

Used by SandboxModificationPlan.resize_status

Runtime convergence status for a live resource resize. Enforcement applies immediately; the guest converges asynchronously (onlining CPUs, plugging memory blocks).

SandboxStopResult

Observed terminal sandbox state returned by wait_until_stopped().

SandboxMetrics

Returned by metrics() · metrics_stream()

Point-in-time resource usage snapshot.

SandboxStatus

Used by SandboxHandle.status()