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 cosmian_logger::trace;

use crate::{cli_bail, error::result::KmsCliResult};

pub(crate) fn get_key_uid(
    key_id: Option<&String>,
    tags: Option<&Vec<String>>,
    argument_name: &str,
) -> KmsCliResult<String> {
    let id = if let Some(kid) = key_id {
        kid.clone()
    } else if let Some(tags) = tags {
        serde_json::to_string(tags)?
    } else {
        cli_bail!("Either --{argument_name} or one or more --tag must be specified")
    };
    trace!("{id}");
    Ok(id)
}