Struct wasmcloud_host::secrets::Manager
source · pub struct Manager { /* private fields */ }
Expand description
A manager for fetching secrets from a secret store, caching secrets clients for efficiency.
Implementations§
source§impl Manager
impl Manager
sourcepub fn new(
config_store: &Store,
secret_store_topic: Option<&String>,
nats_client: &Client,
) -> Self
pub fn new( config_store: &Store, secret_store_topic: Option<&String>, nats_client: &Client, ) -> Self
Create a new secret manager with the given configuration store, secret store topic, and NATS client.
All secret references will be fetched from this configuration store and the actual secrets will be
fetched by sending requests to the configured topic. If the provided secret_store_topic is None, this manager
will always return an error if Self::fetch_secrets
is called with a list of secrets.
sourcepub async fn fetch_secrets(
&self,
secret_names: Vec<String>,
entity_jwt: Option<&String>,
host_jwt: &str,
application: Option<&String>,
) -> Result<HashMap<String, Secret<SecretValue>>>
pub async fn fetch_secrets( &self, secret_names: Vec<String>, entity_jwt: Option<&String>, host_jwt: &str, application: Option<&String>, ) -> Result<HashMap<String, Secret<SecretValue>>>
Fetches secret references from the CONFIGDATA bucket by name and then fetches the actual secrets from the configured secret store. Any error returned from this function should result in a failure to start a component, start a provider, or establish a link as a missing secret is a critical error.
§Arguments
secret_names
- A list of secret names to fetch from the secret storeentity_jwt
- The JWT of the entity requesting the secrets. Must be provided unless thisManager
is not configured with a secret store topic.host_jwt
- The JWT of the host requesting the secretsapplication
- The name of the application the entity is a part of, if any
§Returns
A HashMap from secret name to the secrecy::Secret
wrapped SecretValue
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Manager
impl !RefUnwindSafe for Manager
impl Send for Manager
impl Sync for Manager
impl Unpin for Manager
impl !UnwindSafe for Manager
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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self
file descriptor.source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self
file descriptor. Read moresource§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request