aws-sdk-amp 1.110.0

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

/// <p>The source of collected metrics for a scraper.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub enum Source {
    /// <p>The Amazon EKS cluster from which a scraper collects metrics.</p>
    EksConfiguration(crate::types::EksConfiguration),
    /// <p>The Amazon VPC configuration for the Prometheus collector when connecting to Amazon MSK clusters. This configuration enables secure, private network connectivity between the collector and your Amazon MSK cluster within your Amazon VPC.</p>
    VpcConfiguration(crate::types::VpcConfiguration),
    /// 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 Source {
    /// Tries to convert the enum instance into [`EksConfiguration`](crate::types::Source::EksConfiguration), extracting the inner [`EksConfiguration`](crate::types::EksConfiguration).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_eks_configuration(&self) -> ::std::result::Result<&crate::types::EksConfiguration, &Self> {
        if let Source::EksConfiguration(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`EksConfiguration`](crate::types::Source::EksConfiguration).
    pub fn is_eks_configuration(&self) -> bool {
        self.as_eks_configuration().is_ok()
    }
    /// Tries to convert the enum instance into [`VpcConfiguration`](crate::types::Source::VpcConfiguration), extracting the inner [`VpcConfiguration`](crate::types::VpcConfiguration).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_vpc_configuration(&self) -> ::std::result::Result<&crate::types::VpcConfiguration, &Self> {
        if let Source::VpcConfiguration(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`VpcConfiguration`](crate::types::Source::VpcConfiguration).
    pub fn is_vpc_configuration(&self) -> bool {
        self.as_vpc_configuration().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}