pub struct ApproleCredentials { /* private fields */ }Implementations§
Source§impl ApproleCredentials
impl ApproleCredentials
Sourcepub fn new(role_id: impl Into<String>, secret_id: impl Into<String>) -> Self
pub fn new(role_id: impl Into<String>, secret_id: impl Into<String>) -> Self
Examples found in repository?
examples/key_value.rs (line 20)
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}Trait Implementations§
Source§impl Debug for ApproleCredentials
impl Debug for ApproleCredentials
Source§impl From<ApproleCredentials> for Parameters
impl From<ApproleCredentials> for Parameters
Source§fn from(approle_credentials: ApproleCredentials) -> Self
fn from(approle_credentials: ApproleCredentials) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ApproleCredentials
impl RefUnwindSafe for ApproleCredentials
impl Send for ApproleCredentials
impl Sync for ApproleCredentials
impl Unpin for ApproleCredentials
impl UnsafeUnpin for ApproleCredentials
impl UnwindSafe for ApproleCredentials
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