aws_sdk_kinesis/operation/start_stream_encryption/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_stream_encryption::_start_stream_encryption_output::StartStreamEncryptionOutputBuilder;
3
4pub use crate::operation::start_stream_encryption::_start_stream_encryption_input::StartStreamEncryptionInputBuilder;
5
6impl crate::operation::start_stream_encryption::builders::StartStreamEncryptionInputBuilder {
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::start_stream_encryption::StartStreamEncryptionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_stream_encryption::StartStreamEncryptionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_stream_encryption();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartStreamEncryption`.
24///
25/// <p>Enables or updates server-side encryption using an Amazon Web Services KMS key for a specified stream.</p><note>
26/// <p>When invoking this API, you must use either the <code>StreamARN</code> or the <code>StreamName</code> parameter, or both. It is recommended that you use the <code>StreamARN</code> input parameter when you invoke this API.</p>
27/// </note>
28/// <p>Starting encryption is an asynchronous operation. Upon receiving the request, Kinesis Data Streams returns immediately and sets the status of the stream to <code>UPDATING</code>. After the update is complete, Kinesis Data Streams sets the status of the stream back to <code>ACTIVE</code>. Updating or applying encryption normally takes a few seconds to complete, but it can take minutes. You can continue to read and write data to your stream while its status is <code>UPDATING</code>. Once the status of the stream is <code>ACTIVE</code>, encryption begins for records written to the stream.</p>
29/// <p>API Limits: You can successfully apply a new Amazon Web Services KMS key for server-side encryption 25 times in a rolling 24-hour period.</p>
30/// <p>Note: It can take up to 5 seconds after the stream is in an <code>ACTIVE</code> status before all records written to the stream are encrypted. After you enable encryption, you can verify that encryption is applied by inspecting the API response from <code>PutRecord</code> or <code>PutRecords</code>.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct StartStreamEncryptionFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::start_stream_encryption::builders::StartStreamEncryptionInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::start_stream_encryption::StartStreamEncryptionOutput,
40        crate::operation::start_stream_encryption::StartStreamEncryptionError,
41    > for StartStreamEncryptionFluentBuilder
42{
43    fn send(
44        self,
45        config_override: crate::config::Builder,
46    ) -> crate::client::customize::internal::BoxFuture<
47        crate::client::customize::internal::SendResult<
48            crate::operation::start_stream_encryption::StartStreamEncryptionOutput,
49            crate::operation::start_stream_encryption::StartStreamEncryptionError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl StartStreamEncryptionFluentBuilder {
56    /// Creates a new `StartStreamEncryptionFluentBuilder`.
57    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58        Self {
59            handle,
60            inner: ::std::default::Default::default(),
61            config_override: ::std::option::Option::None,
62        }
63    }
64    /// Access the StartStreamEncryption as a reference.
65    pub fn as_input(&self) -> &crate::operation::start_stream_encryption::builders::StartStreamEncryptionInputBuilder {
66        &self.inner
67    }
68    /// Sends the request and returns the response.
69    ///
70    /// If an error occurs, an `SdkError` will be returned with additional details that
71    /// can be matched against.
72    ///
73    /// By default, any retryable failures will be retried twice. Retry behavior
74    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75    /// set when configuring the client.
76    pub async fn send(
77        self,
78    ) -> ::std::result::Result<
79        crate::operation::start_stream_encryption::StartStreamEncryptionOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::start_stream_encryption::StartStreamEncryptionError,
82            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83        >,
84    > {
85        let input = self
86            .inner
87            .build()
88            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89        let runtime_plugins = crate::operation::start_stream_encryption::StartStreamEncryption::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::start_stream_encryption::StartStreamEncryption::orchestrate(&runtime_plugins, input).await
95    }
96
97    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98    pub fn customize(
99        self,
100    ) -> crate::client::customize::CustomizableOperation<
101        crate::operation::start_stream_encryption::StartStreamEncryptionOutput,
102        crate::operation::start_stream_encryption::StartStreamEncryptionError,
103        Self,
104    > {
105        crate::client::customize::CustomizableOperation::new(self)
106    }
107    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108        self.set_config_override(::std::option::Option::Some(config_override.into()));
109        self
110    }
111
112    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113        self.config_override = config_override;
114        self
115    }
116    /// <p>The name of the stream for which to start encrypting records.</p>
117    pub fn stream_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.stream_name(input.into());
119        self
120    }
121    /// <p>The name of the stream for which to start encrypting records.</p>
122    pub fn set_stream_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_stream_name(input);
124        self
125    }
126    /// <p>The name of the stream for which to start encrypting records.</p>
127    pub fn get_stream_name(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_stream_name()
129    }
130    /// <p>The encryption type to use. The only valid value is <code>KMS</code>.</p>
131    pub fn encryption_type(mut self, input: crate::types::EncryptionType) -> Self {
132        self.inner = self.inner.encryption_type(input);
133        self
134    }
135    /// <p>The encryption type to use. The only valid value is <code>KMS</code>.</p>
136    pub fn set_encryption_type(mut self, input: ::std::option::Option<crate::types::EncryptionType>) -> Self {
137        self.inner = self.inner.set_encryption_type(input);
138        self
139    }
140    /// <p>The encryption type to use. The only valid value is <code>KMS</code>.</p>
141    pub fn get_encryption_type(&self) -> &::std::option::Option<crate::types::EncryptionType> {
142        self.inner.get_encryption_type()
143    }
144    /// <p>The GUID for the customer-managed Amazon Web Services KMS key to use for encryption. This value can be a globally unique identifier, a fully specified Amazon Resource Name (ARN) to either an alias or a key, or an alias name prefixed by "alias/".You can also use a master key owned by Kinesis Data Streams by specifying the alias <code>aws/kinesis</code>.</p>
145    /// <ul>
146    /// <li>
147    /// <p>Key ARN example: <code>arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</code></p></li>
148    /// <li>
149    /// <p>Alias ARN example: <code>arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</code></p></li>
150    /// <li>
151    /// <p>Globally unique key ID example: <code>12345678-1234-1234-1234-123456789012</code></p></li>
152    /// <li>
153    /// <p>Alias name example: <code>alias/MyAliasName</code></p></li>
154    /// <li>
155    /// <p>Master key owned by Kinesis Data Streams: <code>alias/aws/kinesis</code></p></li>
156    /// </ul>
157    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158        self.inner = self.inner.key_id(input.into());
159        self
160    }
161    /// <p>The GUID for the customer-managed Amazon Web Services KMS key to use for encryption. This value can be a globally unique identifier, a fully specified Amazon Resource Name (ARN) to either an alias or a key, or an alias name prefixed by "alias/".You can also use a master key owned by Kinesis Data Streams by specifying the alias <code>aws/kinesis</code>.</p>
162    /// <ul>
163    /// <li>
164    /// <p>Key ARN example: <code>arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</code></p></li>
165    /// <li>
166    /// <p>Alias ARN example: <code>arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</code></p></li>
167    /// <li>
168    /// <p>Globally unique key ID example: <code>12345678-1234-1234-1234-123456789012</code></p></li>
169    /// <li>
170    /// <p>Alias name example: <code>alias/MyAliasName</code></p></li>
171    /// <li>
172    /// <p>Master key owned by Kinesis Data Streams: <code>alias/aws/kinesis</code></p></li>
173    /// </ul>
174    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175        self.inner = self.inner.set_key_id(input);
176        self
177    }
178    /// <p>The GUID for the customer-managed Amazon Web Services KMS key to use for encryption. This value can be a globally unique identifier, a fully specified Amazon Resource Name (ARN) to either an alias or a key, or an alias name prefixed by "alias/".You can also use a master key owned by Kinesis Data Streams by specifying the alias <code>aws/kinesis</code>.</p>
179    /// <ul>
180    /// <li>
181    /// <p>Key ARN example: <code>arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</code></p></li>
182    /// <li>
183    /// <p>Alias ARN example: <code>arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</code></p></li>
184    /// <li>
185    /// <p>Globally unique key ID example: <code>12345678-1234-1234-1234-123456789012</code></p></li>
186    /// <li>
187    /// <p>Alias name example: <code>alias/MyAliasName</code></p></li>
188    /// <li>
189    /// <p>Master key owned by Kinesis Data Streams: <code>alias/aws/kinesis</code></p></li>
190    /// </ul>
191    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
192        self.inner.get_key_id()
193    }
194    /// <p>The ARN of the stream.</p>
195    pub fn stream_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
196        self.inner = self.inner.stream_arn(input.into());
197        self
198    }
199    /// <p>The ARN of the stream.</p>
200    pub fn set_stream_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
201        self.inner = self.inner.set_stream_arn(input);
202        self
203    }
204    /// <p>The ARN of the stream.</p>
205    pub fn get_stream_arn(&self) -> &::std::option::Option<::std::string::String> {
206        self.inner.get_stream_arn()
207    }
208}