1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// 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()
}
}