vault_iam_auth

Crates.iovault_iam_auth
lib.rsvault_iam_auth
version0.2.0
sourcesrc
created_at2021-07-30 18:31:17.417598
updated_at2021-08-05 23:50:01.644506
descriptionHashiCorp Vault authentication for the AWS IAM engine
homepage
repositoryhttps://github.com/callensm/vault-iam-auth-rs
max_upload_size
id429389
size41,463
Matthew Callens (callensm)

documentation

README

Vault IAM Authentication

crates.io Released API docs MIT licensed

Tiny library for Vault authentication using the AWS IAM engine.

Example

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(&params).await?;

  let token = response
    .get("auth")
    .unwrap()
    .get("client_token")
    .unwrap()
    .as_str()
    .unwrap();
  println!("{}", token);
  Ok(())
}
Commit count: 6

cargo fmt