aws-sdk-paymentcryptography 1.106.0

AWS SDK for Payment Cryptography Control Plane
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Contains information about an alias.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Alias {
    /// <p>A friendly name that you can use to refer to a key. The value must begin with <code>alias/</code>.</p><important>
    /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
    /// </important>
    pub alias_name: ::std::string::String,
    /// <p>The <code>KeyARN</code> of the key associated with the alias.</p>
    pub key_arn: ::std::option::Option<::std::string::String>,
}
impl Alias {
    /// <p>A friendly name that you can use to refer to a key. The value must begin with <code>alias/</code>.</p><important>
    /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
    /// </important>
    pub fn alias_name(&self) -> &str {
        use std::ops::Deref;
        self.alias_name.deref()
    }
    /// <p>The <code>KeyARN</code> of the key associated with the alias.</p>
    pub fn key_arn(&self) -> ::std::option::Option<&str> {
        self.key_arn.as_deref()
    }
}
impl Alias {
    /// Creates a new builder-style object to manufacture [`Alias`](crate::types::Alias).
    pub fn builder() -> crate::types::builders::AliasBuilder {
        crate::types::builders::AliasBuilder::default()
    }
}

/// A builder for [`Alias`](crate::types::Alias).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AliasBuilder {
    pub(crate) alias_name: ::std::option::Option<::std::string::String>,
    pub(crate) key_arn: ::std::option::Option<::std::string::String>,
}
impl AliasBuilder {
    /// <p>A friendly name that you can use to refer to a key. The value must begin with <code>alias/</code>.</p><important>
    /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
    /// </important>
    /// This field is required.
    pub fn alias_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.alias_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A friendly name that you can use to refer to a key. The value must begin with <code>alias/</code>.</p><important>
    /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
    /// </important>
    pub fn set_alias_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.alias_name = input;
        self
    }
    /// <p>A friendly name that you can use to refer to a key. The value must begin with <code>alias/</code>.</p><important>
    /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
    /// </important>
    pub fn get_alias_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.alias_name
    }
    /// <p>The <code>KeyARN</code> of the key associated with the alias.</p>
    pub fn key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.key_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The <code>KeyARN</code> of the key associated with the alias.</p>
    pub fn set_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.key_arn = input;
        self
    }
    /// <p>The <code>KeyARN</code> of the key associated with the alias.</p>
    pub fn get_key_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.key_arn
    }
    /// Consumes the builder and constructs a [`Alias`](crate::types::Alias).
    /// This method will fail if any of the following fields are not set:
    /// - [`alias_name`](crate::types::builders::AliasBuilder::alias_name)
    pub fn build(self) -> ::std::result::Result<crate::types::Alias, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Alias {
            alias_name: self.alias_name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "alias_name",
                    "alias_name was not specified but it is required when building Alias",
                )
            })?,
            key_arn: self.key_arn,
        })
    }
}