I want to get a secret, that already exists in vault with a specific path "passwords/admin"
[dependencies]
hashicorp_vault = "2.1.0"
use hashicorp_vault::Client;
fn main() {
let client = Client::new("http://my_vault.server:8200", "xxxxxx.xxxxx.xxxxx.xxxxx").unwrap();
match client.get_secret("passwords/admin") {
Ok(secret) => {
println!("{}", secret);
},
Err(e) => {
println!("{}", e);
},
}
}
Get error:
Error in vault response: Vault request failed: Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("my_vault.server")), port: Some(8200), path: "/v1/secret/data/passwords/admin", query: None, fragment: None }, status: 404, headers: {"cache-control": "no-store", "content-type": "application/json", "date": "Mon, 26 Sep 2022 15:58:19 GMT", "content-length": "14"} }, error message: {"errors":[]} Could not read vault response.
The question is why it trying to get from /v1/secret/data/passwords/admin? Why "data"? And if i will add some new secret, fro example:
match client.set_secret("sec01", "val01") {
Ok(_) => {},
Err(e) => println!("{}", e),
}
It also will be available with data inside the path. How I can specify the full path to the secret? Thank you!