aws-sdk-cloudextensions 1.0.0

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

/// Controls how clients identify themselves when interacting with an extension.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub enum Authentication {
    /// Clients sign requests with SigV4 using a key the service issues.
    ExtensionKey(crate::types::ExtensionKey),
    /// Whether clients may interact with the extension interface without authenticating.
    None(bool),
    /// Clients sign requests with SigV4 using the AWS credentials the Cloud Extensions Runtime gets from its environment.
    RuntimeCredentials(crate::types::RuntimeCredentials),
    /// 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 Authentication {
    /// Tries to convert the enum instance into [`ExtensionKey`](crate::types::Authentication::ExtensionKey), extracting the inner [`ExtensionKey`](crate::types::ExtensionKey).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_extension_key(&self) -> ::std::result::Result<&crate::types::ExtensionKey, &Self> {
        if let Authentication::ExtensionKey(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`ExtensionKey`](crate::types::Authentication::ExtensionKey).
    pub fn is_extension_key(&self) -> bool {
        self.as_extension_key().is_ok()
    }
    /// Tries to convert the enum instance into [`None`](crate::types::Authentication::None), extracting the inner [`bool`](bool).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_none(&self) -> ::std::result::Result<&bool, &Self> {
        if let Authentication::None(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`None`](crate::types::Authentication::None).
    pub fn is_none(&self) -> bool {
        self.as_none().is_ok()
    }
    /// Tries to convert the enum instance into [`RuntimeCredentials`](crate::types::Authentication::RuntimeCredentials), extracting the inner [`RuntimeCredentials`](crate::types::RuntimeCredentials).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_runtime_credentials(&self) -> ::std::result::Result<&crate::types::RuntimeCredentials, &Self> {
        if let Authentication::RuntimeCredentials(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`RuntimeCredentials`](crate::types::Authentication::RuntimeCredentials).
    pub fn is_runtime_credentials(&self) -> bool {
        self.as_runtime_credentials().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}