use crate::HostCallFlags;
use crate::cmds::accounts::get_current_account;
use clap::Subcommand;
use tracing::instrument;
#[derive(Subcommand, Debug)]
pub enum Secrets {
Store {
#[command(flatten)]
host: HostCallFlags,
name: String,
secret: String,
},
}
impl Secrets {
#[instrument(skip_all, name = "secrets")]
pub async fn handle(&self, project: &str) -> anyhow::Result<()> {
match self {
Self::Store { name, secret, host } => {
let account = get_current_account(host.insecure)?;
let client = host.client(&account)?;
client
.secrets_store(project, name, secret.as_bytes())
.await?;
}
}
Ok(())
}
}