pub struct VaultClient { /* private fields */ }Expand description
An asynchronous Vault client
Build instances with ClientBuilder
Implementations§
Source§impl VaultClient
impl VaultClient
Sourcepub fn new(address: &str, token: &str) -> Result<Self, VaultError>
pub fn new(address: &str, token: &str) -> Result<Self, VaultError>
Create a client with an address and plaintext token
For more options, use VaultClient::builder()
Sourcepub fn from_env() -> Result<Self, VaultError>
pub fn from_env() -> Result<Self, VaultError>
Create a client from VAULT_* environment variables;
token resolution order: VAULT_TOKEN → ~/.vault-token → None
pub fn builder() -> ClientBuilder
pub fn cubbyhole(&self, mount: &str) -> CubbyholeHandler<'_>
pub fn kv1(&self, mount: &str) -> Kv1Handler<'_>
pub fn kv2(&self, mount: &str) -> Kv2Handler<'_>
pub fn transit(&self, mount: &str) -> TransitHandler<'_>
pub fn pki(&self, mount: &str) -> PkiHandler<'_>
pub fn database(&self, mount: &str) -> DatabaseHandler<'_>
pub fn ssh(&self, mount: &str) -> SshHandler<'_>
pub fn aws_secrets(&self, mount: &str) -> AwsSecretsHandler<'_>
pub fn totp(&self, mount: &str) -> TotpHandler<'_>
pub fn consul_secrets(&self, mount: &str) -> ConsulHandler<'_>
pub fn nomad_secrets(&self, mount: &str) -> NomadHandler<'_>
pub fn azure_secrets(&self, mount: &str) -> AzureHandler<'_>
pub fn gcp_secrets(&self, mount: &str) -> GcpHandler<'_>
pub fn rabbitmq(&self, mount: &str) -> RabbitmqHandler<'_>
pub fn terraform_cloud(&self, mount: &str) -> TerraformCloudHandler<'_>
pub fn identity(&self) -> IdentityHandler<'_>
pub fn sys(&self) -> SysHandler<'_>
pub fn auth(&self) -> AuthHandler<'_>
Sourcepub fn set_token(&self, token: SecretString) -> Result<(), VaultError>
pub fn set_token(&self, token: SecretString) -> Result<(), VaultError>
Replace the current token at runtime
Sourcepub fn with_namespace(&self, ns: &str) -> Self
pub fn with_namespace(&self, ns: &str) -> Self
Return a client view with a different namespace (cheap Arc clone)
Sourcepub fn with_wrap_ttl(&self, ttl: &str) -> Self
pub fn with_wrap_ttl(&self, ttl: &str) -> Self
Return a client view with a different wrap TTL (cheap Arc clone)
Source§impl VaultClient
impl VaultClient
Sourcepub async fn read<T: DeserializeOwned>(
&self,
path: &str,
) -> Result<T, VaultError>
pub async fn read<T: DeserializeOwned>( &self, path: &str, ) -> Result<T, VaultError>
Read from an arbitrary Vault path, deserializing the data field
Sourcepub async fn read_raw(
&self,
path: &str,
) -> Result<VaultResponse<Value>, VaultError>
pub async fn read_raw( &self, path: &str, ) -> Result<VaultResponse<Value>, VaultError>
Read from an arbitrary path, returning the full Vault response envelope
Sourcepub async fn write<T: DeserializeOwned>(
&self,
path: &str,
data: &impl Serialize,
) -> Result<VaultResponse<T>, VaultError>
pub async fn write<T: DeserializeOwned>( &self, path: &str, data: &impl Serialize, ) -> Result<VaultResponse<T>, VaultError>
Write to an arbitrary Vault path
Trait Implementations§
Source§impl Clone for VaultClient
impl Clone for VaultClient
Source§fn clone(&self) -> VaultClient
fn clone(&self) -> VaultClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for VaultClient
impl !RefUnwindSafe for VaultClient
impl Send for VaultClient
impl Sync for VaultClient
impl Unpin for VaultClient
impl UnsafeUnpin for VaultClient
impl !UnwindSafe for VaultClient
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