Skip to main content

SecretView

Struct SecretView 

Source
pub struct SecretView { /* private fields */ }
Expand description

What one environment can see: the operator’s store plus every provider dog’s, resolved against a single environment name.

Built once per resolution pass and read many times, so the maps are owned rather than borrowed.

Debug does not leak a value: it prints the environment and two counts.

Implementations§

Source§

impl SecretView

Source

pub fn new( environment: String, store: BTreeMap<String, BTreeMap<String, String>>, providers: ProviderCache, ) -> Self

A view over store and providers, resolved for environment.

Source

pub fn empty(environment: String) -> Self

A view holding nothing, so a bare reference resolves to Resolution::MissingKey and a namespaced one to Resolution::MissingNamespace.

Source

pub fn environment(&self) -> &str

The environment this view resolves against.

Source

pub fn resolve(&self, reference: &SecretRef<'_>) -> Resolution<'_>

The value reference resolves to in this view’s environment.

Exact environment, then ALL_ENVIRONMENTS, then nothing. There is deliberately no fallback to another named environment: filling an empty staging slot from production would hand a live credential to staging the first time somebody forgot to set one.

A miss on a namespaced reference is Resolution::MissingNamespace unless a provider has pushed this view’s own environment for that namespace: a push carries one (namespace, environment) pair, so a dog part way through production then staging has said nothing about staging yet, and calling that a missing key would Errored a staging sheep permanently for a value arriving a second later.

Trait Implementations§

Source§

impl Debug for SecretView

Redacted (IR-41): store and the provider cache hold secret values.

Source§

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

Formats the value using the given formatter. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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