aws_sdk_databasemigration/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 DMS event notification subscription.</p>
26/// <p>You can specify the type of source (<code>SourceType</code>) you want to be notified of, provide a list of DMS source IDs (<code>SourceIds</code>) that triggers the events, and provide a list of event categories (<code>EventCategories</code>) for events you want to be notified of. If you specify both the <code>SourceType</code> and <code>SourceIds</code>, such as <code>SourceType = replication-instance</code> and <code>SourceIdentifier = my-replinstance</code>, you will be notified of all the replication instance events for the specified source. If you specify a <code>SourceType</code> but don't specify a <code>SourceIdentifier</code>, you receive notice of the events for that source type for all your DMS sources. If you don't specify either <code>SourceType</code> nor <code>SourceIdentifier</code>, you will be notified of events generated from all DMS sources belonging to your customer account.</p>
27/// <p>For more information about DMS events, see <a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html">Working with Events and Notifications</a> in the <i>Database Migration Service User Guide.</i></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 DMS event notification subscription. This name must be less than 255 characters.</p>
114    pub fn subscription_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.inner = self.inner.subscription_name(input.into());
116        self
117    }
118    /// <p>The name of the DMS event notification subscription. This name must be less than 255 characters.</p>
119    pub fn set_subscription_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_subscription_name(input);
121        self
122    }
123    /// <p>The name of the DMS event notification subscription. This name must be less than 255 characters.</p>
124    pub fn get_subscription_name(&self) -> &::std::option::Option<::std::string::String> {
125        self.inner.get_subscription_name()
126    }
127    /// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.</p>
128    pub fn sns_topic_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.inner = self.inner.sns_topic_arn(input.into());
130        self
131    }
132    /// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.</p>
133    pub fn set_sns_topic_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.inner = self.inner.set_sns_topic_arn(input);
135        self
136    }
137    /// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.</p>
138    pub fn get_sns_topic_arn(&self) -> &::std::option::Option<::std::string::String> {
139        self.inner.get_sns_topic_arn()
140    }
141    /// <p>The type of DMS resource that generates the events. For example, if you want to be notified of events generated by a replication instance, you set this parameter to <code>replication-instance</code>. If this value isn't specified, all events are returned.</p>
142    /// <p>Valid values: <code>replication-instance</code> | <code>replication-task</code></p>
143    pub fn source_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144        self.inner = self.inner.source_type(input.into());
145        self
146    }
147    /// <p>The type of DMS resource that generates the events. For example, if you want to be notified of events generated by a replication instance, you set this parameter to <code>replication-instance</code>. If this value isn't specified, all events are returned.</p>
148    /// <p>Valid values: <code>replication-instance</code> | <code>replication-task</code></p>
149    pub fn set_source_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_source_type(input);
151        self
152    }
153    /// <p>The type of DMS resource that generates the events. For example, if you want to be notified of events generated by a replication instance, you set this parameter to <code>replication-instance</code>. If this value isn't specified, all events are returned.</p>
154    /// <p>Valid values: <code>replication-instance</code> | <code>replication-task</code></p>
155    pub fn get_source_type(&self) -> &::std::option::Option<::std::string::String> {
156        self.inner.get_source_type()
157    }
158    ///
159    /// Appends an item to `EventCategories`.
160    ///
161    /// To override the contents of this collection use [`set_event_categories`](Self::set_event_categories).
162    ///
163    /// <p>A list of event categories for a source type that you want to subscribe to. For more information, see <a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html">Working with Events and Notifications</a> in the <i>Database Migration Service User Guide.</i></p>
164    pub fn event_categories(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
165        self.inner = self.inner.event_categories(input.into());
166        self
167    }
168    /// <p>A list of event categories for a source type that you want to subscribe to. For more information, see <a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html">Working with Events and Notifications</a> in the <i>Database Migration Service User Guide.</i></p>
169    pub fn set_event_categories(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
170        self.inner = self.inner.set_event_categories(input);
171        self
172    }
173    /// <p>A list of event categories for a source type that you want to subscribe to. For more information, see <a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html">Working with Events and Notifications</a> in the <i>Database Migration Service User Guide.</i></p>
174    pub fn get_event_categories(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
175        self.inner.get_event_categories()
176    }
177    ///
178    /// Appends an item to `SourceIds`.
179    ///
180    /// To override the contents of this collection use [`set_source_ids`](Self::set_source_ids).
181    ///
182    /// <p>A list of identifiers for which DMS provides notification events.</p>
183    /// <p>If you don't specify a value, notifications are provided for all sources.</p>
184    /// <p>If you specify multiple values, they must be of the same type. For example, if you specify a database instance ID, then all of the other values must be database instance IDs.</p>
185    pub fn source_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186        self.inner = self.inner.source_ids(input.into());
187        self
188    }
189    /// <p>A list of identifiers for which DMS provides notification events.</p>
190    /// <p>If you don't specify a value, notifications are provided for all sources.</p>
191    /// <p>If you specify multiple values, they must be of the same type. For example, if you specify a database instance ID, then all of the other values must be database instance IDs.</p>
192    pub fn set_source_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
193        self.inner = self.inner.set_source_ids(input);
194        self
195    }
196    /// <p>A list of identifiers for which DMS provides notification events.</p>
197    /// <p>If you don't specify a value, notifications are provided for all sources.</p>
198    /// <p>If you specify multiple values, they must be of the same type. For example, if you specify a database instance ID, then all of the other values must be database instance IDs.</p>
199    pub fn get_source_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
200        self.inner.get_source_ids()
201    }
202    /// <p>A Boolean value; set to <code>true</code> to activate the subscription, or set to <code>false</code> to create the subscription but not activate it.</p>
203    pub fn enabled(mut self, input: bool) -> Self {
204        self.inner = self.inner.enabled(input);
205        self
206    }
207    /// <p>A Boolean value; set to <code>true</code> to activate the subscription, or set to <code>false</code> to create the subscription but not activate it.</p>
208    pub fn set_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
209        self.inner = self.inner.set_enabled(input);
210        self
211    }
212    /// <p>A Boolean value; set to <code>true</code> to activate the subscription, or set to <code>false</code> to create the subscription but not activate it.</p>
213    pub fn get_enabled(&self) -> &::std::option::Option<bool> {
214        self.inner.get_enabled()
215    }
216    ///
217    /// Appends an item to `Tags`.
218    ///
219    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
220    ///
221    /// <p>One or more tags to be assigned to the event subscription.</p>
222    pub fn tags(mut self, input: crate::types::Tag) -> Self {
223        self.inner = self.inner.tags(input);
224        self
225    }
226    /// <p>One or more tags to be assigned to the event subscription.</p>
227    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
228        self.inner = self.inner.set_tags(input);
229        self
230    }
231    /// <p>One or more tags to be assigned to the event subscription.</p>
232    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
233        self.inner.get_tags()
234    }
235}