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
impl SecretView
Sourcepub fn new(
environment: String,
store: BTreeMap<String, BTreeMap<String, String>>,
providers: ProviderCache,
) -> Self
pub fn new( environment: String, store: BTreeMap<String, BTreeMap<String, String>>, providers: ProviderCache, ) -> Self
A view over store and providers, resolved for environment.
Sourcepub fn empty(environment: String) -> Self
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.
Sourcepub fn environment(&self) -> &str
pub fn environment(&self) -> &str
The environment this view resolves against.
Sourcepub fn resolve(&self, reference: &SecretRef<'_>) -> Resolution<'_>
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.