pub struct KeyValue { /* private fields */ }Implementations§
Source§impl KeyValue
impl KeyValue
Sourcepub fn new(version: KeyValueVersion, mount: impl Into<String>) -> Self
pub fn new(version: KeyValueVersion, mount: impl Into<String>) -> Self
Examples found in repository?
examples/key_value.rs (line 25)
10async fn main() {
11 let vault_client: VaultHttpClient = VaultHttpClient::new(
12 "localhost",
13 8200,
14 false,
15 None as Option<String>
16 );
17
18 let role_id = env::var("ROLE_ID").expect("ROLE_ID not set");
19 let secret_id = env::var("SECRET_ID").expect("SECRET_ID not set");
20 let approle_credentials = ApproleCredentials::new(role_id, secret_id);
21 let response = login(&vault_client, approle_credentials).await;
22 let token: String = response.unwrap().auth.client_token;
23 let authenticated_client: AuthenticatedVaultClient = AuthenticatedVaultClient::new(Box::new(vault_client), token);
24
25 let key_value: KeyValue = KeyValue::new(KeyValueVersion::Two, "secret");
26 println!("{:#?}", key_value.read(&authenticated_client, "hello").await);
27
28 let key_value_legacy: KeyValue = KeyValue::new(KeyValueVersion::One, "legacy");
29 println!("{:#?}", key_value_legacy.read(&authenticated_client, "hello").await);
30}Sourcepub async fn read(
&self,
vault_client: &AuthenticatedVaultClient,
path: &str,
) -> Result<KeyValueResponse, VaultClientError>
pub async fn read( &self, vault_client: &AuthenticatedVaultClient, path: &str, ) -> Result<KeyValueResponse, VaultClientError>
Examples found in repository?
examples/key_value.rs (line 26)
10async fn main() {
11 let vault_client: VaultHttpClient = VaultHttpClient::new(
12 "localhost",
13 8200,
14 false,
15 None as Option<String>
16 );
17
18 let role_id = env::var("ROLE_ID").expect("ROLE_ID not set");
19 let secret_id = env::var("SECRET_ID").expect("SECRET_ID not set");
20 let approle_credentials = ApproleCredentials::new(role_id, secret_id);
21 let response = login(&vault_client, approle_credentials).await;
22 let token: String = response.unwrap().auth.client_token;
23 let authenticated_client: AuthenticatedVaultClient = AuthenticatedVaultClient::new(Box::new(vault_client), token);
24
25 let key_value: KeyValue = KeyValue::new(KeyValueVersion::Two, "secret");
26 println!("{:#?}", key_value.read(&authenticated_client, "hello").await);
27
28 let key_value_legacy: KeyValue = KeyValue::new(KeyValueVersion::One, "legacy");
29 println!("{:#?}", key_value_legacy.read(&authenticated_client, "hello").await);
30}Auto Trait Implementations§
impl Freeze for KeyValue
impl RefUnwindSafe for KeyValue
impl Send for KeyValue
impl Sync for KeyValue
impl Unpin for KeyValue
impl UnsafeUnpin for KeyValue
impl UnwindSafe for KeyValue
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