aws-sdk-appmonetization 1.0.0

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

/// Output for CancelSubscription.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CancelSubscriptionOutput {
    /// The subscription as it stands after the cancellation is scheduled.
    pub subscription: ::std::option::Option<crate::types::Subscription>,
    /// The time when the cancellation takes effect, at the end of the current billing period. The subscription remains active until this time.
    pub cancellation_effective_at: ::aws_smithy_types::DateTime,
    _request_id: Option<String>,
}
impl CancelSubscriptionOutput {
    /// The subscription as it stands after the cancellation is scheduled.
    pub fn subscription(&self) -> ::std::option::Option<&crate::types::Subscription> {
        self.subscription.as_ref()
    }
    /// The time when the cancellation takes effect, at the end of the current billing period. The subscription remains active until this time.
    pub fn cancellation_effective_at(&self) -> &::aws_smithy_types::DateTime {
        &self.cancellation_effective_at
    }
}
impl ::aws_types::request_id::RequestId for CancelSubscriptionOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl CancelSubscriptionOutput {
    /// Creates a new builder-style object to manufacture [`CancelSubscriptionOutput`](crate::operation::cancel_subscription::CancelSubscriptionOutput).
    pub fn builder() -> crate::operation::cancel_subscription::builders::CancelSubscriptionOutputBuilder {
        crate::operation::cancel_subscription::builders::CancelSubscriptionOutputBuilder::default()
    }
}

/// A builder for [`CancelSubscriptionOutput`](crate::operation::cancel_subscription::CancelSubscriptionOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CancelSubscriptionOutputBuilder {
    pub(crate) subscription: ::std::option::Option<crate::types::Subscription>,
    pub(crate) cancellation_effective_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    _request_id: Option<String>,
}
impl CancelSubscriptionOutputBuilder {
    /// The subscription as it stands after the cancellation is scheduled.
    /// This field is required.
    pub fn subscription(mut self, input: crate::types::Subscription) -> Self {
        self.subscription = ::std::option::Option::Some(input);
        self
    }
    /// The subscription as it stands after the cancellation is scheduled.
    pub fn set_subscription(mut self, input: ::std::option::Option<crate::types::Subscription>) -> Self {
        self.subscription = input;
        self
    }
    /// The subscription as it stands after the cancellation is scheduled.
    pub fn get_subscription(&self) -> &::std::option::Option<crate::types::Subscription> {
        &self.subscription
    }
    /// The time when the cancellation takes effect, at the end of the current billing period. The subscription remains active until this time.
    /// This field is required.
    pub fn cancellation_effective_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.cancellation_effective_at = ::std::option::Option::Some(input);
        self
    }
    /// The time when the cancellation takes effect, at the end of the current billing period. The subscription remains active until this time.
    pub fn set_cancellation_effective_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.cancellation_effective_at = input;
        self
    }
    /// The time when the cancellation takes effect, at the end of the current billing period. The subscription remains active until this time.
    pub fn get_cancellation_effective_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.cancellation_effective_at
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`CancelSubscriptionOutput`](crate::operation::cancel_subscription::CancelSubscriptionOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`cancellation_effective_at`](crate::operation::cancel_subscription::builders::CancelSubscriptionOutputBuilder::cancellation_effective_at)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::cancel_subscription::CancelSubscriptionOutput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::cancel_subscription::CancelSubscriptionOutput {
            subscription: self.subscription,
            cancellation_effective_at: self.cancellation_effective_at.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "cancellation_effective_at",
                    "cancellation_effective_at was not specified but it is required when building CancelSubscriptionOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}