Add resource secret epoch metadata
This commit is contained in:
parent
ce260625d6
commit
a05112e6a2
12 changed files with 287 additions and 13 deletions
|
|
@ -161,6 +161,8 @@ pub enum AuthCommand {
|
|||
#[derive(Debug, Subcommand)]
|
||||
pub enum SecretCommand {
|
||||
Status,
|
||||
Create { resource: String },
|
||||
Rotate { resource: String },
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
|
|
@ -390,9 +392,10 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
|
|||
Command::Auth {
|
||||
command: AuthCommand::Revoke { resource, grant_id },
|
||||
} => ControlRequest::AuthRevoke { resource, grant_id },
|
||||
Command::Secret { command } => ControlRequest::ModuleStub {
|
||||
module: "secret".to_owned(),
|
||||
command: format!("{command:?}"),
|
||||
Command::Secret { command } => match command {
|
||||
SecretCommand::Status => ControlRequest::SecretStatus,
|
||||
SecretCommand::Create { resource } => ControlRequest::SecretCreate { resource },
|
||||
SecretCommand::Rotate { resource } => ControlRequest::SecretRotate { resource },
|
||||
},
|
||||
Command::Cas { command } => match command {
|
||||
CasCommand::Add { path } => ControlRequest::CasAdd { path },
|
||||
|
|
@ -636,6 +639,20 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
|
|||
println!("recorded keychain op: {}", op.id);
|
||||
}
|
||||
}
|
||||
ControlResponse::SecretStatus { secrets } => {
|
||||
if secrets.is_empty() {
|
||||
println!("no resource secrets");
|
||||
} else {
|
||||
for secret in secrets {
|
||||
println!("{}\t{}\tepoch {}", secret.id, secret.resource, secret.epoch);
|
||||
}
|
||||
}
|
||||
}
|
||||
ControlResponse::SecretCreated { secret } => {
|
||||
println!("resource secret: {}", secret.id);
|
||||
println!("resource: {}", secret.resource);
|
||||
println!("epoch: {}", secret.epoch);
|
||||
}
|
||||
ControlResponse::AuthExplain(explain) => {
|
||||
println!("allowed: {}", explain.allowed);
|
||||
println!("subject: {}", explain.subject);
|
||||
|
|
|
|||
Loading…
Reference in a new issue