cosmian_kms_cli 5.20.0

Command Line Interface used to manage the KMS server If any assistance is needed, please either visit the Cosmian technical documentation at https://docs.cosmian.com or contact the Cosmian support team on Discord https://discord.com/invite/7kPMNtHpnz
Documentation
use clap::Parser;
use cosmian_kms_client::KmsClient;

use self::{identities::IdentitiesCommands, key_pairs::KeyPairsCommands};
use crate::error::result::KmsCliResult;

mod gmail_client;
mod identities;
pub mod key_pairs;

pub use gmail_client::GoogleApiError;

/// Manage google elements. Handle key pairs and identities from Gmail API.
#[derive(Parser)]
pub enum GoogleCommands {
    #[command(subcommand)]
    KeyPairs(KeyPairsCommands),
    #[command(subcommand)]
    Identities(IdentitiesCommands),
}

impl GoogleCommands {
    /// Process the Google command by delegating the execution to the appropriate subcommand.
    ///
    /// # Arguments
    ///
    /// * `conf_path` - The path to the configuration file.
    ///
    /// # Errors
    ///
    /// Returns a `KmsCliResult` indicating the success or failure of the command.
    pub async fn process(&self, kms_rest_client: KmsClient) -> KmsCliResult<()> {
        match self {
            Self::KeyPairs(command) => command.process(kms_rest_client).await?,
            Self::Identities(command) => command.process(kms_rest_client.config).await?,
        }
        Ok(())
    }
}