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_input::ReEncryptInputBuilder;
3
4pub use crate::operation::re_encrypt::_re_encrypt_output::ReEncryptOutputBuilder;
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-manually.html">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/encrypt_context.html">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/symmetric-asymmetric.html">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><note>
40/// <p>When using grants with <code>SourceArn</code> constraints for <code>ReEncrypt</code> operations, the grants on both the source KMS key (for <code>ReEncryptFrom</code>) and the destination KMS key (for <code>ReEncryptTo</code>) must specify the same <code>SourceArn</code> value.</p>
41/// </note>
42/// <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, use the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN">key ARN</a> or <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-alias-ARN">alias ARN</a>. A short <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-id">key ID</a> is also acceptable for the source key when decrypting symmetric ciphertexts, though using a full key ARN is recommended to be more explicit about the intended KMS key.</p>
43/// <p><b>Required permissions</b>:</p>
44/// <ul>
45/// <li>
46/// <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>
47/// <li>
48/// <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>
49/// </ul>
50/// <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>
51/// <p><b>Related operations:</b></p>
52/// <ul>
53/// <li>
54/// <p><code>Decrypt</code></p></li>
55/// <li>
56/// <p><code>Encrypt</code></p></li>
57/// <li>
58/// <p><code>GenerateDataKey</code></p></li>
59/// <li>
60/// <p><code>GenerateDataKeyPair</code></p></li>
61/// </ul>
62/// <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/accessing-kms.html#programming-eventual-consistency">KMS eventual consistency</a>.</p>
63#[derive(::std::clone::Clone, ::std::fmt::Debug)]
64pub struct ReEncryptFluentBuilder {
65 handle: ::std::sync::Arc<crate::client::Handle>,
66 inner: crate::operation::re_encrypt::builders::ReEncryptInputBuilder,
67 config_override: ::std::option::Option<crate::config::Builder>,
68}
69impl crate::client::customize::internal::CustomizableSend<crate::operation::re_encrypt::ReEncryptOutput, crate::operation::re_encrypt::ReEncryptError>
70 for ReEncryptFluentBuilder
71{
72 fn send(
73 self,
74 config_override: crate::config::Builder,
75 ) -> crate::client::customize::internal::BoxFuture<
76 crate::client::customize::internal::SendResult<crate::operation::re_encrypt::ReEncryptOutput, crate::operation::re_encrypt::ReEncryptError>,
77 > {
78 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
79 }
80}
81impl ReEncryptFluentBuilder {
82 /// Creates a new `ReEncryptFluentBuilder`.
83 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
84 Self {
85 handle,
86 inner: ::std::default::Default::default(),
87 config_override: ::std::option::Option::None,
88 }
89 }
90 /// Access the ReEncrypt as a reference.
91 pub fn as_input(&self) -> &crate::operation::re_encrypt::builders::ReEncryptInputBuilder {
92 &self.inner
93 }
94 /// Sends the request and returns the response.
95 ///
96 /// If an error occurs, an `SdkError` will be returned with additional details that
97 /// can be matched against.
98 ///
99 /// By default, any retryable failures will be retried twice. Retry behavior
100 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
101 /// set when configuring the client.
102 pub async fn send(
103 self,
104 ) -> ::std::result::Result<
105 crate::operation::re_encrypt::ReEncryptOutput,
106 ::aws_smithy_runtime_api::client::result::SdkError<
107 crate::operation::re_encrypt::ReEncryptError,
108 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
109 >,
110 > {
111 let input = self
112 .inner
113 .build()
114 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
115 let runtime_plugins = crate::operation::re_encrypt::ReEncrypt::operation_runtime_plugins(
116 self.handle.runtime_plugins.clone(),
117 &self.handle.conf,
118 self.config_override,
119 );
120 crate::operation::re_encrypt::ReEncrypt::orchestrate(&runtime_plugins, input).await
121 }
122
123 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
124 pub fn customize(
125 self,
126 ) -> crate::client::customize::CustomizableOperation<
127 crate::operation::re_encrypt::ReEncryptOutput,
128 crate::operation::re_encrypt::ReEncryptError,
129 Self,
130 > {
131 crate::client::customize::CustomizableOperation::new(self)
132 }
133 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
134 self.set_config_override(::std::option::Option::Some(config_override.into()));
135 self
136 }
137
138 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
139 self.config_override = config_override;
140 self
141 }
142 /// <p>Ciphertext of the data to reencrypt.</p>
143 /// <p>This parameter is required in all cases except when <code>DryRun</code> is <code>true</code> and <code>DryRunModifiers</code> is set to <code>IGNORE_CIPHERTEXT</code>.</p>
144 pub fn ciphertext_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
145 self.inner = self.inner.ciphertext_blob(input);
146 self
147 }
148 /// <p>Ciphertext of the data to reencrypt.</p>
149 /// <p>This parameter is required in all cases except when <code>DryRun</code> is <code>true</code> and <code>DryRunModifiers</code> is set to <code>IGNORE_CIPHERTEXT</code>.</p>
150 pub fn set_ciphertext_blob(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
151 self.inner = self.inner.set_ciphertext_blob(input);
152 self
153 }
154 /// <p>Ciphertext of the data to reencrypt.</p>
155 /// <p>This parameter is required in all cases except when <code>DryRun</code> is <code>true</code> and <code>DryRunModifiers</code> is set to <code>IGNORE_CIPHERTEXT</code>.</p>
156 pub fn get_ciphertext_blob(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
157 self.inner.get_ciphertext_blob()
158 }
159 ///
160 /// Adds a key-value pair to `SourceEncryptionContext`.
161 ///
162 /// To override the contents of this collection use [`set_source_encryption_context`](Self::set_source_encryption_context).
163 ///
164 /// <p>Specifies the encryption context to use to decrypt the ciphertext. Enter the same encryption context that was used to encrypt the ciphertext.</p>
165 /// <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>
166 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/encrypt_context.html">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
167 pub fn source_encryption_context(
168 mut self,
169 k: impl ::std::convert::Into<::std::string::String>,
170 v: impl ::std::convert::Into<::std::string::String>,
171 ) -> Self {
172 self.inner = self.inner.source_encryption_context(k.into(), v.into());
173 self
174 }
175 /// <p>Specifies the encryption context to use to decrypt the ciphertext. Enter the same encryption context that was used to encrypt the ciphertext.</p>
176 /// <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>
177 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/encrypt_context.html">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
178 pub fn set_source_encryption_context(
179 mut self,
180 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
181 ) -> Self {
182 self.inner = self.inner.set_source_encryption_context(input);
183 self
184 }
185 /// <p>Specifies the encryption context to use to decrypt the ciphertext. Enter the same encryption context that was used to encrypt the ciphertext.</p>
186 /// <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>
187 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/encrypt_context.html">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
188 pub fn get_source_encryption_context(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
189 self.inner.get_source_encryption_context()
190 }
191 /// <p>Specifies the KMS key that KMS will use to decrypt the ciphertext before it is re-encrypted.</p>
192 /// <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>
193 /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key or when <code>DryRun</code> is <code>true</code> and <code>DryRunModifiers</code> is set to <code>IGNORE_CIPHERTEXT</code>. 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>
194 /// <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 should use the key ARN or alias ARN.</p>
195 /// <p>For example:</p>
196 /// <ul>
197 /// <li>
198 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
199 /// <li>
200 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
201 /// <li>
202 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
203 /// <li>
204 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
205 /// </ul>
206 /// <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>
207 pub fn source_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
208 self.inner = self.inner.source_key_id(input.into());
209 self
210 }
211 /// <p>Specifies the KMS key that KMS will use to decrypt the ciphertext before it is re-encrypted.</p>
212 /// <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>
213 /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key or when <code>DryRun</code> is <code>true</code> and <code>DryRunModifiers</code> is set to <code>IGNORE_CIPHERTEXT</code>. 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>
214 /// <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 should use the key ARN or alias ARN.</p>
215 /// <p>For example:</p>
216 /// <ul>
217 /// <li>
218 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
219 /// <li>
220 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
221 /// <li>
222 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
223 /// <li>
224 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
225 /// </ul>
226 /// <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>
227 pub fn set_source_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
228 self.inner = self.inner.set_source_key_id(input);
229 self
230 }
231 /// <p>Specifies the KMS key that KMS will use to decrypt the ciphertext before it is re-encrypted.</p>
232 /// <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>
233 /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key or when <code>DryRun</code> is <code>true</code> and <code>DryRunModifiers</code> is set to <code>IGNORE_CIPHERTEXT</code>. 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>
234 /// <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 should use the key ARN or alias ARN.</p>
235 /// <p>For example:</p>
236 /// <ul>
237 /// <li>
238 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
239 /// <li>
240 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
241 /// <li>
242 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
243 /// <li>
244 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
245 /// </ul>
246 /// <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>
247 pub fn get_source_key_id(&self) -> &::std::option::Option<::std::string::String> {
248 self.inner.get_source_key_id()
249 }
250 /// <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>
251 /// <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>
252 /// <p>For example:</p>
253 /// <ul>
254 /// <li>
255 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
256 /// <li>
257 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
258 /// <li>
259 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
260 /// <li>
261 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
262 /// </ul>
263 /// <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>
264 pub fn destination_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
265 self.inner = self.inner.destination_key_id(input.into());
266 self
267 }
268 /// <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>
269 /// <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>
270 /// <p>For example:</p>
271 /// <ul>
272 /// <li>
273 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
274 /// <li>
275 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
276 /// <li>
277 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
278 /// <li>
279 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
280 /// </ul>
281 /// <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>
282 pub fn set_destination_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
283 self.inner = self.inner.set_destination_key_id(input);
284 self
285 }
286 /// <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>
287 /// <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>
288 /// <p>For example:</p>
289 /// <ul>
290 /// <li>
291 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
292 /// <li>
293 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
294 /// <li>
295 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
296 /// <li>
297 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
298 /// </ul>
299 /// <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>
300 pub fn get_destination_key_id(&self) -> &::std::option::Option<::std::string::String> {
301 self.inner.get_destination_key_id()
302 }
303 ///
304 /// Adds a key-value pair to `DestinationEncryptionContext`.
305 ///
306 /// To override the contents of this collection use [`set_destination_encryption_context`](Self::set_destination_encryption_context).
307 ///
308 /// <p>Specifies that encryption context to use when the reencrypting the data.</p><important>
309 /// <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>
310 /// </important>
311 /// <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>
312 /// <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>
313 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/encrypt_context.html">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
314 pub fn destination_encryption_context(
315 mut self,
316 k: impl ::std::convert::Into<::std::string::String>,
317 v: impl ::std::convert::Into<::std::string::String>,
318 ) -> Self {
319 self.inner = self.inner.destination_encryption_context(k.into(), v.into());
320 self
321 }
322 /// <p>Specifies that encryption context to use when the reencrypting the data.</p><important>
323 /// <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>
324 /// </important>
325 /// <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>
326 /// <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>
327 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/encrypt_context.html">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
328 pub fn set_destination_encryption_context(
329 mut self,
330 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
331 ) -> Self {
332 self.inner = self.inner.set_destination_encryption_context(input);
333 self
334 }
335 /// <p>Specifies that encryption context to use when the reencrypting the data.</p><important>
336 /// <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>
337 /// </important>
338 /// <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>
339 /// <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>
340 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/encrypt_context.html">Encryption context</a> in the <i>Key Management Service Developer Guide</i>.</p>
341 pub fn get_destination_encryption_context(
342 &self,
343 ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
344 self.inner.get_destination_encryption_context()
345 }
346 /// <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>
347 /// <p>Specify the same algorithm that was used to encrypt the ciphertext. If you specify a different algorithm, the decrypt attempt fails.</p>
348 /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key.</p>
349 pub fn source_encryption_algorithm(mut self, input: crate::types::EncryptionAlgorithmSpec) -> Self {
350 self.inner = self.inner.source_encryption_algorithm(input);
351 self
352 }
353 /// <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>
354 /// <p>Specify the same algorithm that was used to encrypt the ciphertext. If you specify a different algorithm, the decrypt attempt fails.</p>
355 /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key.</p>
356 pub fn set_source_encryption_algorithm(mut self, input: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>) -> Self {
357 self.inner = self.inner.set_source_encryption_algorithm(input);
358 self
359 }
360 /// <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>
361 /// <p>Specify the same algorithm that was used to encrypt the ciphertext. If you specify a different algorithm, the decrypt attempt fails.</p>
362 /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key.</p>
363 pub fn get_source_encryption_algorithm(&self) -> &::std::option::Option<crate::types::EncryptionAlgorithmSpec> {
364 self.inner.get_source_encryption_algorithm()
365 }
366 /// <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>
367 /// <p>This parameter is required only when the destination KMS key is an asymmetric KMS key.</p>
368 pub fn destination_encryption_algorithm(mut self, input: crate::types::EncryptionAlgorithmSpec) -> Self {
369 self.inner = self.inner.destination_encryption_algorithm(input);
370 self
371 }
372 /// <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>
373 /// <p>This parameter is required only when the destination KMS key is an asymmetric KMS key.</p>
374 pub fn set_destination_encryption_algorithm(mut self, input: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>) -> Self {
375 self.inner = self.inner.set_destination_encryption_algorithm(input);
376 self
377 }
378 /// <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>
379 /// <p>This parameter is required only when the destination KMS key is an asymmetric KMS key.</p>
380 pub fn get_destination_encryption_algorithm(&self) -> &::std::option::Option<crate::types::EncryptionAlgorithmSpec> {
381 self.inner.get_destination_encryption_algorithm()
382 }
383 ///
384 /// Appends an item to `GrantTokens`.
385 ///
386 /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
387 ///
388 /// <p>A list of grant tokens.</p>
389 /// <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/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
390 pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
391 self.inner = self.inner.grant_tokens(input.into());
392 self
393 }
394 /// <p>A list of grant tokens.</p>
395 /// <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/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
396 pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
397 self.inner = self.inner.set_grant_tokens(input);
398 self
399 }
400 /// <p>A list of grant tokens.</p>
401 /// <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/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
402 pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
403 self.inner.get_grant_tokens()
404 }
405 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
406 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
407 pub fn dry_run(mut self, input: bool) -> Self {
408 self.inner = self.inner.dry_run(input);
409 self
410 }
411 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
412 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
413 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
414 self.inner = self.inner.set_dry_run(input);
415 self
416 }
417 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
418 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
419 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
420 self.inner.get_dry_run()
421 }
422 ///
423 /// Appends an item to `DryRunModifiers`.
424 ///
425 /// To override the contents of this collection use [`set_dry_run_modifiers`](Self::set_dry_run_modifiers).
426 ///
427 /// <p>Specifies the modifiers to apply to the dry run operation. <code>DryRunModifiers</code> is an optional parameter that only applies when <code>DryRun</code> is set to <code>true</code>.</p>
428 /// <p>When set to <code>IGNORE_CIPHERTEXT</code>, KMS performs only authorization validation without ciphertext validation. This allows you to test permissions without requiring a valid ciphertext blob.</p>
429 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
430 pub fn dry_run_modifiers(mut self, input: crate::types::DryRunModifierType) -> Self {
431 self.inner = self.inner.dry_run_modifiers(input);
432 self
433 }
434 /// <p>Specifies the modifiers to apply to the dry run operation. <code>DryRunModifiers</code> is an optional parameter that only applies when <code>DryRun</code> is set to <code>true</code>.</p>
435 /// <p>When set to <code>IGNORE_CIPHERTEXT</code>, KMS performs only authorization validation without ciphertext validation. This allows you to test permissions without requiring a valid ciphertext blob.</p>
436 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
437 pub fn set_dry_run_modifiers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DryRunModifierType>>) -> Self {
438 self.inner = self.inner.set_dry_run_modifiers(input);
439 self
440 }
441 /// <p>Specifies the modifiers to apply to the dry run operation. <code>DryRunModifiers</code> is an optional parameter that only applies when <code>DryRun</code> is set to <code>true</code>.</p>
442 /// <p>When set to <code>IGNORE_CIPHERTEXT</code>, KMS performs only authorization validation without ciphertext validation. This allows you to test permissions without requiring a valid ciphertext blob.</p>
443 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
444 pub fn get_dry_run_modifiers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DryRunModifierType>> {
445 self.inner.get_dry_run_modifiers()
446 }
447}