pub struct ClientBuilder { /* private fields */ }Expand description
Builder for configuring and constructing a VaultClient
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Pre-populate the builder from VAULT_* environment variables;
token resolution order: VAULT_TOKEN → ~/.vault-token → None
pub fn address(self, addr: &str) -> Self
pub fn token(self, token: SecretString) -> Self
pub fn token_str(self, token: &str) -> Self
pub fn namespace(self, ns: &str) -> Self
pub fn timeout(self, timeout: Duration) -> Self
pub fn max_retries(self, n: u32) -> Self
pub fn initial_retry_delay(self, d: Duration) -> Self
pub fn wrap_ttl(self, ttl: &str) -> Self
pub fn forward_to_leader(self, yes: bool) -> Self
Sourcepub fn cli_mode(self, yes: bool) -> Self
pub fn cli_mode(self, yes: bool) -> Self
Optimise for short-lived CLI invocations
Sets max_retries(0) and disables sealed-Vault retries —
a sealed Vault will not unseal itself between invocations —
equivalent to VAULT_CLI_MODE=1 in from_env()
pub fn danger_disable_tls_verify(self, yes: bool) -> Self
pub fn ca_cert_pem(self, pem: impl Into<Vec<u8>>) -> Self
pub fn client_cert_pem( self, cert: impl Into<Vec<u8>>, key: impl Into<Vec<u8>>, ) -> Self
Sourcepub fn auth_method(self, method: impl AuthMethod + 'static) -> Self
pub fn auth_method(self, method: impl AuthMethod + 'static) -> Self
Set an authentication method for automatic token lifecycle management
When set, the client will automatically re-authenticate when the token nears expiry or is missing
Sourcepub fn circuit_breaker(self, config: CircuitBreakerConfig) -> Self
pub fn circuit_breaker(self, config: CircuitBreakerConfig) -> Self
Enable the circuit breaker with the given configuration
When enabled, consecutive failures will trip the circuit and short-circuit subsequent requests until the reset timeout elapses
Sourcepub fn on_token_changed(
self,
f: impl Fn(&AuthInfo) + Send + Sync + 'static,
) -> Self
pub fn on_token_changed( self, f: impl Fn(&AuthInfo) + Send + Sync + 'static, ) -> Self
Register a callback invoked whenever the client’s token changes via renewal or re-authentication