aws_sdk_docdb/operation/create_event_subscription/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_event_subscription::_create_event_subscription_output::CreateEventSubscriptionOutputBuilder;
3
4pub use crate::operation::create_event_subscription::_create_event_subscription_input::CreateEventSubscriptionInputBuilder;
5
6impl crate::operation::create_event_subscription::builders::CreateEventSubscriptionInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_event_subscription::CreateEventSubscriptionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_event_subscription::CreateEventSubscriptionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_event_subscription();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateEventSubscription`.
24///
25/// <p>Creates an Amazon DocumentDB event notification subscription. This action requires a topic Amazon Resource Name (ARN) created by using the Amazon DocumentDB console, the Amazon SNS console, or the Amazon SNS API. To obtain an ARN with Amazon SNS, you must create a topic in Amazon SNS and subscribe to the topic. The ARN is displayed in the Amazon SNS console.</p>
26/// <p>You can specify the type of source (<code>SourceType</code>) that you want to be notified of. You can also provide a list of Amazon DocumentDB sources (<code>SourceIds</code>) that trigger the events, and you can provide a list of event categories (<code>EventCategories</code>) for events that you want to be notified of. For example, you can specify <code>SourceType = db-instance</code>, <code>SourceIds = mydbinstance1, mydbinstance2</code> and <code>EventCategories = Availability, Backup</code>.</p>
27/// <p>If you specify both the <code>SourceType</code> and <code>SourceIds</code> (such as <code>SourceType = db-instance</code> and <code>SourceIdentifier = myDBInstance1</code>), you are notified of all the <code>db-instance</code> events for the specified source. If you specify a <code>SourceType</code> but do not specify a <code>SourceIdentifier</code>, you receive notice of the events for that source type for all your Amazon DocumentDB sources. If you do not specify either the <code>SourceType</code> or the <code>SourceIdentifier</code>, you are notified of events generated from all Amazon DocumentDB sources belonging to your customer account.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct CreateEventSubscriptionFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::create_event_subscription::builders::CreateEventSubscriptionInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::create_event_subscription::CreateEventSubscriptionOutput,
37        crate::operation::create_event_subscription::CreateEventSubscriptionError,
38    > for CreateEventSubscriptionFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::create_event_subscription::CreateEventSubscriptionOutput,
46            crate::operation::create_event_subscription::CreateEventSubscriptionError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl CreateEventSubscriptionFluentBuilder {
53    /// Creates a new `CreateEventSubscriptionFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the CreateEventSubscription as a reference.
62    pub fn as_input(&self) -> &crate::operation::create_event_subscription::builders::CreateEventSubscriptionInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::create_event_subscription::CreateEventSubscriptionOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::create_event_subscription::CreateEventSubscriptionError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::create_event_subscription::CreateEventSubscription::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::create_event_subscription::CreateEventSubscription::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::create_event_subscription::CreateEventSubscriptionOutput,
99        crate::operation::create_event_subscription::CreateEventSubscriptionError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// <p>The name of the subscription.</p>
114    /// <p>Constraints: The name must be fewer than 255 characters.</p>
115    pub fn subscription_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.inner = self.inner.subscription_name(input.into());
117        self
118    }
119    /// <p>The name of the subscription.</p>
120    /// <p>Constraints: The name must be fewer than 255 characters.</p>
121    pub fn set_subscription_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_subscription_name(input);
123        self
124    }
125    /// <p>The name of the subscription.</p>
126    /// <p>Constraints: The name must be fewer than 255 characters.</p>
127    pub fn get_subscription_name(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_subscription_name()
129    }
130    /// <p>The Amazon Resource Name (ARN) of the SNS topic created for event notification. Amazon SNS creates the ARN when you create a topic and subscribe to it.</p>
131    pub fn sns_topic_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.inner = self.inner.sns_topic_arn(input.into());
133        self
134    }
135    /// <p>The Amazon Resource Name (ARN) of the SNS topic created for event notification. Amazon SNS creates the ARN when you create a topic and subscribe to it.</p>
136    pub fn set_sns_topic_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_sns_topic_arn(input);
138        self
139    }
140    /// <p>The Amazon Resource Name (ARN) of the SNS topic created for event notification. Amazon SNS creates the ARN when you create a topic and subscribe to it.</p>
141    pub fn get_sns_topic_arn(&self) -> &::std::option::Option<::std::string::String> {
142        self.inner.get_sns_topic_arn()
143    }
144    /// <p>The type of source that is generating the events. For example, if you want to be notified of events generated by an instance, you would set this parameter to <code>db-instance</code>. If this value is not specified, all events are returned.</p>
145    /// <p>Valid values: <code>db-instance</code>, <code>db-cluster</code>, <code>db-parameter-group</code>, <code>db-security-group</code>, <code>db-cluster-snapshot</code></p>
146    pub fn source_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.source_type(input.into());
148        self
149    }
150    /// <p>The type of source that is generating the events. For example, if you want to be notified of events generated by an instance, you would set this parameter to <code>db-instance</code>. If this value is not specified, all events are returned.</p>
151    /// <p>Valid values: <code>db-instance</code>, <code>db-cluster</code>, <code>db-parameter-group</code>, <code>db-security-group</code>, <code>db-cluster-snapshot</code></p>
152    pub fn set_source_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153        self.inner = self.inner.set_source_type(input);
154        self
155    }
156    /// <p>The type of source that is generating the events. For example, if you want to be notified of events generated by an instance, you would set this parameter to <code>db-instance</code>. If this value is not specified, all events are returned.</p>
157    /// <p>Valid values: <code>db-instance</code>, <code>db-cluster</code>, <code>db-parameter-group</code>, <code>db-security-group</code>, <code>db-cluster-snapshot</code></p>
158    pub fn get_source_type(&self) -> &::std::option::Option<::std::string::String> {
159        self.inner.get_source_type()
160    }
161    ///
162    /// Appends an item to `EventCategories`.
163    ///
164    /// To override the contents of this collection use [`set_event_categories`](Self::set_event_categories).
165    ///
166    /// <p>A list of event categories for a <code>SourceType</code> that you want to subscribe to.</p>
167    pub fn event_categories(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
168        self.inner = self.inner.event_categories(input.into());
169        self
170    }
171    /// <p>A list of event categories for a <code>SourceType</code> that you want to subscribe to.</p>
172    pub fn set_event_categories(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
173        self.inner = self.inner.set_event_categories(input);
174        self
175    }
176    /// <p>A list of event categories for a <code>SourceType</code> that you want to subscribe to.</p>
177    pub fn get_event_categories(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
178        self.inner.get_event_categories()
179    }
180    ///
181    /// Appends an item to `SourceIds`.
182    ///
183    /// To override the contents of this collection use [`set_source_ids`](Self::set_source_ids).
184    ///
185    /// <p>The list of identifiers of the event sources for which events are returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.</p>
186    /// <p>Constraints:</p>
187    /// <ul>
188    /// <li>
189    /// <p>If <code>SourceIds</code> are provided, <code>SourceType</code> must also be provided.</p></li>
190    /// <li>
191    /// <p>If the source type is an instance, a <code>DBInstanceIdentifier</code> must be provided.</p></li>
192    /// <li>
193    /// <p>If the source type is a security group, a <code>DBSecurityGroupName</code> must be provided.</p></li>
194    /// <li>
195    /// <p>If the source type is a parameter group, a <code>DBParameterGroupName</code> must be provided.</p></li>
196    /// <li>
197    /// <p>If the source type is a snapshot, a <code>DBSnapshotIdentifier</code> must be provided.</p></li>
198    /// </ul>
199    pub fn source_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
200        self.inner = self.inner.source_ids(input.into());
201        self
202    }
203    /// <p>The list of identifiers of the event sources for which events are returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.</p>
204    /// <p>Constraints:</p>
205    /// <ul>
206    /// <li>
207    /// <p>If <code>SourceIds</code> are provided, <code>SourceType</code> must also be provided.</p></li>
208    /// <li>
209    /// <p>If the source type is an instance, a <code>DBInstanceIdentifier</code> must be provided.</p></li>
210    /// <li>
211    /// <p>If the source type is a security group, a <code>DBSecurityGroupName</code> must be provided.</p></li>
212    /// <li>
213    /// <p>If the source type is a parameter group, a <code>DBParameterGroupName</code> must be provided.</p></li>
214    /// <li>
215    /// <p>If the source type is a snapshot, a <code>DBSnapshotIdentifier</code> must be provided.</p></li>
216    /// </ul>
217    pub fn set_source_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
218        self.inner = self.inner.set_source_ids(input);
219        self
220    }
221    /// <p>The list of identifiers of the event sources for which events are returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.</p>
222    /// <p>Constraints:</p>
223    /// <ul>
224    /// <li>
225    /// <p>If <code>SourceIds</code> are provided, <code>SourceType</code> must also be provided.</p></li>
226    /// <li>
227    /// <p>If the source type is an instance, a <code>DBInstanceIdentifier</code> must be provided.</p></li>
228    /// <li>
229    /// <p>If the source type is a security group, a <code>DBSecurityGroupName</code> must be provided.</p></li>
230    /// <li>
231    /// <p>If the source type is a parameter group, a <code>DBParameterGroupName</code> must be provided.</p></li>
232    /// <li>
233    /// <p>If the source type is a snapshot, a <code>DBSnapshotIdentifier</code> must be provided.</p></li>
234    /// </ul>
235    pub fn get_source_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
236        self.inner.get_source_ids()
237    }
238    /// <p>A Boolean value; set to <code>true</code> to activate the subscription, set to <code>false</code> to create the subscription but not active it.</p>
239    pub fn enabled(mut self, input: bool) -> Self {
240        self.inner = self.inner.enabled(input);
241        self
242    }
243    /// <p>A Boolean value; set to <code>true</code> to activate the subscription, set to <code>false</code> to create the subscription but not active it.</p>
244    pub fn set_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
245        self.inner = self.inner.set_enabled(input);
246        self
247    }
248    /// <p>A Boolean value; set to <code>true</code> to activate the subscription, set to <code>false</code> to create the subscription but not active it.</p>
249    pub fn get_enabled(&self) -> &::std::option::Option<bool> {
250        self.inner.get_enabled()
251    }
252    ///
253    /// Appends an item to `Tags`.
254    ///
255    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
256    ///
257    /// <p>The tags to be assigned to the event subscription.</p>
258    pub fn tags(mut self, input: crate::types::Tag) -> Self {
259        self.inner = self.inner.tags(input);
260        self
261    }
262    /// <p>The tags to be assigned to the event subscription.</p>
263    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
264        self.inner = self.inner.set_tags(input);
265        self
266    }
267    /// <p>The tags to be assigned to the event subscription.</p>
268    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
269        self.inner.get_tags()
270    }
271}