Skip to main content

aws_sdk_dsql/operation/create_stream/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_stream::_create_stream_input::CreateStreamInputBuilder;
3
4pub use crate::operation::create_stream::_create_stream_output::CreateStreamOutputBuilder;
5
6impl crate::operation::create_stream::builders::CreateStreamInputBuilder {
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_stream::CreateStreamOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_stream::CreateStreamError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_stream();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateStream`.
24///
25/// <p>Creates a new change data capture (CDC) stream for a cluster. The stream captures database changes and delivers them to the specified target destination.</p>
26/// <p><b>Required permissions</b></p>
27/// <dl>
28/// <dt>
29/// dsql:CreateStream
30/// </dt>
31/// <dd>
32/// <p>Permission to create a new stream.</p>
33/// <p>Resources: <code>arn:aws:dsql:region:account-id:cluster/cluster-id</code></p>
34/// </dd>
35/// <dt>
36/// iam:PassRole
37/// </dt>
38/// <dd>
39/// <p>Permission to pass the IAM role specified in the target definition to the service.</p>
40/// <p>Resources: ARN of the IAM role specified in <code>targetDefinition.kinesis.roleArn</code></p>
41/// </dd>
42/// <dt>
43/// kms:Decrypt
44/// </dt>
45/// <dd>
46/// <p>Required when the cluster uses a customer managed KMS key (CMK). Permission to decrypt data using the cluster's CMK.</p>
47/// <p>Resources: ARN of the KMS key used by the cluster</p>
48/// </dd>
49/// </dl>
50#[derive(::std::clone::Clone, ::std::fmt::Debug)]
51pub struct CreateStreamFluentBuilder {
52    handle: ::std::sync::Arc<crate::client::Handle>,
53    inner: crate::operation::create_stream::builders::CreateStreamInputBuilder,
54    config_override: ::std::option::Option<crate::config::Builder>,
55}
56impl
57    crate::client::customize::internal::CustomizableSend<
58        crate::operation::create_stream::CreateStreamOutput,
59        crate::operation::create_stream::CreateStreamError,
60    > for CreateStreamFluentBuilder
61{
62    fn send(
63        self,
64        config_override: crate::config::Builder,
65    ) -> crate::client::customize::internal::BoxFuture<
66        crate::client::customize::internal::SendResult<
67            crate::operation::create_stream::CreateStreamOutput,
68            crate::operation::create_stream::CreateStreamError,
69        >,
70    > {
71        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
72    }
73}
74impl CreateStreamFluentBuilder {
75    /// Creates a new `CreateStreamFluentBuilder`.
76    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
77        Self {
78            handle,
79            inner: ::std::default::Default::default(),
80            config_override: ::std::option::Option::None,
81        }
82    }
83    /// Access the CreateStream as a reference.
84    pub fn as_input(&self) -> &crate::operation::create_stream::builders::CreateStreamInputBuilder {
85        &self.inner
86    }
87    /// Sends the request and returns the response.
88    ///
89    /// If an error occurs, an `SdkError` will be returned with additional details that
90    /// can be matched against.
91    ///
92    /// By default, any retryable failures will be retried twice. Retry behavior
93    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
94    /// set when configuring the client.
95    pub async fn send(
96        self,
97    ) -> ::std::result::Result<
98        crate::operation::create_stream::CreateStreamOutput,
99        ::aws_smithy_runtime_api::client::result::SdkError<
100            crate::operation::create_stream::CreateStreamError,
101            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
102        >,
103    > {
104        let input = self
105            .inner
106            .build()
107            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
108        let runtime_plugins = crate::operation::create_stream::CreateStream::operation_runtime_plugins(
109            self.handle.runtime_plugins.clone(),
110            &self.handle.conf,
111            self.config_override,
112        );
113        crate::operation::create_stream::CreateStream::orchestrate(&runtime_plugins, input).await
114    }
115
116    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
117    pub fn customize(
118        self,
119    ) -> crate::client::customize::CustomizableOperation<
120        crate::operation::create_stream::CreateStreamOutput,
121        crate::operation::create_stream::CreateStreamError,
122        Self,
123    > {
124        crate::client::customize::CustomizableOperation::new(self)
125    }
126    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
127        self.set_config_override(::std::option::Option::Some(config_override.into()));
128        self
129    }
130
131    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
132        self.config_override = config_override;
133        self
134    }
135    /// <p>The ID of the cluster for which to create the stream.</p>
136    pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.inner = self.inner.cluster_identifier(input.into());
138        self
139    }
140    /// <p>The ID of the cluster for which to create the stream.</p>
141    pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142        self.inner = self.inner.set_cluster_identifier(input);
143        self
144    }
145    /// <p>The ID of the cluster for which to create the stream.</p>
146    pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
147        self.inner.get_cluster_identifier()
148    }
149    /// <p>The target destination configuration for the stream. Contains Kinesis stream configuration including stream ARN and IAM role ARN.</p>
150    pub fn target_definition(mut self, input: crate::types::TargetDefinition) -> Self {
151        self.inner = self.inner.target_definition(input);
152        self
153    }
154    /// <p>The target destination configuration for the stream. Contains Kinesis stream configuration including stream ARN and IAM role ARN.</p>
155    pub fn set_target_definition(mut self, input: ::std::option::Option<crate::types::TargetDefinition>) -> Self {
156        self.inner = self.inner.set_target_definition(input);
157        self
158    }
159    /// <p>The target destination configuration for the stream. Contains Kinesis stream configuration including stream ARN and IAM role ARN.</p>
160    pub fn get_target_definition(&self) -> &::std::option::Option<crate::types::TargetDefinition> {
161        self.inner.get_target_definition()
162    }
163    /// <p>The ordering mode for the stream. Determines how change events are ordered when delivered to the target.</p>
164    pub fn ordering(mut self, input: crate::types::StreamOrdering) -> Self {
165        self.inner = self.inner.ordering(input);
166        self
167    }
168    /// <p>The ordering mode for the stream. Determines how change events are ordered when delivered to the target.</p>
169    pub fn set_ordering(mut self, input: ::std::option::Option<crate::types::StreamOrdering>) -> Self {
170        self.inner = self.inner.set_ordering(input);
171        self
172    }
173    /// <p>The ordering mode for the stream. Determines how change events are ordered when delivered to the target.</p>
174    pub fn get_ordering(&self) -> &::std::option::Option<crate::types::StreamOrdering> {
175        self.inner.get_ordering()
176    }
177    /// <p>The format of the stream records.</p>
178    pub fn format(mut self, input: crate::types::StreamFormat) -> Self {
179        self.inner = self.inner.format(input);
180        self
181    }
182    /// <p>The format of the stream records.</p>
183    pub fn set_format(mut self, input: ::std::option::Option<crate::types::StreamFormat>) -> Self {
184        self.inner = self.inner.set_format(input);
185        self
186    }
187    /// <p>The format of the stream records.</p>
188    pub fn get_format(&self) -> &::std::option::Option<crate::types::StreamFormat> {
189        self.inner.get_format()
190    }
191    ///
192    /// Adds a key-value pair to `tags`.
193    ///
194    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
195    ///
196    /// <p>A map of key and value pairs to use to tag your stream.</p>
197    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
198        self.inner = self.inner.tags(k.into(), v.into());
199        self
200    }
201    /// <p>A map of key and value pairs to use to tag your stream.</p>
202    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
203        self.inner = self.inner.set_tags(input);
204        self
205    }
206    /// <p>A map of key and value pairs to use to tag your stream.</p>
207    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
208        self.inner.get_tags()
209    }
210    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
211    /// <p>If you don't specify a client token, the Amazon Web Services SDK automatically generates one.</p>
212    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
213        self.inner = self.inner.client_token(input.into());
214        self
215    }
216    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
217    /// <p>If you don't specify a client token, the Amazon Web Services SDK automatically generates one.</p>
218    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
219        self.inner = self.inner.set_client_token(input);
220        self
221    }
222    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
223    /// <p>If you don't specify a client token, the Amazon Web Services SDK automatically generates one.</p>
224    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
225        self.inner.get_client_token()
226    }
227}