aws-sdk-customerprofiles 1.118.0

AWS SDK for Amazon Connect Customer Profiles
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Object that holds what profile and calculated attributes to segment on.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub enum Dimension {
    /// <p>Object that holds the calculated attributes to segment on.</p>
    CalculatedAttributes(::std::collections::HashMap<::std::string::String, crate::types::CalculatedAttributeDimension>),
    /// <p>Object that holds the profile attributes to segment on.</p>
    ProfileAttributes(crate::types::ProfileAttributes),
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
    /// An unknown enum variant
    ///
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
    #[non_exhaustive]
    Unknown,
}
impl Dimension {
    /// Tries to convert the enum instance into [`CalculatedAttributes`](crate::types::Dimension::CalculatedAttributes), extracting the inner [`HashMap`](::std::collections::HashMap).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_calculated_attributes(
        &self,
    ) -> ::std::result::Result<&::std::collections::HashMap<::std::string::String, crate::types::CalculatedAttributeDimension>, &Self> {
        if let Dimension::CalculatedAttributes(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`CalculatedAttributes`](crate::types::Dimension::CalculatedAttributes).
    pub fn is_calculated_attributes(&self) -> bool {
        self.as_calculated_attributes().is_ok()
    }
    /// Tries to convert the enum instance into [`ProfileAttributes`](crate::types::Dimension::ProfileAttributes), extracting the inner [`ProfileAttributes`](crate::types::ProfileAttributes).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_profile_attributes(&self) -> ::std::result::Result<&crate::types::ProfileAttributes, &Self> {
        if let Dimension::ProfileAttributes(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`ProfileAttributes`](crate::types::Dimension::ProfileAttributes).
    pub fn is_profile_attributes(&self) -> bool {
        self.as_profile_attributes().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}
impl ::std::fmt::Debug for Dimension {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        match self {
            Dimension::CalculatedAttributes(val) => f.debug_tuple("CalculatedAttributes").field(&val).finish(),
            Dimension::ProfileAttributes(_) => f.debug_tuple("*** Sensitive Data Redacted ***").finish(),
            Dimension::Unknown => f.debug_tuple("Unknown").finish(),
        }
    }
}