pub struct SecretClient { /* private fields */ }Expand description
A client to read secrets from Hashicorp Vault.
The client is initialized with a VaultClient, the mount and a base path.
Implementations§
Source§impl SecretClient
impl SecretClient
Sourcepub fn new(
address: &str,
mount: String,
base_path: String,
token: Option<String>,
) -> Result<SecretClient>
pub fn new( address: &str, mount: String, base_path: String, token: Option<String>, ) -> Result<SecretClient>
Convenience method to create a new SecretClient from a vault token.
- address is the address of your Vault instance.
- mount is the mount point of the KV2 secrets engine.
- base_path reflects the lowest level of where secrets are located
- token is the Vault token to use. If no token is passed it tries to read the token from /vault/secrets/token.
Sourcepub async fn read_secrets<A>(&self) -> Result<A>where
A: for<'de> Deserialize<'de>,
pub async fn read_secrets<A>(&self) -> Result<A>where
A: for<'de> Deserialize<'de>,
Read secrets from the base path.
Sourcepub async fn read_secrets_from<A>(&self, path: &str) -> Result<A>where
A: for<'de> Deserialize<'de>,
pub async fn read_secrets_from<A>(&self, path: &str) -> Result<A>where
A: for<'de> Deserialize<'de>,
Read secrets from the passed path relative to the base path.
Sourcepub async fn read_secrets_with_metadata<A>(
&self,
path: Option<&str>,
) -> Result<SecretWithMetaData<A>>where
A: for<'de> Deserialize<'de>,
pub async fn read_secrets_with_metadata<A>(
&self,
path: Option<&str>,
) -> Result<SecretWithMetaData<A>>where
A: for<'de> Deserialize<'de>,
Read secrets with metadata.
Auto Trait Implementations§
impl Freeze for SecretClient
impl !RefUnwindSafe for SecretClient
impl Send for SecretClient
impl Sync for SecretClient
impl Unpin for SecretClient
impl !UnwindSafe for SecretClient
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