wasmer_cli/commands/app/volumes/credentials/
rotate_secrets.rs1use super::ItemFormatOpts;
2use crate::{
3    commands::{
4        AsyncCliCommand,
5        app::util::{AppIdent, AppIdentOpts},
6    },
7    config::WasmerEnv,
8};
9
10#[derive(clap::Parser, Debug)]
12pub struct CmdAppVolumesRotateSecrets {
13    #[clap(flatten)]
14    pub env: WasmerEnv,
15
16    #[clap(flatten)]
17    pub ident: AppIdentOpts,
18
19    #[clap(flatten)]
20    pub fmt: ItemFormatOpts,
21}
22
23#[async_trait::async_trait]
24impl AsyncCliCommand for CmdAppVolumesRotateSecrets {
25    type Output = ();
26
27    async fn run_async(self) -> Result<Self::Output, anyhow::Error> {
28        let client = self.env.client()?;
29        let (_ident, app) = self.ident.load_app(&client).await?;
30
31        wasmer_backend_api::query::rotate_s3_secrets(&client, app.id).await?;
32
33        super::CmdAppVolumesCredentials {
43            env: self.env,
44            fmt: self.fmt,
45            ident: AppIdentOpts {
46                app: Some(AppIdent::NamespacedName(app.owner.global_name, app.name)),
47            },
48        }
49        .run_async()
50        .await?;
51
52        Ok(())
53    }
54}