pub struct ConfigVaultClient { /* private fields */ }Expand description
Async HTTP client for the ConfigVault API.
Implementations§
Source§impl ConfigVaultClient
impl ConfigVaultClient
Sourcepub fn new(base_url: &str, api_key: &str) -> Self
pub fn new(base_url: &str, api_key: &str) -> Self
Create a new client with the default 30-second timeout.
Sourcepub fn with_timeout(base_url: &str, api_key: &str, timeout: Duration) -> Self
pub fn with_timeout(base_url: &str, api_key: &str, timeout: Duration) -> Self
Create a new client with a custom timeout.
Sourcepub async fn get(&self, key: &str) -> Result<String, ConfigVaultError>
pub async fn get(&self, key: &str) -> Result<String, ConfigVaultError>
Get a configuration value by key.
Sends GET /config/{key} and returns the value string.
Sourcepub async fn exists(&self, key: &str) -> Result<bool, ConfigVaultError>
pub async fn exists(&self, key: &str) -> Result<bool, ConfigVaultError>
Check whether a configuration key exists.
Sends HEAD /config/{key} and returns true on 200, false on 404.
Sourcepub async fn list(
&self,
namespace: &str,
) -> Result<HashMap<String, String>, ConfigVaultError>
pub async fn list( &self, namespace: &str, ) -> Result<HashMap<String, String>, ConfigVaultError>
List all configurations under a namespace prefix.
Sends GET /config?prefix={namespace} and returns a map of key → value.
Sourcepub async fn sync(&self) -> Result<SyncResponse, ConfigVaultError>
pub async fn sync(&self) -> Result<SyncResponse, ConfigVaultError>
Trigger an immediate sync with the upstream Vaultwarden server.
Sends POST /sync and instructs ConfigVault to pull the latest data
from Vaultwarden. After a successful sync the next read of any
configuration key will return the up-to-date value.
Sourcepub async fn health(&self) -> Result<HealthResponse, ConfigVaultError>
pub async fn health(&self) -> Result<HealthResponse, ConfigVaultError>
Check the health of the ConfigVault service.
Sends GET /health and returns the health response.
Sourcepub fn watch(&self, filter: Option<&str>) -> ConfigWatcher
pub fn watch(&self, filter: Option<&str>) -> ConfigWatcher
Create a ConfigWatcher for SSE-based change notifications.
The watcher connects to GET /events?filter={filter}.