pub enum SecretManager {
Aws(AwsSecretManager),
Memory(MemorySecretManager),
}Expand description
Secret manager backed by some underlying secret manager implementation
Variants§
Aws(AwsSecretManager)
AWS backed secret manager
Memory(MemorySecretManager)
In-memory secret manager
Implementations§
Source§impl SecretManager
impl SecretManager
Sourcepub fn from_config(aws_config: &SdkConfig, config: SecretsManagerConfig) -> Self
pub fn from_config(aws_config: &SdkConfig, config: SecretsManagerConfig) -> Self
Create the secret manager from the provided config
The aws_config is required to provide aws specific settings when the AWS secret
manager is used
Sourcepub async fn get_secret(
&self,
name: &str,
) -> Result<Option<Secret>, SecretManagerError>
pub async fn get_secret( &self, name: &str, ) -> Result<Option<Secret>, SecretManagerError>
Get a secret by name
When using the memory secret manager this may return a default value, other secret managers will only return the actual secret
Sourcepub async fn has_secret(&self, name: &str) -> Result<bool, SecretManagerError>
pub async fn has_secret(&self, name: &str) -> Result<bool, SecretManagerError>
Check if a secret exists by name
For the in-memory secret manager this will not return true unless the secret actually exists (Unlike SecretManager::get_secret which can return the default)
Sourcepub async fn set_secret(
&self,
name: &str,
value: &str,
) -> Result<SetSecretOutcome, SecretManagerError>
pub async fn set_secret( &self, name: &str, value: &str, ) -> Result<SetSecretOutcome, SecretManagerError>
Set the value of name secret to value
Will create a new secret if the secret does not already exist
Sourcepub async fn delete_secret(
&self,
name: &str,
force: bool,
) -> Result<(), SecretManagerError>
pub async fn delete_secret( &self, name: &str, force: bool, ) -> Result<(), SecretManagerError>
Delete a secret by name
Sourcepub async fn parsed_secret<D: DeserializeOwned>(
&self,
name: &str,
) -> Result<Option<D>, SecretManagerError>
pub async fn parsed_secret<D: DeserializeOwned>( &self, name: &str, ) -> Result<Option<D>, SecretManagerError>
Get a secret by name parsed as type [D] from JSON
Trait Implementations§
Source§impl Clone for SecretManager
impl Clone for SecretManager
Source§fn clone(&self) -> SecretManager
fn clone(&self) -> SecretManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§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 more