aws-sdk-securityhub 1.109.0

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

/// <p>The target account, organizational unit, or the root that is associated with an Security Hub CSPM configuration. The configuration can be a configuration policy or self-managed behavior.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub enum Target {
    /// <p>The Amazon Web Services account ID of the target account.</p>
    AccountId(::std::string::String),
    /// <p>The organizational unit ID of the target organizational unit.</p>
    OrganizationalUnitId(::std::string::String),
    /// <p>The ID of the organization root.</p>
    RootId(::std::string::String),
    /// 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 Target {
    /// Tries to convert the enum instance into [`AccountId`](crate::types::Target::AccountId), extracting the inner [`String`](::std::string::String).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_account_id(&self) -> ::std::result::Result<&::std::string::String, &Self> {
        if let Target::AccountId(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`AccountId`](crate::types::Target::AccountId).
    pub fn is_account_id(&self) -> bool {
        self.as_account_id().is_ok()
    }
    /// Tries to convert the enum instance into [`OrganizationalUnitId`](crate::types::Target::OrganizationalUnitId), extracting the inner [`String`](::std::string::String).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_organizational_unit_id(&self) -> ::std::result::Result<&::std::string::String, &Self> {
        if let Target::OrganizationalUnitId(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`OrganizationalUnitId`](crate::types::Target::OrganizationalUnitId).
    pub fn is_organizational_unit_id(&self) -> bool {
        self.as_organizational_unit_id().is_ok()
    }
    /// Tries to convert the enum instance into [`RootId`](crate::types::Target::RootId), extracting the inner [`String`](::std::string::String).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_root_id(&self) -> ::std::result::Result<&::std::string::String, &Self> {
        if let Target::RootId(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`RootId`](crate::types::Target::RootId).
    pub fn is_root_id(&self) -> bool {
        self.as_root_id().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}