pub struct SecretBinding {
pub env_var: String,
pub target_host: String,
pub header: String,
pub value: Option<String>,
}Expand description
A secret binding maps an environment variable to a target domain, optionally specifying which HTTP header carries the credential.
When injected into a microVM, the secret value is written to the secrets drive (readable only by the guest agent). A placeholder value is set in the guest environment so tools that check for the variable’s existence pass their preflight checks.
Combined with NetworkPolicy
allowlists, secrets can only be sent to their bound domains.
Fields§
§env_var: StringEnvironment variable name (e.g., OPENAI_API_KEY).
target_host: StringDomain this secret is scoped to (e.g., api.openai.com).
header: StringHTTP header name for the credential. Defaults to Authorization.
value: Option<String>The secret value. If None, read from the host environment.
Implementations§
Source§impl SecretBinding
impl SecretBinding
pub fn new(env_var: impl Into<String>, target_host: impl Into<String>) -> Self
pub fn with_header(self, header: impl Into<String>) -> Self
pub fn with_value(self, value: impl Into<String>) -> Self
Sourcepub fn resolve_value(&self) -> Result<String>
pub fn resolve_value(&self) -> Result<String>
Resolve the secret value: use the explicit value if set, otherwise read from the host environment.
Sourcepub fn placeholder(&self) -> String
pub fn placeholder(&self) -> String
Generate the placeholder value for the guest environment.
Sourcepub fn secret_filename(&self) -> String
pub fn secret_filename(&self) -> String
Generate a secret file entry for the secrets drive. The file is named after the env var (lowercase, dots replaced).
Trait Implementations§
Source§impl Clone for SecretBinding
impl Clone for SecretBinding
Source§fn clone(&self) -> SecretBinding
fn clone(&self) -> SecretBinding
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SecretBinding
impl Debug for SecretBinding
Source§impl<'de> Deserialize<'de> for SecretBinding
impl<'de> Deserialize<'de> for SecretBinding
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 Display for SecretBinding
impl Display for SecretBinding
Source§impl FromStr for SecretBinding
Parse a secret binding from CLI syntax:
impl FromStr for SecretBinding
Parse a secret binding from CLI syntax:
KEY:host— read KEY from env, inject as Authorization header to hostKEY:host:header— custom header nameKEY=value:host— explicit valueKEY=value:host:header— explicit value + custom header
Source§impl PartialEq for SecretBinding
impl PartialEq for SecretBinding
Source§impl Serialize for SecretBinding
impl Serialize for SecretBinding
impl Eq for SecretBinding
impl StructuralPartialEq for SecretBinding
Auto Trait Implementations§
impl Freeze for SecretBinding
impl RefUnwindSafe for SecretBinding
impl Send for SecretBinding
impl Sync for SecretBinding
impl Unpin for SecretBinding
impl UnsafeUnpin for SecretBinding
impl UnwindSafe for SecretBinding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.