pub struct SecretManager { /* private fields */ }Expand description
Manager for routing secret operations to the appropriate provider.
Implementations§
Source§impl SecretManager
impl SecretManager
Sourcepub fn with_provider(
self,
name: impl Into<String>,
provider: Arc<dyn SecretProvider>,
) -> Self
pub fn with_provider( self, name: impl Into<String>, provider: Arc<dyn SecretProvider>, ) -> Self
Add a provider.
Sourcepub fn with_default_provider(self, name: impl Into<String>) -> Self
pub fn with_default_provider(self, name: impl Into<String>) -> Self
Set the default provider.
Sourcepub fn with_cache_ttl(self, ttl: Duration) -> Self
pub fn with_cache_ttl(self, ttl: Duration) -> Self
Set the cache TTL.
Sourcepub fn without_cache(self) -> Self
pub fn without_cache(self) -> Self
Disable caching.
Sourcepub fn with_provider_configs(self, configs: &[SecretProviderConfig]) -> Self
pub fn with_provider_configs(self, configs: &[SecretProviderConfig]) -> Self
Add providers from configuration.
Sourcepub async fn get_secret(
&self,
context_id: &str,
definition: &SecretDefinition,
) -> Result<Option<SecretValue>, ContextError>
pub async fn get_secret( &self, context_id: &str, definition: &SecretDefinition, ) -> Result<Option<SecretValue>, ContextError>
Get a secret using the appropriate provider.
Sourcepub async fn set_secret(
&self,
context_id: &str,
definition: &SecretDefinition,
value: &str,
) -> Result<(), ContextError>
pub async fn set_secret( &self, context_id: &str, definition: &SecretDefinition, value: &str, ) -> Result<(), ContextError>
Set a secret using the appropriate provider.
Sourcepub async fn delete_secret(
&self,
context_id: &str,
definition: &SecretDefinition,
) -> Result<(), ContextError>
pub async fn delete_secret( &self, context_id: &str, definition: &SecretDefinition, ) -> Result<(), ContextError>
Delete a secret using the appropriate provider.
Sourcepub async fn verify_secrets(
&self,
context_id: &str,
definitions: &[(&str, &SecretDefinition)],
) -> Result<Vec<String>, ContextError>
pub async fn verify_secrets( &self, context_id: &str, definitions: &[(&str, &SecretDefinition)], ) -> Result<Vec<String>, ContextError>
Check if all required secrets for a context are set.
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Clear the secret cache.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SecretManager
impl !RefUnwindSafe for SecretManager
impl Send for SecretManager
impl Sync for SecretManager
impl Unpin for SecretManager
impl !UnwindSafe for SecretManager
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
Mutably borrows from an owned value. Read more