Skip to main content

Kv2Handler

Struct Kv2Handler 

Source
pub struct Kv2Handler<'a> { /* private fields */ }

Implementations§

Source§

impl Kv2Handler<'_>

Source

pub async fn delete(&self, path: &str) -> Result<(), VaultError>

Source

pub async fn list(&self, path: &str) -> Result<Vec<String>, VaultError>

Source

pub async fn write( &self, path: &str, data: &impl Serialize, ) -> Result<KvMetadata, VaultError>

Source

pub async fn write_cas( &self, path: &str, data: &impl Serialize, cas: u64, ) -> Result<KvMetadata, VaultError>

Source

pub async fn patch( &self, path: &str, data: &impl Serialize, ) -> Result<KvMetadata, VaultError>

Merge fields into an existing KV2 secret

Source

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

Source

pub async fn read_data<T: DeserializeOwned + Send>( &self, path: &str, ) -> Result<T, VaultError>

Source

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

Source

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

Trait Implementations§

Source§

impl<'a> Debug for Kv2Handler<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Kv2Operations for Kv2Handler<'_>

Source§

async fn read_config(&self) -> Result<KvConfig, VaultError>

Source§

async fn write_config(&self, cfg: &KvConfig) -> Result<(), VaultError>

Source§

async fn read<T: DeserializeOwned + Send>( &self, path: &str, ) -> Result<KvReadResponse<T>, VaultError>

Source§

async fn read_data<T: DeserializeOwned + Send>( &self, path: &str, ) -> Result<T, VaultError>

Read a secret and return just the data, discarding metadata
Source§

async fn read_version<T: DeserializeOwned + Send>( &self, path: &str, version: u64, ) -> Result<KvReadResponse<T>, VaultError>

Source§

async fn write( &self, path: &str, data: &Value, ) -> Result<KvMetadata, VaultError>

Source§

async fn write_cas( &self, path: &str, data: &Value, cas: u64, ) -> Result<KvMetadata, VaultError>

Source§

async fn patch( &self, path: &str, data: &Value, ) -> Result<KvMetadata, VaultError>

Source§

async fn list(&self, path: &str) -> Result<Vec<String>, VaultError>

Source§

async fn delete(&self, path: &str) -> Result<(), VaultError>

Source§

async fn delete_versions( &self, path: &str, versions: &[u64], ) -> Result<(), VaultError>

Source§

async fn undelete_versions( &self, path: &str, versions: &[u64], ) -> Result<(), VaultError>

Source§

async fn destroy_versions( &self, path: &str, versions: &[u64], ) -> Result<(), VaultError>

Source§

async fn read_metadata(&self, path: &str) -> Result<KvFullMetadata, VaultError>

Source§

async fn write_metadata( &self, path: &str, meta: &KvMetadataParams, ) -> Result<(), VaultError>

Source§

async fn patch_metadata( &self, path: &str, meta: &KvMetadataParams, ) -> Result<(), VaultError>

Source§

async fn delete_metadata(&self, path: &str) -> Result<(), VaultError>

Source§

async fn read_subkeys( &self, path: &str, depth: Option<u32>, ) -> Result<Value, VaultError>

Auto Trait Implementations§

§

impl<'a> Freeze for Kv2Handler<'a>

§

impl<'a> !RefUnwindSafe for Kv2Handler<'a>

§

impl<'a> Send for Kv2Handler<'a>

§

impl<'a> Sync for Kv2Handler<'a>

§

impl<'a> Unpin for Kv2Handler<'a>

§

impl<'a> UnsafeUnpin for Kv2Handler<'a>

§

impl<'a> !UnwindSafe for Kv2Handler<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more