pub struct Kv2Handler<'a> { /* private fields */ }Implementations§
Source§impl Kv2Handler<'_>
impl Kv2Handler<'_>
pub async fn delete(&self, path: &str) -> Result<(), VaultError>
pub async fn list(&self, path: &str) -> Result<Vec<String>, VaultError>
pub async fn write( &self, path: &str, data: &impl Serialize, ) -> Result<KvMetadata, VaultError>
pub async fn write_cas( &self, path: &str, data: &impl Serialize, cas: u64, ) -> Result<KvMetadata, VaultError>
Sourcepub async fn patch(
&self,
path: &str,
data: &impl Serialize,
) -> Result<KvMetadata, VaultError>
pub async fn patch( &self, path: &str, data: &impl Serialize, ) -> Result<KvMetadata, VaultError>
Merge fields into an existing KV2 secret
Sourcepub async fn write_field(
&self,
path: &str,
field: &str,
value: &str,
) -> Result<KvMetadata, VaultError>
pub async fn write_field( &self, path: &str, field: &str, value: &str, ) -> Result<KvMetadata, VaultError>
Write a single field to a KV2 secret
The entire secret is overwritten with only the provided field: all
other fields in the current version are discarded. Use patch to
merge a partial update while preserving existing fields
pub async fn read_data<T: DeserializeOwned + Send>( &self, path: &str, ) -> Result<T, VaultError>
Sourcepub async fn read_field(
&self,
path: &str,
field: &str,
) -> Result<String, VaultError>
pub async fn read_field( &self, path: &str, field: &str, ) -> Result<String, VaultError>
Read a single field from a KV2 secret, stringified
String values are returned as-is; other JSON types (numbers,
booleans, objects) are converted via their JSON representation,
matching vault kv get -field= behaviour
Sourcepub async fn read_string_data(
&self,
path: &str,
) -> Result<HashMap<String, String>, VaultError>
pub async fn read_string_data( &self, path: &str, ) -> Result<HashMap<String, String>, VaultError>
Read all fields from a KV2 secret as String key-value pairs
Every value in the secret must be a JSON string; numeric or boolean
values cause a VaultError::Deserialize error. Use read_field to
extract a single field regardless of its JSON type, or read_data to
deserialize into a typed struct