aws_sdk_budgets/operation/create_notification/
_create_notification_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Request of CreateNotification</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateNotificationInput {
7    /// <p>The <code>accountId</code> that is associated with the budget that you want to create a notification for.</p>
8    pub account_id: ::std::option::Option<::std::string::String>,
9    /// <p>The name of the budget that you want Amazon Web Services to notify you about. Budget names must be unique within an account.</p>
10    pub budget_name: ::std::option::Option<::std::string::String>,
11    /// <p>The notification that you want to create.</p>
12    pub notification: ::std::option::Option<crate::types::Notification>,
13    /// <p>A list of subscribers that you want to associate with the notification. Each notification can have one SNS subscriber and up to 10 email subscribers.</p>
14    pub subscribers: ::std::option::Option<::std::vec::Vec<crate::types::Subscriber>>,
15}
16impl CreateNotificationInput {
17    /// <p>The <code>accountId</code> that is associated with the budget that you want to create a notification for.</p>
18    pub fn account_id(&self) -> ::std::option::Option<&str> {
19        self.account_id.as_deref()
20    }
21    /// <p>The name of the budget that you want Amazon Web Services to notify you about. Budget names must be unique within an account.</p>
22    pub fn budget_name(&self) -> ::std::option::Option<&str> {
23        self.budget_name.as_deref()
24    }
25    /// <p>The notification that you want to create.</p>
26    pub fn notification(&self) -> ::std::option::Option<&crate::types::Notification> {
27        self.notification.as_ref()
28    }
29    /// <p>A list of subscribers that you want to associate with the notification. Each notification can have one SNS subscriber and up to 10 email subscribers.</p>
30    ///
31    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.subscribers.is_none()`.
32    pub fn subscribers(&self) -> &[crate::types::Subscriber] {
33        self.subscribers.as_deref().unwrap_or_default()
34    }
35}
36impl CreateNotificationInput {
37    /// Creates a new builder-style object to manufacture [`CreateNotificationInput`](crate::operation::create_notification::CreateNotificationInput).
38    pub fn builder() -> crate::operation::create_notification::builders::CreateNotificationInputBuilder {
39        crate::operation::create_notification::builders::CreateNotificationInputBuilder::default()
40    }
41}
42
43/// A builder for [`CreateNotificationInput`](crate::operation::create_notification::CreateNotificationInput).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
45#[non_exhaustive]
46pub struct CreateNotificationInputBuilder {
47    pub(crate) account_id: ::std::option::Option<::std::string::String>,
48    pub(crate) budget_name: ::std::option::Option<::std::string::String>,
49    pub(crate) notification: ::std::option::Option<crate::types::Notification>,
50    pub(crate) subscribers: ::std::option::Option<::std::vec::Vec<crate::types::Subscriber>>,
51}
52impl CreateNotificationInputBuilder {
53    /// <p>The <code>accountId</code> that is associated with the budget that you want to create a notification for.</p>
54    /// This field is required.
55    pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        self.account_id = ::std::option::Option::Some(input.into());
57        self
58    }
59    /// <p>The <code>accountId</code> that is associated with the budget that you want to create a notification for.</p>
60    pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
61        self.account_id = input;
62        self
63    }
64    /// <p>The <code>accountId</code> that is associated with the budget that you want to create a notification for.</p>
65    pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
66        &self.account_id
67    }
68    /// <p>The name of the budget that you want Amazon Web Services to notify you about. Budget names must be unique within an account.</p>
69    /// This field is required.
70    pub fn budget_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71        self.budget_name = ::std::option::Option::Some(input.into());
72        self
73    }
74    /// <p>The name of the budget that you want Amazon Web Services to notify you about. Budget names must be unique within an account.</p>
75    pub fn set_budget_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76        self.budget_name = input;
77        self
78    }
79    /// <p>The name of the budget that you want Amazon Web Services to notify you about. Budget names must be unique within an account.</p>
80    pub fn get_budget_name(&self) -> &::std::option::Option<::std::string::String> {
81        &self.budget_name
82    }
83    /// <p>The notification that you want to create.</p>
84    /// This field is required.
85    pub fn notification(mut self, input: crate::types::Notification) -> Self {
86        self.notification = ::std::option::Option::Some(input);
87        self
88    }
89    /// <p>The notification that you want to create.</p>
90    pub fn set_notification(mut self, input: ::std::option::Option<crate::types::Notification>) -> Self {
91        self.notification = input;
92        self
93    }
94    /// <p>The notification that you want to create.</p>
95    pub fn get_notification(&self) -> &::std::option::Option<crate::types::Notification> {
96        &self.notification
97    }
98    /// Appends an item to `subscribers`.
99    ///
100    /// To override the contents of this collection use [`set_subscribers`](Self::set_subscribers).
101    ///
102    /// <p>A list of subscribers that you want to associate with the notification. Each notification can have one SNS subscriber and up to 10 email subscribers.</p>
103    pub fn subscribers(mut self, input: crate::types::Subscriber) -> Self {
104        let mut v = self.subscribers.unwrap_or_default();
105        v.push(input);
106        self.subscribers = ::std::option::Option::Some(v);
107        self
108    }
109    /// <p>A list of subscribers that you want to associate with the notification. Each notification can have one SNS subscriber and up to 10 email subscribers.</p>
110    pub fn set_subscribers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Subscriber>>) -> Self {
111        self.subscribers = input;
112        self
113    }
114    /// <p>A list of subscribers that you want to associate with the notification. Each notification can have one SNS subscriber and up to 10 email subscribers.</p>
115    pub fn get_subscribers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Subscriber>> {
116        &self.subscribers
117    }
118    /// Consumes the builder and constructs a [`CreateNotificationInput`](crate::operation::create_notification::CreateNotificationInput).
119    pub fn build(
120        self,
121    ) -> ::std::result::Result<crate::operation::create_notification::CreateNotificationInput, ::aws_smithy_types::error::operation::BuildError> {
122        ::std::result::Result::Ok(crate::operation::create_notification::CreateNotificationInput {
123            account_id: self.account_id,
124            budget_name: self.budget_name,
125            notification: self.notification,
126            subscribers: self.subscribers,
127        })
128    }
129}