aws-sdk-securityhub 1.110.0

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

/// <p>An object that defines how Security Hub CSPM is configured. It includes whether Security Hub CSPM is enabled or disabled, a list of enabled security standards, a list of enabled or disabled security controls, and a list of custom parameter values for specified controls. If you provide a list of security controls that are enabled in the configuration policy, Security Hub CSPM disables all other controls (including newly released controls). If you provide a list of security controls that are disabled in the configuration policy, Security Hub CSPM enables all other controls (including newly released controls).</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub enum Policy {
    /// <p>The Amazon Web Services service that the configuration policy applies to.</p>
    SecurityHub(crate::types::SecurityHubPolicy),
    /// 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 Policy {
    #[allow(irrefutable_let_patterns)]
    /// Tries to convert the enum instance into [`SecurityHub`](crate::types::Policy::SecurityHub), extracting the inner [`SecurityHubPolicy`](crate::types::SecurityHubPolicy).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_security_hub(&self) -> ::std::result::Result<&crate::types::SecurityHubPolicy, &Self> {
        if let Policy::SecurityHub(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`SecurityHub`](crate::types::Policy::SecurityHub).
    pub fn is_security_hub(&self) -> bool {
        self.as_security_hub().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}