aws-sdk-budgets 1.111.0

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

/// When writing a match expression against `Dimension`, it is important to ensure
/// your code is forward-compatible. That is, if a match arm handles a case for a
/// feature that is supported by the service but has not been represented as an enum
/// variant in a current version of SDK, your code should continue to work when you
/// upgrade SDK to a future version in which the enum does include a variant for that
/// feature.
///
/// Here is an example of how you can make a match expression forward-compatible:
///
/// ```text
/// # let dimension = unimplemented!();
/// match dimension {
///     Dimension::Az => { /* ... */ },
///     Dimension::BillingEntity => { /* ... */ },
///     Dimension::CacheEngine => { /* ... */ },
///     Dimension::CostCategoryName => { /* ... */ },
///     Dimension::DatabaseEngine => { /* ... */ },
///     Dimension::DeploymentOption => { /* ... */ },
///     Dimension::InstanceType => { /* ... */ },
///     Dimension::InstanceTypeFamily => { /* ... */ },
///     Dimension::InvoicingEntity => { /* ... */ },
///     Dimension::LegalEntityName => { /* ... */ },
///     Dimension::LinkedAccount => { /* ... */ },
///     Dimension::LinkedAccountName => { /* ... */ },
///     Dimension::OperatingSystem => { /* ... */ },
///     Dimension::Operation => { /* ... */ },
///     Dimension::PaymentOption => { /* ... */ },
///     Dimension::Platform => { /* ... */ },
///     Dimension::PurchaseType => { /* ... */ },
///     Dimension::RecordType => { /* ... */ },
///     Dimension::Region => { /* ... */ },
///     Dimension::ReservationId => { /* ... */ },
///     Dimension::ReservationModified => { /* ... */ },
///     Dimension::ResourceId => { /* ... */ },
///     Dimension::RightsizingType => { /* ... */ },
///     Dimension::SavingsPlansType => { /* ... */ },
///     Dimension::SavingsPlanArn => { /* ... */ },
///     Dimension::Scope => { /* ... */ },
///     Dimension::Service => { /* ... */ },
///     Dimension::ServiceCode => { /* ... */ },
///     Dimension::SubscriptionId => { /* ... */ },
///     Dimension::TagKey => { /* ... */ },
///     Dimension::Tenancy => { /* ... */ },
///     Dimension::UsageType => { /* ... */ },
///     Dimension::UsageTypeGroup => { /* ... */ },
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
///     _ => { /* ... */ },
/// }
/// ```
/// The above code demonstrates that when `dimension` represents
/// `NewFeature`, the execution path will lead to the second last match arm,
/// even though the enum does not contain a variant `Dimension::NewFeature`
/// in the current version of SDK. The reason is that the variable `other`,
/// created by the `@` operator, is bound to
/// `Dimension::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
/// and calling `as_str` on it yields `"NewFeature"`.
/// This match expression is forward-compatible when executed with a newer
/// version of SDK where the variant `Dimension::NewFeature` is defined.
/// Specifically, when `dimension` represents `NewFeature`,
/// the execution path will hit the second last match arm as before by virtue of
/// calling `as_str` on `Dimension::NewFeature` also yielding `"NewFeature"`.
///
/// Explicitly matching on the `Unknown` variant should
/// be avoided for two reasons:
/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
/// - It might inadvertently shadow other intended match arms.
///
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
)]
pub enum Dimension {
    #[allow(missing_docs)] // documentation missing in model
    Az,
    #[allow(missing_docs)] // documentation missing in model
    BillingEntity,
    #[allow(missing_docs)] // documentation missing in model
    CacheEngine,
    #[allow(missing_docs)] // documentation missing in model
    CostCategoryName,
    #[allow(missing_docs)] // documentation missing in model
    DatabaseEngine,
    #[allow(missing_docs)] // documentation missing in model
    DeploymentOption,
    #[allow(missing_docs)] // documentation missing in model
    InstanceType,
    #[allow(missing_docs)] // documentation missing in model
    InstanceTypeFamily,
    #[allow(missing_docs)] // documentation missing in model
    InvoicingEntity,
    #[allow(missing_docs)] // documentation missing in model
    LegalEntityName,
    #[allow(missing_docs)] // documentation missing in model
    LinkedAccount,
    #[allow(missing_docs)] // documentation missing in model
    LinkedAccountName,
    #[allow(missing_docs)] // documentation missing in model
    OperatingSystem,
    #[allow(missing_docs)] // documentation missing in model
    Operation,
    #[allow(missing_docs)] // documentation missing in model
    PaymentOption,
    #[allow(missing_docs)] // documentation missing in model
    Platform,
    #[allow(missing_docs)] // documentation missing in model
    PurchaseType,
    #[allow(missing_docs)] // documentation missing in model
    RecordType,
    #[allow(missing_docs)] // documentation missing in model
    Region,
    #[allow(missing_docs)] // documentation missing in model
    ReservationId,
    #[allow(missing_docs)] // documentation missing in model
    ReservationModified,
    #[allow(missing_docs)] // documentation missing in model
    ResourceId,
    #[allow(missing_docs)] // documentation missing in model
    RightsizingType,
    #[allow(missing_docs)] // documentation missing in model
    SavingsPlansType,
    #[allow(missing_docs)] // documentation missing in model
    SavingsPlanArn,
    #[allow(missing_docs)] // documentation missing in model
    Scope,
    #[allow(missing_docs)] // documentation missing in model
    Service,
    #[allow(missing_docs)] // documentation missing in model
    ServiceCode,
    #[allow(missing_docs)] // documentation missing in model
    SubscriptionId,
    #[allow(missing_docs)] // documentation missing in model
    TagKey,
    #[allow(missing_docs)] // documentation missing in model
    Tenancy,
    #[allow(missing_docs)] // documentation missing in model
    UsageType,
    #[allow(missing_docs)] // documentation missing in model
    UsageTypeGroup,
    /// `Unknown` contains new variants that have been added since this code was generated.
    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
}
impl ::std::convert::From<&str> for Dimension {
    fn from(s: &str) -> Self {
        match s {
            "AZ" => Dimension::Az,
            "BILLING_ENTITY" => Dimension::BillingEntity,
            "CACHE_ENGINE" => Dimension::CacheEngine,
            "COST_CATEGORY_NAME" => Dimension::CostCategoryName,
            "DATABASE_ENGINE" => Dimension::DatabaseEngine,
            "DEPLOYMENT_OPTION" => Dimension::DeploymentOption,
            "INSTANCE_TYPE" => Dimension::InstanceType,
            "INSTANCE_TYPE_FAMILY" => Dimension::InstanceTypeFamily,
            "INVOICING_ENTITY" => Dimension::InvoicingEntity,
            "LEGAL_ENTITY_NAME" => Dimension::LegalEntityName,
            "LINKED_ACCOUNT" => Dimension::LinkedAccount,
            "LINKED_ACCOUNT_NAME" => Dimension::LinkedAccountName,
            "OPERATING_SYSTEM" => Dimension::OperatingSystem,
            "OPERATION" => Dimension::Operation,
            "PAYMENT_OPTION" => Dimension::PaymentOption,
            "PLATFORM" => Dimension::Platform,
            "PURCHASE_TYPE" => Dimension::PurchaseType,
            "RECORD_TYPE" => Dimension::RecordType,
            "REGION" => Dimension::Region,
            "RESERVATION_ID" => Dimension::ReservationId,
            "RESERVATION_MODIFIED" => Dimension::ReservationModified,
            "RESOURCE_ID" => Dimension::ResourceId,
            "RIGHTSIZING_TYPE" => Dimension::RightsizingType,
            "SAVINGS_PLANS_TYPE" => Dimension::SavingsPlansType,
            "SAVINGS_PLAN_ARN" => Dimension::SavingsPlanArn,
            "SCOPE" => Dimension::Scope,
            "SERVICE" => Dimension::Service,
            "SERVICE_CODE" => Dimension::ServiceCode,
            "SUBSCRIPTION_ID" => Dimension::SubscriptionId,
            "TAG_KEY" => Dimension::TagKey,
            "TENANCY" => Dimension::Tenancy,
            "USAGE_TYPE" => Dimension::UsageType,
            "USAGE_TYPE_GROUP" => Dimension::UsageTypeGroup,
            other => Dimension::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
        }
    }
}
impl ::std::str::FromStr for Dimension {
    type Err = ::std::convert::Infallible;

    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
        ::std::result::Result::Ok(Dimension::from(s))
    }
}
impl Dimension {
    /// Returns the `&str` value of the enum member.
    pub fn as_str(&self) -> &str {
        match self {
            Dimension::Az => "AZ",
            Dimension::BillingEntity => "BILLING_ENTITY",
            Dimension::CacheEngine => "CACHE_ENGINE",
            Dimension::CostCategoryName => "COST_CATEGORY_NAME",
            Dimension::DatabaseEngine => "DATABASE_ENGINE",
            Dimension::DeploymentOption => "DEPLOYMENT_OPTION",
            Dimension::InstanceType => "INSTANCE_TYPE",
            Dimension::InstanceTypeFamily => "INSTANCE_TYPE_FAMILY",
            Dimension::InvoicingEntity => "INVOICING_ENTITY",
            Dimension::LegalEntityName => "LEGAL_ENTITY_NAME",
            Dimension::LinkedAccount => "LINKED_ACCOUNT",
            Dimension::LinkedAccountName => "LINKED_ACCOUNT_NAME",
            Dimension::OperatingSystem => "OPERATING_SYSTEM",
            Dimension::Operation => "OPERATION",
            Dimension::PaymentOption => "PAYMENT_OPTION",
            Dimension::Platform => "PLATFORM",
            Dimension::PurchaseType => "PURCHASE_TYPE",
            Dimension::RecordType => "RECORD_TYPE",
            Dimension::Region => "REGION",
            Dimension::ReservationId => "RESERVATION_ID",
            Dimension::ReservationModified => "RESERVATION_MODIFIED",
            Dimension::ResourceId => "RESOURCE_ID",
            Dimension::RightsizingType => "RIGHTSIZING_TYPE",
            Dimension::SavingsPlansType => "SAVINGS_PLANS_TYPE",
            Dimension::SavingsPlanArn => "SAVINGS_PLAN_ARN",
            Dimension::Scope => "SCOPE",
            Dimension::Service => "SERVICE",
            Dimension::ServiceCode => "SERVICE_CODE",
            Dimension::SubscriptionId => "SUBSCRIPTION_ID",
            Dimension::TagKey => "TAG_KEY",
            Dimension::Tenancy => "TENANCY",
            Dimension::UsageType => "USAGE_TYPE",
            Dimension::UsageTypeGroup => "USAGE_TYPE_GROUP",
            Dimension::Unknown(value) => value.as_str(),
        }
    }
    /// Returns all the `&str` representations of the enum members.
    pub const fn values() -> &'static [&'static str] {
        &[
            "AZ",
            "BILLING_ENTITY",
            "CACHE_ENGINE",
            "COST_CATEGORY_NAME",
            "DATABASE_ENGINE",
            "DEPLOYMENT_OPTION",
            "INSTANCE_TYPE",
            "INSTANCE_TYPE_FAMILY",
            "INVOICING_ENTITY",
            "LEGAL_ENTITY_NAME",
            "LINKED_ACCOUNT",
            "LINKED_ACCOUNT_NAME",
            "OPERATING_SYSTEM",
            "OPERATION",
            "PAYMENT_OPTION",
            "PLATFORM",
            "PURCHASE_TYPE",
            "RECORD_TYPE",
            "REGION",
            "RESERVATION_ID",
            "RESERVATION_MODIFIED",
            "RESOURCE_ID",
            "RIGHTSIZING_TYPE",
            "SAVINGS_PLANS_TYPE",
            "SAVINGS_PLAN_ARN",
            "SCOPE",
            "SERVICE",
            "SERVICE_CODE",
            "SUBSCRIPTION_ID",
            "TAG_KEY",
            "TENANCY",
            "USAGE_TYPE",
            "USAGE_TYPE_GROUP",
        ]
    }
}
impl ::std::convert::AsRef<str> for Dimension {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}
impl Dimension {
    /// Parses the enum value while disallowing unknown variants.
    ///
    /// Unknown variants will result in an error.
    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
        match Self::from(value) {
            #[allow(deprecated)]
            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
            known => Ok(known),
        }
    }
}
impl ::std::fmt::Display for Dimension {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        match self {
            Dimension::Az => write!(f, "AZ"),
            Dimension::BillingEntity => write!(f, "BILLING_ENTITY"),
            Dimension::CacheEngine => write!(f, "CACHE_ENGINE"),
            Dimension::CostCategoryName => write!(f, "COST_CATEGORY_NAME"),
            Dimension::DatabaseEngine => write!(f, "DATABASE_ENGINE"),
            Dimension::DeploymentOption => write!(f, "DEPLOYMENT_OPTION"),
            Dimension::InstanceType => write!(f, "INSTANCE_TYPE"),
            Dimension::InstanceTypeFamily => write!(f, "INSTANCE_TYPE_FAMILY"),
            Dimension::InvoicingEntity => write!(f, "INVOICING_ENTITY"),
            Dimension::LegalEntityName => write!(f, "LEGAL_ENTITY_NAME"),
            Dimension::LinkedAccount => write!(f, "LINKED_ACCOUNT"),
            Dimension::LinkedAccountName => write!(f, "LINKED_ACCOUNT_NAME"),
            Dimension::OperatingSystem => write!(f, "OPERATING_SYSTEM"),
            Dimension::Operation => write!(f, "OPERATION"),
            Dimension::PaymentOption => write!(f, "PAYMENT_OPTION"),
            Dimension::Platform => write!(f, "PLATFORM"),
            Dimension::PurchaseType => write!(f, "PURCHASE_TYPE"),
            Dimension::RecordType => write!(f, "RECORD_TYPE"),
            Dimension::Region => write!(f, "REGION"),
            Dimension::ReservationId => write!(f, "RESERVATION_ID"),
            Dimension::ReservationModified => write!(f, "RESERVATION_MODIFIED"),
            Dimension::ResourceId => write!(f, "RESOURCE_ID"),
            Dimension::RightsizingType => write!(f, "RIGHTSIZING_TYPE"),
            Dimension::SavingsPlansType => write!(f, "SAVINGS_PLANS_TYPE"),
            Dimension::SavingsPlanArn => write!(f, "SAVINGS_PLAN_ARN"),
            Dimension::Scope => write!(f, "SCOPE"),
            Dimension::Service => write!(f, "SERVICE"),
            Dimension::ServiceCode => write!(f, "SERVICE_CODE"),
            Dimension::SubscriptionId => write!(f, "SUBSCRIPTION_ID"),
            Dimension::TagKey => write!(f, "TAG_KEY"),
            Dimension::Tenancy => write!(f, "TENANCY"),
            Dimension::UsageType => write!(f, "USAGE_TYPE"),
            Dimension::UsageTypeGroup => write!(f, "USAGE_TYPE_GROUP"),
            Dimension::Unknown(value) => write!(f, "{value}"),
        }
    }
}