Crates.io | vault_iam_auth |
lib.rs | vault_iam_auth |
version | 0.2.0 |
source | src |
created_at | 2021-07-30 18:31:17.417598 |
updated_at | 2021-08-05 23:50:01.644506 |
description | HashiCorp Vault authentication for the AWS IAM engine |
homepage | |
repository | https://github.com/callensm/vault-iam-auth-rs |
max_upload_size | |
id | 429389 |
size | 41,463 |
Tiny library for Vault authentication using the AWS IAM engine.
The authenticate
function returns a serde_json::Value
of the standard Vault login API response body.
use std::error::Error;
use serde_json::Value;
use vault_iam_auth::{authenticate, Parameters};
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let params = Parameters {
iam_server_id: None,
mount_path: String::from("aws"),
role: String::from("my-role"),
vault_address: String::from("https://vault.address.com:8200"),
};
let response: serde_json::Value = authenticate(¶ms).await?;
let token = response
.get("auth")
.unwrap()
.get("client_token")
.unwrap()
.as_str()
.unwrap();
println!("{}", token);
Ok(())
}