aws-sdk-pricingplanmanager 1.0.0

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

/// <p>The full details of a flat-rate pricing subscription, including its current configuration, status, and associated resources.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Subscription {
    /// <p>The Amazon Resource Name (ARN) that uniquely identifies this subscription.</p>
    pub arn: ::std::string::String,
    /// <p>The pricing plan family for the subscription, such as <code>CloudFront</code>.</p>
    pub plan_family: ::std::string::String,
    /// <p>The current tier level of the pricing plan, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
    pub plan_tier: ::std::string::String,
    /// <p>The usage level within the plan tier. When present, indicates a specific capacity configuration beyond the base tier.</p>
    pub usage_level: ::std::option::Option<::std::string::String>,
    /// <p>A pending change that will take effect at the end of the current billing period. This field is present only when a downgrade or cancellation is scheduled.</p>
    pub scheduled_change: ::std::option::Option<crate::types::ScheduledChange>,
    /// <p>The current status of the subscription. For the list of possible values, see the <code>Status</code> type.</p>
    pub status: crate::types::Status,
    /// <p>A human-readable explanation of the current status, present when additional context is available.</p>
    pub status_reason: ::std::option::Option<::std::string::String>,
    /// <p>The ARNs of the AWS resources covered by this subscription.</p>
    pub resource_arns: ::std::vec::Vec<::std::string::String>,
    /// <p>The date and time when the subscription was created, in ISO 8601 format.</p>
    pub created_at: ::aws_smithy_types::DateTime,
    /// <p>The date and time when the subscription was last modified, in ISO 8601 format.</p>
    pub updated_at: ::aws_smithy_types::DateTime,
}
impl Subscription {
    /// <p>The Amazon Resource Name (ARN) that uniquely identifies this subscription.</p>
    pub fn arn(&self) -> &str {
        use std::ops::Deref;
        self.arn.deref()
    }
    /// <p>The pricing plan family for the subscription, such as <code>CloudFront</code>.</p>
    pub fn plan_family(&self) -> &str {
        use std::ops::Deref;
        self.plan_family.deref()
    }
    /// <p>The current tier level of the pricing plan, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
    pub fn plan_tier(&self) -> &str {
        use std::ops::Deref;
        self.plan_tier.deref()
    }
    /// <p>The usage level within the plan tier. When present, indicates a specific capacity configuration beyond the base tier.</p>
    pub fn usage_level(&self) -> ::std::option::Option<&str> {
        self.usage_level.as_deref()
    }
    /// <p>A pending change that will take effect at the end of the current billing period. This field is present only when a downgrade or cancellation is scheduled.</p>
    pub fn scheduled_change(&self) -> ::std::option::Option<&crate::types::ScheduledChange> {
        self.scheduled_change.as_ref()
    }
    /// <p>The current status of the subscription. For the list of possible values, see the <code>Status</code> type.</p>
    pub fn status(&self) -> &crate::types::Status {
        &self.status
    }
    /// <p>A human-readable explanation of the current status, present when additional context is available.</p>
    pub fn status_reason(&self) -> ::std::option::Option<&str> {
        self.status_reason.as_deref()
    }
    /// <p>The ARNs of the AWS resources covered by this subscription.</p>
    pub fn resource_arns(&self) -> &[::std::string::String] {
        use std::ops::Deref;
        self.resource_arns.deref()
    }
    /// <p>The date and time when the subscription was created, in ISO 8601 format.</p>
    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
        &self.created_at
    }
    /// <p>The date and time when the subscription was last modified, in ISO 8601 format.</p>
    pub fn updated_at(&self) -> &::aws_smithy_types::DateTime {
        &self.updated_at
    }
}
impl Subscription {
    /// Creates a new builder-style object to manufacture [`Subscription`](crate::types::Subscription).
    pub fn builder() -> crate::types::builders::SubscriptionBuilder {
        crate::types::builders::SubscriptionBuilder::default()
    }
}

/// A builder for [`Subscription`](crate::types::Subscription).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SubscriptionBuilder {
    pub(crate) arn: ::std::option::Option<::std::string::String>,
    pub(crate) plan_family: ::std::option::Option<::std::string::String>,
    pub(crate) plan_tier: ::std::option::Option<::std::string::String>,
    pub(crate) usage_level: ::std::option::Option<::std::string::String>,
    pub(crate) scheduled_change: ::std::option::Option<crate::types::ScheduledChange>,
    pub(crate) status: ::std::option::Option<crate::types::Status>,
    pub(crate) status_reason: ::std::option::Option<::std::string::String>,
    pub(crate) resource_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl SubscriptionBuilder {
    /// <p>The Amazon Resource Name (ARN) that uniquely identifies this subscription.</p>
    /// This field is required.
    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) that uniquely identifies this subscription.</p>
    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.arn = input;
        self
    }
    /// <p>The Amazon Resource Name (ARN) that uniquely identifies this subscription.</p>
    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.arn
    }
    /// <p>The pricing plan family for the subscription, such as <code>CloudFront</code>.</p>
    /// This field is required.
    pub fn plan_family(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.plan_family = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The pricing plan family for the subscription, such as <code>CloudFront</code>.</p>
    pub fn set_plan_family(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.plan_family = input;
        self
    }
    /// <p>The pricing plan family for the subscription, such as <code>CloudFront</code>.</p>
    pub fn get_plan_family(&self) -> &::std::option::Option<::std::string::String> {
        &self.plan_family
    }
    /// <p>The current tier level of the pricing plan, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
    /// This field is required.
    pub fn plan_tier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.plan_tier = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The current tier level of the pricing plan, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
    pub fn set_plan_tier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.plan_tier = input;
        self
    }
    /// <p>The current tier level of the pricing plan, such as <code>FREE</code>, <code>PRO</code>, <code>BUSINESS</code>, or <code>PREMIUM</code>.</p>
    pub fn get_plan_tier(&self) -> &::std::option::Option<::std::string::String> {
        &self.plan_tier
    }
    /// <p>The usage level within the plan tier. When present, indicates a specific capacity configuration beyond the base tier.</p>
    pub fn usage_level(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.usage_level = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The usage level within the plan tier. When present, indicates a specific capacity configuration beyond the base tier.</p>
    pub fn set_usage_level(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.usage_level = input;
        self
    }
    /// <p>The usage level within the plan tier. When present, indicates a specific capacity configuration beyond the base tier.</p>
    pub fn get_usage_level(&self) -> &::std::option::Option<::std::string::String> {
        &self.usage_level
    }
    /// <p>A pending change that will take effect at the end of the current billing period. This field is present only when a downgrade or cancellation is scheduled.</p>
    pub fn scheduled_change(mut self, input: crate::types::ScheduledChange) -> Self {
        self.scheduled_change = ::std::option::Option::Some(input);
        self
    }
    /// <p>A pending change that will take effect at the end of the current billing period. This field is present only when a downgrade or cancellation is scheduled.</p>
    pub fn set_scheduled_change(mut self, input: ::std::option::Option<crate::types::ScheduledChange>) -> Self {
        self.scheduled_change = input;
        self
    }
    /// <p>A pending change that will take effect at the end of the current billing period. This field is present only when a downgrade or cancellation is scheduled.</p>
    pub fn get_scheduled_change(&self) -> &::std::option::Option<crate::types::ScheduledChange> {
        &self.scheduled_change
    }
    /// <p>The current status of the subscription. For the list of possible values, see the <code>Status</code> type.</p>
    /// This field is required.
    pub fn status(mut self, input: crate::types::Status) -> Self {
        self.status = ::std::option::Option::Some(input);
        self
    }
    /// <p>The current status of the subscription. For the list of possible values, see the <code>Status</code> type.</p>
    pub fn set_status(mut self, input: ::std::option::Option<crate::types::Status>) -> Self {
        self.status = input;
        self
    }
    /// <p>The current status of the subscription. For the list of possible values, see the <code>Status</code> type.</p>
    pub fn get_status(&self) -> &::std::option::Option<crate::types::Status> {
        &self.status
    }
    /// <p>A human-readable explanation of the current status, present when additional context is available.</p>
    pub fn status_reason(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.status_reason = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A human-readable explanation of the current status, present when additional context is available.</p>
    pub fn set_status_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.status_reason = input;
        self
    }
    /// <p>A human-readable explanation of the current status, present when additional context is available.</p>
    pub fn get_status_reason(&self) -> &::std::option::Option<::std::string::String> {
        &self.status_reason
    }
    /// Appends an item to `resource_arns`.
    ///
    /// To override the contents of this collection use [`set_resource_arns`](Self::set_resource_arns).
    ///
    /// <p>The ARNs of the AWS resources covered by this subscription.</p>
    pub fn resource_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.resource_arns.unwrap_or_default();
        v.push(input.into());
        self.resource_arns = ::std::option::Option::Some(v);
        self
    }
    /// <p>The ARNs of the AWS resources covered by this subscription.</p>
    pub fn set_resource_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.resource_arns = input;
        self
    }
    /// <p>The ARNs of the AWS resources covered by this subscription.</p>
    pub fn get_resource_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.resource_arns
    }
    /// <p>The date and time when the subscription was created, in ISO 8601 format.</p>
    /// This field is required.
    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.created_at = ::std::option::Option::Some(input);
        self
    }
    /// <p>The date and time when the subscription was created, in ISO 8601 format.</p>
    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.created_at = input;
        self
    }
    /// <p>The date and time when the subscription was created, in ISO 8601 format.</p>
    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.created_at
    }
    /// <p>The date and time when the subscription was last modified, in ISO 8601 format.</p>
    /// This field is required.
    pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.updated_at = ::std::option::Option::Some(input);
        self
    }
    /// <p>The date and time when the subscription was last modified, in ISO 8601 format.</p>
    pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.updated_at = input;
        self
    }
    /// <p>The date and time when the subscription was last modified, in ISO 8601 format.</p>
    pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.updated_at
    }
    /// Consumes the builder and constructs a [`Subscription`](crate::types::Subscription).
    /// This method will fail if any of the following fields are not set:
    /// - [`arn`](crate::types::builders::SubscriptionBuilder::arn)
    /// - [`plan_family`](crate::types::builders::SubscriptionBuilder::plan_family)
    /// - [`plan_tier`](crate::types::builders::SubscriptionBuilder::plan_tier)
    /// - [`status`](crate::types::builders::SubscriptionBuilder::status)
    /// - [`resource_arns`](crate::types::builders::SubscriptionBuilder::resource_arns)
    /// - [`created_at`](crate::types::builders::SubscriptionBuilder::created_at)
    /// - [`updated_at`](crate::types::builders::SubscriptionBuilder::updated_at)
    pub fn build(self) -> ::std::result::Result<crate::types::Subscription, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Subscription {
            arn: self.arn.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "arn",
                    "arn was not specified but it is required when building Subscription",
                )
            })?,
            plan_family: self.plan_family.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "plan_family",
                    "plan_family was not specified but it is required when building Subscription",
                )
            })?,
            plan_tier: self.plan_tier.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "plan_tier",
                    "plan_tier was not specified but it is required when building Subscription",
                )
            })?,
            usage_level: self.usage_level,
            scheduled_change: self.scheduled_change,
            status: self.status.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "status",
                    "status was not specified but it is required when building Subscription",
                )
            })?,
            status_reason: self.status_reason,
            resource_arns: self.resource_arns.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "resource_arns",
                    "resource_arns was not specified but it is required when building Subscription",
                )
            })?,
            created_at: self.created_at.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "created_at",
                    "created_at was not specified but it is required when building Subscription",
                )
            })?,
            updated_at: self.updated_at.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "updated_at",
                    "updated_at was not specified but it is required when building Subscription",
                )
            })?,
        })
    }
}