aws_sdk_redshift/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 Redshift event notification subscription. This action requires an ARN (Amazon Resource Name) of an Amazon SNS topic created by either the Amazon Redshift 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 SNS console.</p>
26/// <p>You can specify the source type, and lists of Amazon Redshift source IDs, event categories, and event severities. Notifications will be sent for all events you want that match those criteria. For example, you can specify source type = cluster, source ID = my-cluster-1 and mycluster2, event categories = Availability, Backup, and severity = ERROR. The subscription will only send notifications for those ERROR events in the Availability and Backup categories for the specified clusters.</p>
27/// <p>If you specify both the source type and source IDs, such as source type = cluster and source identifier = my-cluster-1, notifications will be sent for all the cluster events for my-cluster-1. If you specify a source type but do not specify a source identifier, you will receive notice of the events for the objects of that type in your Amazon Web Services account. If you do not specify either the SourceType nor the SourceIdentifier, you will be notified of events generated from all Amazon Redshift sources belonging to your Amazon Web Services account. You must specify a source type if you specify a source ID.</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 event subscription to be created.</p>
114    /// <p>Constraints:</p>
115    /// <ul>
116    /// <li>
117    /// <p>Cannot be null, empty, or blank.</p></li>
118    /// <li>
119    /// <p>Must contain from 1 to 255 alphanumeric characters or hyphens.</p></li>
120    /// <li>
121    /// <p>First character must be a letter.</p></li>
122    /// <li>
123    /// <p>Cannot end with a hyphen or contain two consecutive hyphens.</p></li>
124    /// </ul>
125    pub fn subscription_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126        self.inner = self.inner.subscription_name(input.into());
127        self
128    }
129    /// <p>The name of the event subscription to be created.</p>
130    /// <p>Constraints:</p>
131    /// <ul>
132    /// <li>
133    /// <p>Cannot be null, empty, or blank.</p></li>
134    /// <li>
135    /// <p>Must contain from 1 to 255 alphanumeric characters or hyphens.</p></li>
136    /// <li>
137    /// <p>First character must be a letter.</p></li>
138    /// <li>
139    /// <p>Cannot end with a hyphen or contain two consecutive hyphens.</p></li>
140    /// </ul>
141    pub fn set_subscription_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142        self.inner = self.inner.set_subscription_name(input);
143        self
144    }
145    /// <p>The name of the event subscription to be created.</p>
146    /// <p>Constraints:</p>
147    /// <ul>
148    /// <li>
149    /// <p>Cannot be null, empty, or blank.</p></li>
150    /// <li>
151    /// <p>Must contain from 1 to 255 alphanumeric characters or hyphens.</p></li>
152    /// <li>
153    /// <p>First character must be a letter.</p></li>
154    /// <li>
155    /// <p>Cannot end with a hyphen or contain two consecutive hyphens.</p></li>
156    /// </ul>
157    pub fn get_subscription_name(&self) -> &::std::option::Option<::std::string::String> {
158        self.inner.get_subscription_name()
159    }
160    /// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic used to transmit the event notifications. The ARN is created by Amazon SNS when you create a topic and subscribe to it.</p>
161    pub fn sns_topic_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162        self.inner = self.inner.sns_topic_arn(input.into());
163        self
164    }
165    /// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic used to transmit the event notifications. The ARN is created by Amazon SNS when you create a topic and subscribe to it.</p>
166    pub fn set_sns_topic_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167        self.inner = self.inner.set_sns_topic_arn(input);
168        self
169    }
170    /// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic used to transmit the event notifications. The ARN is created by Amazon SNS when you create a topic and subscribe to it.</p>
171    pub fn get_sns_topic_arn(&self) -> &::std::option::Option<::std::string::String> {
172        self.inner.get_sns_topic_arn()
173    }
174    /// <p>The type of source that will be generating the events. For example, if you want to be notified of events generated by a cluster, you would set this parameter to cluster. If this value is not specified, events are returned for all Amazon Redshift objects in your Amazon Web Services account. You must specify a source type in order to specify source IDs.</p>
175    /// <p>Valid values: cluster, cluster-parameter-group, cluster-security-group, cluster-snapshot, and scheduled-action.</p>
176    pub fn source_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177        self.inner = self.inner.source_type(input.into());
178        self
179    }
180    /// <p>The type of source that will be generating the events. For example, if you want to be notified of events generated by a cluster, you would set this parameter to cluster. If this value is not specified, events are returned for all Amazon Redshift objects in your Amazon Web Services account. You must specify a source type in order to specify source IDs.</p>
181    /// <p>Valid values: cluster, cluster-parameter-group, cluster-security-group, cluster-snapshot, and scheduled-action.</p>
182    pub fn set_source_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
183        self.inner = self.inner.set_source_type(input);
184        self
185    }
186    /// <p>The type of source that will be generating the events. For example, if you want to be notified of events generated by a cluster, you would set this parameter to cluster. If this value is not specified, events are returned for all Amazon Redshift objects in your Amazon Web Services account. You must specify a source type in order to specify source IDs.</p>
187    /// <p>Valid values: cluster, cluster-parameter-group, cluster-security-group, cluster-snapshot, and scheduled-action.</p>
188    pub fn get_source_type(&self) -> &::std::option::Option<::std::string::String> {
189        self.inner.get_source_type()
190    }
191    ///
192    /// Appends an item to `SourceIds`.
193    ///
194    /// To override the contents of this collection use [`set_source_ids`](Self::set_source_ids).
195    ///
196    /// <p>A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.</p>
197    /// <p>Example: my-cluster-1, my-cluster-2</p>
198    /// <p>Example: my-snapshot-20131010</p>
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>A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.</p>
204    /// <p>Example: my-cluster-1, my-cluster-2</p>
205    /// <p>Example: my-snapshot-20131010</p>
206    pub fn set_source_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
207        self.inner = self.inner.set_source_ids(input);
208        self
209    }
210    /// <p>A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.</p>
211    /// <p>Example: my-cluster-1, my-cluster-2</p>
212    /// <p>Example: my-snapshot-20131010</p>
213    pub fn get_source_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
214        self.inner.get_source_ids()
215    }
216    ///
217    /// Appends an item to `EventCategories`.
218    ///
219    /// To override the contents of this collection use [`set_event_categories`](Self::set_event_categories).
220    ///
221    /// <p>Specifies the Amazon Redshift event categories to be published by the event notification subscription.</p>
222    /// <p>Values: configuration, management, monitoring, security, pending</p>
223    pub fn event_categories(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
224        self.inner = self.inner.event_categories(input.into());
225        self
226    }
227    /// <p>Specifies the Amazon Redshift event categories to be published by the event notification subscription.</p>
228    /// <p>Values: configuration, management, monitoring, security, pending</p>
229    pub fn set_event_categories(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
230        self.inner = self.inner.set_event_categories(input);
231        self
232    }
233    /// <p>Specifies the Amazon Redshift event categories to be published by the event notification subscription.</p>
234    /// <p>Values: configuration, management, monitoring, security, pending</p>
235    pub fn get_event_categories(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
236        self.inner.get_event_categories()
237    }
238    /// <p>Specifies the Amazon Redshift event severity to be published by the event notification subscription.</p>
239    /// <p>Values: ERROR, INFO</p>
240    pub fn severity(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
241        self.inner = self.inner.severity(input.into());
242        self
243    }
244    /// <p>Specifies the Amazon Redshift event severity to be published by the event notification subscription.</p>
245    /// <p>Values: ERROR, INFO</p>
246    pub fn set_severity(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
247        self.inner = self.inner.set_severity(input);
248        self
249    }
250    /// <p>Specifies the Amazon Redshift event severity to be published by the event notification subscription.</p>
251    /// <p>Values: ERROR, INFO</p>
252    pub fn get_severity(&self) -> &::std::option::Option<::std::string::String> {
253        self.inner.get_severity()
254    }
255    /// <p>A boolean value; set to <code>true</code> to activate the subscription, and set to <code>false</code> to create the subscription but not activate it.</p>
256    pub fn enabled(mut self, input: bool) -> Self {
257        self.inner = self.inner.enabled(input);
258        self
259    }
260    /// <p>A boolean value; set to <code>true</code> to activate the subscription, and set to <code>false</code> to create the subscription but not activate it.</p>
261    pub fn set_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
262        self.inner = self.inner.set_enabled(input);
263        self
264    }
265    /// <p>A boolean value; set to <code>true</code> to activate the subscription, and set to <code>false</code> to create the subscription but not activate it.</p>
266    pub fn get_enabled(&self) -> &::std::option::Option<bool> {
267        self.inner.get_enabled()
268    }
269    ///
270    /// Appends an item to `Tags`.
271    ///
272    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
273    ///
274    /// <p>A list of tag instances.</p>
275    pub fn tags(mut self, input: crate::types::Tag) -> Self {
276        self.inner = self.inner.tags(input);
277        self
278    }
279    /// <p>A list of tag instances.</p>
280    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
281        self.inner = self.inner.set_tags(input);
282        self
283    }
284    /// <p>A list of tag instances.</p>
285    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
286        self.inner.get_tags()
287    }
288}