aws_sdk_firehose/operation/start_delivery_stream_encryption/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_delivery_stream_encryption::_start_delivery_stream_encryption_output::StartDeliveryStreamEncryptionOutputBuilder;
3
4pub use crate::operation::start_delivery_stream_encryption::_start_delivery_stream_encryption_input::StartDeliveryStreamEncryptionInputBuilder;
5
6impl crate::operation::start_delivery_stream_encryption::builders::StartDeliveryStreamEncryptionInputBuilder {
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_delivery_stream_encryption::StartDeliveryStreamEncryptionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryptionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_delivery_stream_encryption();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartDeliveryStreamEncryption`.
24///
25/// <p>Enables server-side encryption (SSE) for the Firehose stream.</p>
26/// <p>This operation is asynchronous. It returns immediately. When you invoke it, Firehose first sets the encryption status of the stream to <code>ENABLING</code>, and then to <code>ENABLED</code>. The encryption status of a Firehose stream is the <code>Status</code> property in <code>DeliveryStreamEncryptionConfiguration</code>. If the operation fails, the encryption status changes to <code>ENABLING_FAILED</code>. You can continue to read and write data to your Firehose stream while the encryption status is <code>ENABLING</code>, but the data is not encrypted. It can take up to 5 seconds after the encryption status changes to <code>ENABLED</code> before all records written to the Firehose stream are encrypted. To find out whether a record or a batch of records was encrypted, check the response elements <code>PutRecordOutput$Encrypted</code> and <code>PutRecordBatchOutput$Encrypted</code>, respectively.</p>
27/// <p>To check the encryption status of a Firehose stream, use <code>DescribeDeliveryStream</code>.</p>
28/// <p>Even if encryption is currently enabled for a Firehose stream, you can still invoke this operation on it to change the ARN of the CMK or both its type and ARN. If you invoke this method to change the CMK, and the old CMK is of type <code>CUSTOMER_MANAGED_CMK</code>, Firehose schedules the grant it had on the old CMK for retirement. If the new CMK is of type <code>CUSTOMER_MANAGED_CMK</code>, Firehose creates a grant that enables it to use the new CMK to encrypt and decrypt data and to manage the grant.</p>
29/// <p>For the KMS grant creation to be successful, the Firehose API operations <code>StartDeliveryStreamEncryption</code> and <code>CreateDeliveryStream</code> should not be called with session credentials that are more than 6 hours old.</p>
30/// <p>If a Firehose stream already has encryption enabled and then you invoke this operation to change the ARN of the CMK or both its type and ARN and you get <code>ENABLING_FAILED</code>, this only means that the attempt to change the CMK failed. In this case, encryption remains enabled with the old CMK.</p>
31/// <p>If the encryption status of your Firehose stream is <code>ENABLING_FAILED</code>, you can invoke this operation again with a valid CMK. The CMK must be enabled and the key policy mustn't explicitly deny the permission for Firehose to invoke KMS encrypt and decrypt operations.</p>
32/// <p>You can enable SSE for a Firehose stream only if it's a Firehose stream that uses <code>DirectPut</code> as its source.</p>
33/// <p>The <code>StartDeliveryStreamEncryption</code> and <code>StopDeliveryStreamEncryption</code> operations have a combined limit of 25 calls per Firehose stream per 24 hours. For example, you reach the limit if you call <code>StartDeliveryStreamEncryption</code> 13 times and <code>StopDeliveryStreamEncryption</code> 12 times for the same Firehose stream in a 24-hour period.</p>
34#[derive(::std::clone::Clone, ::std::fmt::Debug)]
35pub struct StartDeliveryStreamEncryptionFluentBuilder {
36    handle: ::std::sync::Arc<crate::client::Handle>,
37    inner: crate::operation::start_delivery_stream_encryption::builders::StartDeliveryStreamEncryptionInputBuilder,
38    config_override: ::std::option::Option<crate::config::Builder>,
39}
40impl
41    crate::client::customize::internal::CustomizableSend<
42        crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryptionOutput,
43        crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryptionError,
44    > for StartDeliveryStreamEncryptionFluentBuilder
45{
46    fn send(
47        self,
48        config_override: crate::config::Builder,
49    ) -> crate::client::customize::internal::BoxFuture<
50        crate::client::customize::internal::SendResult<
51            crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryptionOutput,
52            crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryptionError,
53        >,
54    > {
55        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
56    }
57}
58impl StartDeliveryStreamEncryptionFluentBuilder {
59    /// Creates a new `StartDeliveryStreamEncryptionFluentBuilder`.
60    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
61        Self {
62            handle,
63            inner: ::std::default::Default::default(),
64            config_override: ::std::option::Option::None,
65        }
66    }
67    /// Access the StartDeliveryStreamEncryption as a reference.
68    pub fn as_input(&self) -> &crate::operation::start_delivery_stream_encryption::builders::StartDeliveryStreamEncryptionInputBuilder {
69        &self.inner
70    }
71    /// Sends the request and returns the response.
72    ///
73    /// If an error occurs, an `SdkError` will be returned with additional details that
74    /// can be matched against.
75    ///
76    /// By default, any retryable failures will be retried twice. Retry behavior
77    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
78    /// set when configuring the client.
79    pub async fn send(
80        self,
81    ) -> ::std::result::Result<
82        crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryptionOutput,
83        ::aws_smithy_runtime_api::client::result::SdkError<
84            crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryptionError,
85            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
86        >,
87    > {
88        let input = self
89            .inner
90            .build()
91            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
92        let runtime_plugins = crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryption::operation_runtime_plugins(
93            self.handle.runtime_plugins.clone(),
94            &self.handle.conf,
95            self.config_override,
96        );
97        crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryption::orchestrate(&runtime_plugins, input).await
98    }
99
100    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
101    pub fn customize(
102        self,
103    ) -> crate::client::customize::CustomizableOperation<
104        crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryptionOutput,
105        crate::operation::start_delivery_stream_encryption::StartDeliveryStreamEncryptionError,
106        Self,
107    > {
108        crate::client::customize::CustomizableOperation::new(self)
109    }
110    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
111        self.set_config_override(::std::option::Option::Some(config_override.into()));
112        self
113    }
114
115    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
116        self.config_override = config_override;
117        self
118    }
119    /// <p>The name of the Firehose stream for which you want to enable server-side encryption (SSE).</p>
120    pub fn delivery_stream_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.inner = self.inner.delivery_stream_name(input.into());
122        self
123    }
124    /// <p>The name of the Firehose stream for which you want to enable server-side encryption (SSE).</p>
125    pub fn set_delivery_stream_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.inner = self.inner.set_delivery_stream_name(input);
127        self
128    }
129    /// <p>The name of the Firehose stream for which you want to enable server-side encryption (SSE).</p>
130    pub fn get_delivery_stream_name(&self) -> &::std::option::Option<::std::string::String> {
131        self.inner.get_delivery_stream_name()
132    }
133    /// <p>Used to specify the type and Amazon Resource Name (ARN) of the KMS key needed for Server-Side Encryption (SSE).</p>
134    pub fn delivery_stream_encryption_configuration_input(mut self, input: crate::types::DeliveryStreamEncryptionConfigurationInput) -> Self {
135        self.inner = self.inner.delivery_stream_encryption_configuration_input(input);
136        self
137    }
138    /// <p>Used to specify the type and Amazon Resource Name (ARN) of the KMS key needed for Server-Side Encryption (SSE).</p>
139    pub fn set_delivery_stream_encryption_configuration_input(
140        mut self,
141        input: ::std::option::Option<crate::types::DeliveryStreamEncryptionConfigurationInput>,
142    ) -> Self {
143        self.inner = self.inner.set_delivery_stream_encryption_configuration_input(input);
144        self
145    }
146    /// <p>Used to specify the type and Amazon Resource Name (ARN) of the KMS key needed for Server-Side Encryption (SSE).</p>
147    pub fn get_delivery_stream_encryption_configuration_input(
148        &self,
149    ) -> &::std::option::Option<crate::types::DeliveryStreamEncryptionConfigurationInput> {
150        self.inner.get_delivery_stream_encryption_configuration_input()
151    }
152}