aws_sdk_kms/operation/re_encrypt/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::re_encrypt::_re_encrypt_output::ReEncryptOutputBuilder;
3
4pub use crate::operation::re_encrypt::_re_encrypt_input::ReEncryptInputBuilder;
5
6impl crate::operation::re_encrypt::builders::ReEncryptInputBuilder {
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::re_encrypt::ReEncryptOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::re_encrypt::ReEncryptError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.re_encrypt();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ReEncrypt`.
24///
25/// <p>Decrypts ciphertext and then reencrypts it entirely within KMS. You can use this operation to change the KMS key under which data is encrypted, such as when you <a href="https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html#rotate-keys-manually">manually rotate</a> a KMS key or change the KMS key that protects a ciphertext. You can also use it to reencrypt ciphertext under the same KMS key, such as to change the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">encryption context</a> of a ciphertext.</p>
26/// <p>The <code>ReEncrypt</code> operation can decrypt ciphertext that was encrypted by using a KMS key in an KMS operation, such as <code>Encrypt</code> or <code>GenerateDataKey</code>. It can also decrypt ciphertext that was encrypted by using the public key of an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-concepts.html#asymmetric-cmks">asymmetric KMS key</a> outside of KMS. However, it cannot decrypt ciphertext produced by other libraries, such as the <a href="https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/">Amazon Web Services Encryption SDK</a> or <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingClientSideEncryption.html">Amazon S3 client-side encryption</a>. These libraries return a ciphertext format that is incompatible with KMS.</p>
27/// <p>When you use the <code>ReEncrypt</code> operation, you need to provide information for the decrypt operation and the subsequent encrypt operation.</p>
28/// <ul>
29/// <li>
30/// <p>If your ciphertext was encrypted under an asymmetric KMS key, you must use the <code>SourceKeyId</code> parameter to identify the KMS key that encrypted the ciphertext. You must also supply the encryption algorithm that was used. This information is required to decrypt the data.</p></li>
31/// <li>
32/// <p>If your ciphertext was encrypted under a symmetric encryption KMS key, the <code>SourceKeyId</code> parameter is optional. KMS can get this information from metadata that it adds to the symmetric ciphertext blob. This feature adds durability to your implementation by ensuring that authorized users can decrypt ciphertext decades after it was encrypted, even if they've lost track of the key ID. However, specifying the source KMS key is always recommended as a best practice. When you use the <code>SourceKeyId</code> parameter to specify a KMS key, KMS uses only the KMS key you specify. If the ciphertext was encrypted under a different KMS key, the <code>ReEncrypt</code> operation fails. This practice ensures that you use the KMS key that you intend.</p></li>
33/// <li>
34/// <p>To reencrypt the data, you must use the <code>DestinationKeyId</code> parameter to specify the KMS key that re-encrypts the data after it is decrypted. If the destination KMS key is an asymmetric KMS key, you must also provide the encryption algorithm. The algorithm that you choose must be compatible with the KMS key.</p><important>
35/// <p>When you use an asymmetric KMS key to encrypt or reencrypt data, be sure to record the KMS key and encryption algorithm that you choose. You will be required to provide the same KMS key and encryption algorithm when you decrypt the data. If the KMS key and algorithm do not match the values used to encrypt the data, the decrypt operation fails.</p>
36/// <p>You are not required to supply the key ID and encryption algorithm when you decrypt with symmetric encryption KMS keys because KMS stores this information in the ciphertext blob. KMS cannot store metadata in ciphertext generated with asymmetric keys. The standard format for asymmetric key ciphertext does not include configurable fields.</p>
37/// </important></li>
38/// </ul>
39/// <p>The KMS key that you use for this operation must be in a compatible key state. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of KMS keys</a> in the <i>Key Management Service Developer Guide</i>.</p>
40/// <p><b>Cross-account use</b>: Yes. The source KMS key and destination KMS key can be in different Amazon Web Services accounts. Either or both KMS keys can be in a different account than the caller. To specify a KMS key in a different account, you must use its key ARN or alias ARN.</p>
41/// <p><b>Required permissions</b>:</p>
42/// <ul>
43/// <li>
44/// <p><a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:ReEncryptFrom</a> permission on the source KMS key (key policy)</p></li>
45/// <li>
46/// <p><a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:ReEncryptTo</a> permission on the destination KMS key (key policy)</p></li>
47/// </ul>
48/// <p>To permit reencryption from or to a KMS key, include the <code>"kms:ReEncrypt*"</code> permission in your <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html">key policy</a>. This permission is automatically included in the key policy when you use the console to create a KMS key. But you must include it manually when you create a KMS key programmatically or when you use the <code>PutKeyPolicy</code> operation to set a key policy.</p>
49/// <p><b>Related operations:</b></p>
50/// <ul>
51/// <li>
52/// <p><code>Decrypt</code></p></li>
53/// <li>
54/// <p><code>Encrypt</code></p></li>
55/// <li>
56/// <p><code>GenerateDataKey</code></p></li>
57/// <li>
58/// <p><code>GenerateDataKeyPair</code></p></li>
59/// </ul>
60/// <p><b>Eventual consistency</b>: The KMS API follows an eventual consistency model. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html">KMS eventual consistency</a>.</p>
61#[derive(::std::clone::Clone, ::std::fmt::Debug)]
62pub struct ReEncryptFluentBuilder {
63    handle: ::std::sync::Arc<crate::client::Handle>,
64    inner: crate::operation::re_encrypt::builders::ReEncryptInputBuilder,
65    config_override: ::std::option::Option<crate::config::Builder>,
66}
67impl crate::client::customize::internal::CustomizableSend<crate::operation::re_encrypt::ReEncryptOutput, crate::operation::re_encrypt::ReEncryptError>
68    for ReEncryptFluentBuilder
69{
70    fn send(
71        self,
72        config_override: crate::config::Builder,
73    ) -> crate::client::customize::internal::BoxFuture<
74        crate::client::customize::internal::SendResult<crate::operation::re_encrypt::ReEncryptOutput, crate::operation::re_encrypt::ReEncryptError>,
75    > {
76        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
77    }
78}
79impl ReEncryptFluentBuilder {
80    /// Creates a new `ReEncryptFluentBuilder`.
81    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
82        Self {
83            handle,
84            inner: ::std::default::Default::default(),
85            config_override: ::std::option::Option::None,
86        }
87    }
88    /// Access the ReEncrypt as a reference.
89    pub fn as_input(&self) -> &crate::operation::re_encrypt::builders::ReEncryptInputBuilder {
90        &self.inner
91    }
92    /// Sends the request and returns the response.
93    ///
94    /// If an error occurs, an `SdkError` will be returned with additional details that
95    /// can be matched against.
96    ///
97    /// By default, any retryable failures will be retried twice. Retry behavior
98    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
99    /// set when configuring the client.
100    pub async fn send(
101        self,
102    ) -> ::std::result::Result<
103        crate::operation::re_encrypt::ReEncryptOutput,
104        ::aws_smithy_runtime_api::client::result::SdkError<
105            crate::operation::re_encrypt::ReEncryptError,
106            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
107        >,
108    > {
109        let input = self
110            .inner
111            .build()
112            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
113        let runtime_plugins = crate::operation::re_encrypt::ReEncrypt::operation_runtime_plugins(
114            self.handle.runtime_plugins.clone(),
115            &self.handle.conf,
116            self.config_override,
117        );
118        crate::operation::re_encrypt::ReEncrypt::orchestrate(&runtime_plugins, input).await
119    }
120
121    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
122    pub fn customize(
123        self,
124    ) -> crate::client::customize::CustomizableOperation<
125        crate::operation::re_encrypt::ReEncryptOutput,
126        crate::operation::re_encrypt::ReEncryptError,
127        Self,
128    > {
129        crate::client::customize::CustomizableOperation::new(self)
130    }
131    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
132        self.set_config_override(::std::option::Option::Some(config_override.into()));
133        self
134    }
135
136    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
137        self.config_override = config_override;
138        self
139    }
140    /// <p>Ciphertext of the data to reencrypt.</p>
141    pub fn ciphertext_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
142        self.inner = self.inner.ciphertext_blob(input);
143        self
144    }
145    /// <p>Ciphertext of the data to reencrypt.</p>
146    pub fn set_ciphertext_blob(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
147        self.inner = self.inner.set_ciphertext_blob(input);
148        self
149    }
150    /// <p>Ciphertext of the data to reencrypt.</p>
151    pub fn get_ciphertext_blob(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
152        self.inner.get_ciphertext_blob()
153    }
154    ///
155    /// Adds a key-value pair to `SourceEncryptionContext`.
156    ///
157    /// To override the contents of this collection use [`set_source_encryption_context`](Self::set_source_encryption_context).
158    ///
159    /// <p>Specifies the encryption context to use to decrypt the ciphertext. Enter the same encryption context that was used to encrypt the ciphertext.</p>
160    /// <p>An <i>encryption context</i> is a collection of non-secret key-value pairs that represent additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is supported only on operations with symmetric encryption KMS keys. On operations with symmetric encryption KMS keys, an encryption context is optional, but it is strongly recommended.</p>
161    /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
162    pub fn source_encryption_context(
163        mut self,
164        k: impl ::std::convert::Into<::std::string::String>,
165        v: impl ::std::convert::Into<::std::string::String>,
166    ) -> Self {
167        self.inner = self.inner.source_encryption_context(k.into(), v.into());
168        self
169    }
170    /// <p>Specifies the encryption context to use to decrypt the ciphertext. Enter the same encryption context that was used to encrypt the ciphertext.</p>
171    /// <p>An <i>encryption context</i> is a collection of non-secret key-value pairs that represent additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is supported only on operations with symmetric encryption KMS keys. On operations with symmetric encryption KMS keys, an encryption context is optional, but it is strongly recommended.</p>
172    /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
173    pub fn set_source_encryption_context(
174        mut self,
175        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
176    ) -> Self {
177        self.inner = self.inner.set_source_encryption_context(input);
178        self
179    }
180    /// <p>Specifies the encryption context to use to decrypt the ciphertext. Enter the same encryption context that was used to encrypt the ciphertext.</p>
181    /// <p>An <i>encryption context</i> is a collection of non-secret key-value pairs that represent additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is supported only on operations with symmetric encryption KMS keys. On operations with symmetric encryption KMS keys, an encryption context is optional, but it is strongly recommended.</p>
182    /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
183    pub fn get_source_encryption_context(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
184        self.inner.get_source_encryption_context()
185    }
186    /// <p>Specifies the KMS key that KMS will use to decrypt the ciphertext before it is re-encrypted.</p>
187    /// <p>Enter a key ID of the KMS key that was used to encrypt the ciphertext. If you identify a different KMS key, the <code>ReEncrypt</code> operation throws an <code>IncorrectKeyException</code>.</p>
188    /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key. If you used a symmetric encryption KMS key, KMS can get the KMS key from metadata that it adds to the symmetric ciphertext blob. However, it is always recommended as a best practice. This practice ensures that you use the KMS key that you intend.</p>
189    /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
190    /// <p>For example:</p>
191    /// <ul>
192    /// <li>
193    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
194    /// <li>
195    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
196    /// <li>
197    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
198    /// <li>
199    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
200    /// </ul>
201    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
202    pub fn source_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
203        self.inner = self.inner.source_key_id(input.into());
204        self
205    }
206    /// <p>Specifies the KMS key that KMS will use to decrypt the ciphertext before it is re-encrypted.</p>
207    /// <p>Enter a key ID of the KMS key that was used to encrypt the ciphertext. If you identify a different KMS key, the <code>ReEncrypt</code> operation throws an <code>IncorrectKeyException</code>.</p>
208    /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key. If you used a symmetric encryption KMS key, KMS can get the KMS key from metadata that it adds to the symmetric ciphertext blob. However, it is always recommended as a best practice. This practice ensures that you use the KMS key that you intend.</p>
209    /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
210    /// <p>For example:</p>
211    /// <ul>
212    /// <li>
213    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
214    /// <li>
215    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
216    /// <li>
217    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
218    /// <li>
219    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
220    /// </ul>
221    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
222    pub fn set_source_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
223        self.inner = self.inner.set_source_key_id(input);
224        self
225    }
226    /// <p>Specifies the KMS key that KMS will use to decrypt the ciphertext before it is re-encrypted.</p>
227    /// <p>Enter a key ID of the KMS key that was used to encrypt the ciphertext. If you identify a different KMS key, the <code>ReEncrypt</code> operation throws an <code>IncorrectKeyException</code>.</p>
228    /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key. If you used a symmetric encryption KMS key, KMS can get the KMS key from metadata that it adds to the symmetric ciphertext blob. However, it is always recommended as a best practice. This practice ensures that you use the KMS key that you intend.</p>
229    /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
230    /// <p>For example:</p>
231    /// <ul>
232    /// <li>
233    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
234    /// <li>
235    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
236    /// <li>
237    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
238    /// <li>
239    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
240    /// </ul>
241    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
242    pub fn get_source_key_id(&self) -> &::std::option::Option<::std::string::String> {
243        self.inner.get_source_key_id()
244    }
245    /// <p>A unique identifier for the KMS key that is used to reencrypt the data. Specify a symmetric encryption KMS key or an asymmetric KMS key with a <code>KeyUsage</code> value of <code>ENCRYPT_DECRYPT</code>. To find the <code>KeyUsage</code> value of a KMS key, use the <code>DescribeKey</code> operation.</p>
246    /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
247    /// <p>For example:</p>
248    /// <ul>
249    /// <li>
250    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
251    /// <li>
252    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
253    /// <li>
254    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
255    /// <li>
256    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
257    /// </ul>
258    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
259    pub fn destination_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
260        self.inner = self.inner.destination_key_id(input.into());
261        self
262    }
263    /// <p>A unique identifier for the KMS key that is used to reencrypt the data. Specify a symmetric encryption KMS key or an asymmetric KMS key with a <code>KeyUsage</code> value of <code>ENCRYPT_DECRYPT</code>. To find the <code>KeyUsage</code> value of a KMS key, use the <code>DescribeKey</code> operation.</p>
264    /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
265    /// <p>For example:</p>
266    /// <ul>
267    /// <li>
268    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
269    /// <li>
270    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
271    /// <li>
272    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
273    /// <li>
274    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
275    /// </ul>
276    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
277    pub fn set_destination_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
278        self.inner = self.inner.set_destination_key_id(input);
279        self
280    }
281    /// <p>A unique identifier for the KMS key that is used to reencrypt the data. Specify a symmetric encryption KMS key or an asymmetric KMS key with a <code>KeyUsage</code> value of <code>ENCRYPT_DECRYPT</code>. To find the <code>KeyUsage</code> value of a KMS key, use the <code>DescribeKey</code> operation.</p>
282    /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
283    /// <p>For example:</p>
284    /// <ul>
285    /// <li>
286    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
287    /// <li>
288    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
289    /// <li>
290    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
291    /// <li>
292    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
293    /// </ul>
294    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
295    pub fn get_destination_key_id(&self) -> &::std::option::Option<::std::string::String> {
296        self.inner.get_destination_key_id()
297    }
298    ///
299    /// Adds a key-value pair to `DestinationEncryptionContext`.
300    ///
301    /// To override the contents of this collection use [`set_destination_encryption_context`](Self::set_destination_encryption_context).
302    ///
303    /// <p>Specifies that encryption context to use when the reencrypting the data.</p><important>
304    /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
305    /// </important>
306    /// <p>A destination encryption context is valid only when the destination KMS key is a symmetric encryption KMS key. The standard ciphertext format for asymmetric KMS keys does not include fields for metadata.</p>
307    /// <p>An <i>encryption context</i> is a collection of non-secret key-value pairs that represent additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is supported only on operations with symmetric encryption KMS keys. On operations with symmetric encryption KMS keys, an encryption context is optional, but it is strongly recommended.</p>
308    /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
309    pub fn destination_encryption_context(
310        mut self,
311        k: impl ::std::convert::Into<::std::string::String>,
312        v: impl ::std::convert::Into<::std::string::String>,
313    ) -> Self {
314        self.inner = self.inner.destination_encryption_context(k.into(), v.into());
315        self
316    }
317    /// <p>Specifies that encryption context to use when the reencrypting the data.</p><important>
318    /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
319    /// </important>
320    /// <p>A destination encryption context is valid only when the destination KMS key is a symmetric encryption KMS key. The standard ciphertext format for asymmetric KMS keys does not include fields for metadata.</p>
321    /// <p>An <i>encryption context</i> is a collection of non-secret key-value pairs that represent additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is supported only on operations with symmetric encryption KMS keys. On operations with symmetric encryption KMS keys, an encryption context is optional, but it is strongly recommended.</p>
322    /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
323    pub fn set_destination_encryption_context(
324        mut self,
325        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
326    ) -> Self {
327        self.inner = self.inner.set_destination_encryption_context(input);
328        self
329    }
330    /// <p>Specifies that encryption context to use when the reencrypting the data.</p><important>
331    /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
332    /// </important>
333    /// <p>A destination encryption context is valid only when the destination KMS key is a symmetric encryption KMS key. The standard ciphertext format for asymmetric KMS keys does not include fields for metadata.</p>
334    /// <p>An <i>encryption context</i> is a collection of non-secret key-value pairs that represent additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is supported only on operations with symmetric encryption KMS keys. On operations with symmetric encryption KMS keys, an encryption context is optional, but it is strongly recommended.</p>
335    /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
336    pub fn get_destination_encryption_context(
337        &self,
338    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
339        self.inner.get_destination_encryption_context()
340    }
341    /// <p>Specifies the encryption algorithm that KMS will use to decrypt the ciphertext before it is reencrypted. The default value, <code>SYMMETRIC_DEFAULT</code>, represents the algorithm used for symmetric encryption KMS keys.</p>
342    /// <p>Specify the same algorithm that was used to encrypt the ciphertext. If you specify a different algorithm, the decrypt attempt fails.</p>
343    /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key.</p>
344    pub fn source_encryption_algorithm(mut self, input: crate::types::EncryptionAlgorithmSpec) -> Self {
345        self.inner = self.inner.source_encryption_algorithm(input);
346        self
347    }
348    /// <p>Specifies the encryption algorithm that KMS will use to decrypt the ciphertext before it is reencrypted. The default value, <code>SYMMETRIC_DEFAULT</code>, represents the algorithm used for symmetric encryption KMS keys.</p>
349    /// <p>Specify the same algorithm that was used to encrypt the ciphertext. If you specify a different algorithm, the decrypt attempt fails.</p>
350    /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key.</p>
351    pub fn set_source_encryption_algorithm(mut self, input: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>) -> Self {
352        self.inner = self.inner.set_source_encryption_algorithm(input);
353        self
354    }
355    /// <p>Specifies the encryption algorithm that KMS will use to decrypt the ciphertext before it is reencrypted. The default value, <code>SYMMETRIC_DEFAULT</code>, represents the algorithm used for symmetric encryption KMS keys.</p>
356    /// <p>Specify the same algorithm that was used to encrypt the ciphertext. If you specify a different algorithm, the decrypt attempt fails.</p>
357    /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key.</p>
358    pub fn get_source_encryption_algorithm(&self) -> &::std::option::Option<crate::types::EncryptionAlgorithmSpec> {
359        self.inner.get_source_encryption_algorithm()
360    }
361    /// <p>Specifies the encryption algorithm that KMS will use to reecrypt the data after it has decrypted it. The default value, <code>SYMMETRIC_DEFAULT</code>, represents the encryption algorithm used for symmetric encryption KMS keys.</p>
362    /// <p>This parameter is required only when the destination KMS key is an asymmetric KMS key.</p>
363    pub fn destination_encryption_algorithm(mut self, input: crate::types::EncryptionAlgorithmSpec) -> Self {
364        self.inner = self.inner.destination_encryption_algorithm(input);
365        self
366    }
367    /// <p>Specifies the encryption algorithm that KMS will use to reecrypt the data after it has decrypted it. The default value, <code>SYMMETRIC_DEFAULT</code>, represents the encryption algorithm used for symmetric encryption KMS keys.</p>
368    /// <p>This parameter is required only when the destination KMS key is an asymmetric KMS key.</p>
369    pub fn set_destination_encryption_algorithm(mut self, input: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>) -> Self {
370        self.inner = self.inner.set_destination_encryption_algorithm(input);
371        self
372    }
373    /// <p>Specifies the encryption algorithm that KMS will use to reecrypt the data after it has decrypted it. The default value, <code>SYMMETRIC_DEFAULT</code>, represents the encryption algorithm used for symmetric encryption KMS keys.</p>
374    /// <p>This parameter is required only when the destination KMS key is an asymmetric KMS key.</p>
375    pub fn get_destination_encryption_algorithm(&self) -> &::std::option::Option<crate::types::EncryptionAlgorithmSpec> {
376        self.inner.get_destination_encryption_algorithm()
377    }
378    ///
379    /// Appends an item to `GrantTokens`.
380    ///
381    /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
382    ///
383    /// <p>A list of grant tokens.</p>
384    /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
385    pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
386        self.inner = self.inner.grant_tokens(input.into());
387        self
388    }
389    /// <p>A list of grant tokens.</p>
390    /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
391    pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
392        self.inner = self.inner.set_grant_tokens(input);
393        self
394    }
395    /// <p>A list of grant tokens.</p>
396    /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
397    pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
398        self.inner.get_grant_tokens()
399    }
400    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
401    /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
402    pub fn dry_run(mut self, input: bool) -> Self {
403        self.inner = self.inner.dry_run(input);
404        self
405    }
406    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
407    /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
408    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
409        self.inner = self.inner.set_dry_run(input);
410        self
411    }
412    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
413    /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
414    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
415        self.inner.get_dry_run()
416    }
417}