pub struct RunHook {
pub agent_token: String,
pub env: HashMap<String, String>,
}Expand description
The caller’s own payload, carrying the per-VM secret and an optional launch environment.
Passing the token at launch is what keeps it out of the shared image snapshot. It is safe because the platform forwards no external traffic until this hook returns 200.
env rides the same channel because the channel is the only per-VM one the
platform offers, and a launch environment is the same kind of thing as the
token: something a caller knows at launch and cannot bake into a shared image.
The whole payload shares one 4096-byte budget, so a caller who fills env
with credentials is spending the token’s room; microvms-core refuses an
over-budget payload locally, before the call.
Fields§
§agent_token: String§env: HashMap<String, String>Base environment applied to every subsequent exec, under the per-request
env. Absent and empty mean the same thing, which is why this is a plain
map rather than an Option: there is nothing a caller could express by
sending "env": {} that omitting the key does not already say.
Implementations§
Source§impl RunHook
impl RunHook
Sourcepub fn parse(raw: &str) -> Result<Self, RunHookError>
pub fn parse(raw: &str) -> Result<Self, RunHookError>
Reads the caller’s payload, ignoring keys this version does not know.
Unknown keys are ignored on purpose: a newer client sending a field this daemon has never heard of must still be able to bootstrap it, because the alternative is a 400 at the run hook and the platform terminating the VM before any traffic is forwarded. Forward compatibility here is the difference between an ignored field and a dead launch.
Hand-walked rather than serde_json::from_str::<RunHook> so every refusal
is one of the named variants above. serde’s own messages quote values,
and the values here are secrets.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RunHook
impl<'de> Deserialize<'de> for RunHook
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RunHook
impl JsonSchema for RunHook
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more