aws-sdk-budgets 0.37.0

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

/// <p>The subscriber to a budget notification. The subscriber consists of a subscription type and either an Amazon SNS topic or an email address.</p>
/// <p>For example, an email subscriber has the following parameters:</p>
/// <ul>
/// <li> <p>A <code>subscriptionType</code> of <code>EMAIL</code> </p> </li>
/// <li> <p>An <code>address</code> of <code>example@example.com</code> </p> </li>
/// </ul>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Subscriber {
    /// <p>The type of notification that Amazon Web Services sends to a subscriber.</p>
    pub subscription_type: crate::types::SubscriptionType,
    /// <p>The address that Amazon Web Services sends budget notifications to, either an SNS topic or an email.</p>
    /// <p>When you create a subscriber, the value of <code>Address</code> can't contain line breaks.</p>
    pub address: ::std::string::String,
}
impl Subscriber {
    /// <p>The type of notification that Amazon Web Services sends to a subscriber.</p>
    pub fn subscription_type(&self) -> &crate::types::SubscriptionType {
        &self.subscription_type
    }
    /// <p>The address that Amazon Web Services sends budget notifications to, either an SNS topic or an email.</p>
    /// <p>When you create a subscriber, the value of <code>Address</code> can't contain line breaks.</p>
    pub fn address(&self) -> &str {
        use std::ops::Deref;
        self.address.deref()
    }
}
impl ::std::fmt::Debug for Subscriber {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("Subscriber");
        formatter.field("subscription_type", &self.subscription_type);
        formatter.field("address", &"*** Sensitive Data Redacted ***");
        formatter.finish()
    }
}
impl Subscriber {
    /// Creates a new builder-style object to manufacture [`Subscriber`](crate::types::Subscriber).
    pub fn builder() -> crate::types::builders::SubscriberBuilder {
        crate::types::builders::SubscriberBuilder::default()
    }
}

/// A builder for [`Subscriber`](crate::types::Subscriber).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
pub struct SubscriberBuilder {
    pub(crate) subscription_type: ::std::option::Option<crate::types::SubscriptionType>,
    pub(crate) address: ::std::option::Option<::std::string::String>,
}
impl SubscriberBuilder {
    /// <p>The type of notification that Amazon Web Services sends to a subscriber.</p>
    /// This field is required.
    pub fn subscription_type(mut self, input: crate::types::SubscriptionType) -> Self {
        self.subscription_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of notification that Amazon Web Services sends to a subscriber.</p>
    pub fn set_subscription_type(mut self, input: ::std::option::Option<crate::types::SubscriptionType>) -> Self {
        self.subscription_type = input;
        self
    }
    /// <p>The type of notification that Amazon Web Services sends to a subscriber.</p>
    pub fn get_subscription_type(&self) -> &::std::option::Option<crate::types::SubscriptionType> {
        &self.subscription_type
    }
    /// <p>The address that Amazon Web Services sends budget notifications to, either an SNS topic or an email.</p>
    /// <p>When you create a subscriber, the value of <code>Address</code> can't contain line breaks.</p>
    /// This field is required.
    pub fn address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.address = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The address that Amazon Web Services sends budget notifications to, either an SNS topic or an email.</p>
    /// <p>When you create a subscriber, the value of <code>Address</code> can't contain line breaks.</p>
    pub fn set_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.address = input;
        self
    }
    /// <p>The address that Amazon Web Services sends budget notifications to, either an SNS topic or an email.</p>
    /// <p>When you create a subscriber, the value of <code>Address</code> can't contain line breaks.</p>
    pub fn get_address(&self) -> &::std::option::Option<::std::string::String> {
        &self.address
    }
    /// Consumes the builder and constructs a [`Subscriber`](crate::types::Subscriber).
    /// This method will fail if any of the following fields are not set:
    /// - [`subscription_type`](crate::types::builders::SubscriberBuilder::subscription_type)
    /// - [`address`](crate::types::builders::SubscriberBuilder::address)
    pub fn build(self) -> ::std::result::Result<crate::types::Subscriber, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Subscriber {
            subscription_type: self.subscription_type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "subscription_type",
                    "subscription_type was not specified but it is required when building Subscriber",
                )
            })?,
            address: self.address.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "address",
                    "address was not specified but it is required when building Subscriber",
                )
            })?,
        })
    }
}
impl ::std::fmt::Debug for SubscriberBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("SubscriberBuilder");
        formatter.field("subscription_type", &self.subscription_type);
        formatter.field("address", &"*** Sensitive Data Redacted ***");
        formatter.finish()
    }
}