openbao 1.0.2

Secure, typed, async Rust SDK for OpenBao
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! AppRole login example.

use openbao::{Client, Result, SecretString};

#[tokio::main]
async fn main() -> Result<()> {
    let role_id = SecretString::from(std::env::var("BAO_ROLE_ID").unwrap_or_default());
    let secret_id = SecretString::from(std::env::var("BAO_SECRET_ID").unwrap_or_default());

    let unauthenticated = Client::new("https://bao.example.com:8200")?;
    let (client, metadata) = unauthenticated.login_approle(role_id, secret_id).await?;
    let _renewable = metadata.renewable;
    let _health = client.sys().health().await?;
    Ok(())
}