vaultrs/api/auth/userpass/
requests.rsuse super::responses::{ListUsersResponse, ReadUserResponse};
use rustify_derive::Endpoint;
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/users/{self.username}",
method = "POST",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct CreateUserRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub username: String,
pub password: String,
pub token_bound_cidrs: Option<Vec<String>>,
pub token_explicit_max_ttl: Option<String>,
pub token_no_default_policy: Option<bool>,
pub token_num_uses: Option<u64>,
pub token_ttl: Option<String>,
pub token_max_ttl: Option<String>,
pub token_period: Option<String>,
pub token_policies: Option<Vec<String>>,
pub token_type: Option<String>,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/users/{self.username}",
response = "ReadUserResponse",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ReadUserRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub username: String,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/users/{self.username}",
method = "DELETE",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct DeleteUserRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub username: String,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/users/{self.username}/password",
method = "POST",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct UpdatePasswordRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub username: String,
pub password: String,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/users/{self.username}/policies",
method = "POST",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct UpdatePoliciesRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub username: String,
pub policies: String,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/users",
method = "LIST",
response = "ListUsersResponse",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ListUsersRequest {
#[endpoint(skip)]
pub mount: String,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/login/{self.username}",
method = "POST",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct LoginRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub username: String,
pub password: String,
}