Skip to main content

RunRequest

Struct RunRequest 

Source
pub struct RunRequest {
Show 14 fields pub image_identifier: Option<String>, pub image_version: Option<String>, pub execution_role_arn: Option<String>, pub agent_token: Option<String>, pub launch_env: HashMap<String, String>, pub identity: bool, pub egress: bool, pub shell: bool, pub max_idle_sec: u32, pub suspended_sec: u32, pub auto_resume: bool, pub max_duration_sec: u32, pub ready_timeout: Duration, pub token_scope: Option<String>,
}
Expand description

Everything a launch needs, with the defaults the Python client measured.

agent_token is optional because the common case is a per-VM secret nobody needs to see; a caller who has one already — a harness minting its own, or a retry that must reuse the first attempt’s — passes it.

Fields§

§image_identifier: Option<String>

The image to launch, or None for the one Sandbox::build_image built.

§image_version: Option<String>

imageVersion, or None for the image’s own latest active version.

Pinning is what makes a canary a canary: without it a launch takes whatever version is latest at the moment the call lands, which is not necessarily the one the caller just built. Paired with crate::control::ControlPlane::set_image_version_status it is also the rollback — set the bad version INACTIVE, re-pin here to the good one — and a version set INACTIVE refuses to launch when named here.

See crate::control::RunMicrovmRequest::image_version, which this forwards to.

§execution_role_arn: Option<String>

The execution role. Optional in the model; every real launch needs one.

§agent_token: Option<String>

The bearer token the daemon will accept, or None to mint one.

§launch_env: HashMap<String, String>

Base environment for every exec in the launched VM, delivered in the same runHookPayload as the token.

The daemon applies this under each request’s own env, so a per-exec value wins on a key both set. Empty by default, and an empty map produces byte-for-byte the payload this client always sent — a caller who never touches this field cannot be affected by the field existing.

It shares the token’s 4096-byte payload budget, and the check is local: crate::control::RunHookPayload::for_launch refuses an over-ceiling payload before any call, naming the byte count and how much of it the env is. That matters here more than for the token, because one bearer token has always fit with room to spare and a map of credentials does not.

§identity: bool

Whether to generate and deliver a tunnel identity (#70 layer 3).

On, the launch generates two fresh x25519 seeds, delivers the VM’s seed and the host’s public key in the same payload as the token, and [RunOutcome]-equivalent state on the session keeps the crate::identity::TunnelIdentity — the host secret and the VM’s public pin — for tunnel --verify-identity to prove the far end. Off (the default) sends byte-for-byte the payload this client always sent.

A flag rather than always-on, deliberately: the material spends 137 bytes of the payload’s measured 4096-byte budget, and a caller near the ceiling with a launch env deserves to choose which feature gets the room.

§egress: bool

Whether to request the egress connector. Off means no outbound network.

§shell: bool

Whether to launch shell-capable: the ingress set becomes the measured pair [HTTP_INGRESS, SHELL_INGRESS] instead of ALL_INGRESS, which is what CreateMicrovmShellAuthToken requires and what microvm shell attaches to. Off (the default) launches byte-for-byte what this client always sent.

§max_idle_sec: u32

idlePolicy.maxIdleDurationSeconds.

§suspended_sec: u32

idlePolicy.suspendedDurationSeconds — the window STATE-12 refuses past.

§auto_resume: bool

idlePolicy.autoResumeEnabled.

§max_duration_sec: u32

maximumDurationInSeconds, checked against 1..=28800 before the call.

§ready_timeout: Duration

How long to wait for RUNNING.

§token_scope: Option<String>

A label for the run token (TRAP-1). Never the token.

Implementations§

Source§

impl RunRequest

Source

pub fn new() -> Self

A launch with the measured defaults: ingress only, ten-minute idle and suspended windows, a one-hour maximum duration, no auto-resume.

Source

pub fn with_image(self, identifier: impl Into<String>) -> Self

Launches identifier rather than the built image.

Source

pub fn with_egress(self) -> Self

Requests the egress connector, which is what gives the VM outbound network.

Source

pub fn with_shell(self) -> Self

Requests a shell-capable launch. See RunRequest::shell.

Source

pub fn with_image_version(self, version: impl Into<String>) -> Self

Pins the launch to one imageVersion. See the field for why.

Source

pub fn with_suspended_sec(self, seconds: u32) -> Self

Sets the suspended window this sandbox will refuse a resume past (STATE-12).

Source

pub fn with_agent_token(self, token: impl Into<String>) -> Self

Reuses a caller-supplied agent token rather than minting one.

Source

pub fn with_identity(self) -> Self

Generates and delivers a tunnel identity with the launch (#70 layer 3).

After a run with this set, Sandbox::tunnel_identity holds what tunnel --verify-identity needs: the host’s secret and the VM’s public pin.

Source

pub fn with_launch_env( self, key: impl Into<String>, value: impl Into<String>, ) -> Self

Adds one launch-environment variable, which every exec in the VM starts with.

One pair per call rather than a whole map, because that is how a caller builds one — from flags, from a config file, one credential at a time — and a map-taking setter makes the second call silently discard the first. The field is public for a caller who really does hold a map.

Trait Implementations§

Source§

impl Clone for RunRequest

Source§

fn clone(&self) -> RunRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RunRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RunRequest

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<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