aws-sdk-emr 1.121.0

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

/// <p>The credentials that you can use to connect to cluster endpoints. Credentials consist of a username and a password.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub enum Credentials {
    /// <p>The username and password that you use to connect to cluster endpoints.</p>
    UsernamePassword(crate::types::UsernamePassword),
    /// 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 Credentials {
    #[allow(irrefutable_let_patterns)]
    /// Tries to convert the enum instance into [`UsernamePassword`](crate::types::Credentials::UsernamePassword), extracting the inner [`UsernamePassword`](crate::types::UsernamePassword).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_username_password(&self) -> ::std::result::Result<&crate::types::UsernamePassword, &Self> {
        if let Credentials::UsernamePassword(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`UsernamePassword`](crate::types::Credentials::UsernamePassword).
    pub fn is_username_password(&self) -> bool {
        self.as_username_password().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 Credentials {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        match self {
            Credentials::UsernamePassword(_) => f.debug_tuple("*** Sensitive Data Redacted ***").finish(),
            Credentials::Unknown => f.debug_tuple("Unknown").finish(),
        }
    }
}