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>
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/accessing-kms.html#programming-eventual-consistency">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 /// <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>
142 pub fn ciphertext_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
143 self.inner = self.inner.ciphertext_blob(input);
144 self
145 }
146 /// <p>Ciphertext of the data to reencrypt.</p>
147 /// <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>
148 pub fn set_ciphertext_blob(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
149 self.inner = self.inner.set_ciphertext_blob(input);
150 self
151 }
152 /// <p>Ciphertext of the data to reencrypt.</p>
153 /// <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>
154 pub fn get_ciphertext_blob(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
155 self.inner.get_ciphertext_blob()
156 }
157 ///
158 /// Adds a key-value pair to `SourceEncryptionContext`.
159 ///
160 /// To override the contents of this collection use [`set_source_encryption_context`](Self::set_source_encryption_context).
161 ///
162 /// <p>Specifies the encryption context to use to decrypt the ciphertext. Enter the same encryption context that was used to encrypt the ciphertext.</p>
163 /// <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>
164 /// <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>
165 pub fn source_encryption_context(
166 mut self,
167 k: impl ::std::convert::Into<::std::string::String>,
168 v: impl ::std::convert::Into<::std::string::String>,
169 ) -> Self {
170 self.inner = self.inner.source_encryption_context(k.into(), v.into());
171 self
172 }
173 /// <p>Specifies the encryption context to use to decrypt the ciphertext. Enter the same encryption context that was used to encrypt the ciphertext.</p>
174 /// <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>
175 /// <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>
176 pub fn set_source_encryption_context(
177 mut self,
178 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
179 ) -> Self {
180 self.inner = self.inner.set_source_encryption_context(input);
181 self
182 }
183 /// <p>Specifies the encryption context to use to decrypt the ciphertext. Enter the same encryption context that was used to encrypt the ciphertext.</p>
184 /// <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>
185 /// <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>
186 pub fn get_source_encryption_context(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
187 self.inner.get_source_encryption_context()
188 }
189 /// <p>Specifies the KMS key that KMS will use to decrypt the ciphertext before it is re-encrypted.</p>
190 /// <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>
191 /// <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>
192 /// <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>
193 /// <p>For example:</p>
194 /// <ul>
195 /// <li>
196 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
197 /// <li>
198 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
199 /// <li>
200 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
201 /// <li>
202 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
203 /// </ul>
204 /// <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>
205 pub fn source_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
206 self.inner = self.inner.source_key_id(input.into());
207 self
208 }
209 /// <p>Specifies the KMS key that KMS will use to decrypt the ciphertext before it is re-encrypted.</p>
210 /// <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>
211 /// <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>
212 /// <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>
213 /// <p>For example:</p>
214 /// <ul>
215 /// <li>
216 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
217 /// <li>
218 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
219 /// <li>
220 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
221 /// <li>
222 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
223 /// </ul>
224 /// <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>
225 pub fn set_source_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
226 self.inner = self.inner.set_source_key_id(input);
227 self
228 }
229 /// <p>Specifies the KMS key that KMS will use to decrypt the ciphertext before it is re-encrypted.</p>
230 /// <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>
231 /// <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>
232 /// <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>
233 /// <p>For example:</p>
234 /// <ul>
235 /// <li>
236 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
237 /// <li>
238 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
239 /// <li>
240 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
241 /// <li>
242 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
243 /// </ul>
244 /// <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>
245 pub fn get_source_key_id(&self) -> &::std::option::Option<::std::string::String> {
246 self.inner.get_source_key_id()
247 }
248 /// <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>
249 /// <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>
250 /// <p>For example:</p>
251 /// <ul>
252 /// <li>
253 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
254 /// <li>
255 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
256 /// <li>
257 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
258 /// <li>
259 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
260 /// </ul>
261 /// <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>
262 pub fn destination_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
263 self.inner = self.inner.destination_key_id(input.into());
264 self
265 }
266 /// <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>
267 /// <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>
268 /// <p>For example:</p>
269 /// <ul>
270 /// <li>
271 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
272 /// <li>
273 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
274 /// <li>
275 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
276 /// <li>
277 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
278 /// </ul>
279 /// <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>
280 pub fn set_destination_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
281 self.inner = self.inner.set_destination_key_id(input);
282 self
283 }
284 /// <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>
285 /// <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>
286 /// <p>For example:</p>
287 /// <ul>
288 /// <li>
289 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
290 /// <li>
291 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
292 /// <li>
293 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
294 /// <li>
295 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
296 /// </ul>
297 /// <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>
298 pub fn get_destination_key_id(&self) -> &::std::option::Option<::std::string::String> {
299 self.inner.get_destination_key_id()
300 }
301 ///
302 /// Adds a key-value pair to `DestinationEncryptionContext`.
303 ///
304 /// To override the contents of this collection use [`set_destination_encryption_context`](Self::set_destination_encryption_context).
305 ///
306 /// <p>Specifies that encryption context to use when the reencrypting the data.</p><important>
307 /// <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>
308 /// </important>
309 /// <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>
310 /// <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>
311 /// <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>
312 pub fn destination_encryption_context(
313 mut self,
314 k: impl ::std::convert::Into<::std::string::String>,
315 v: impl ::std::convert::Into<::std::string::String>,
316 ) -> Self {
317 self.inner = self.inner.destination_encryption_context(k.into(), v.into());
318 self
319 }
320 /// <p>Specifies that encryption context to use when the reencrypting the data.</p><important>
321 /// <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>
322 /// </important>
323 /// <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>
324 /// <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>
325 /// <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>
326 pub fn set_destination_encryption_context(
327 mut self,
328 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
329 ) -> Self {
330 self.inner = self.inner.set_destination_encryption_context(input);
331 self
332 }
333 /// <p>Specifies that encryption context to use when the reencrypting the data.</p><important>
334 /// <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>
335 /// </important>
336 /// <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>
337 /// <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>
338 /// <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>
339 pub fn get_destination_encryption_context(
340 &self,
341 ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
342 self.inner.get_destination_encryption_context()
343 }
344 /// <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>
345 /// <p>Specify the same algorithm that was used to encrypt the ciphertext. If you specify a different algorithm, the decrypt attempt fails.</p>
346 /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key.</p>
347 pub fn source_encryption_algorithm(mut self, input: crate::types::EncryptionAlgorithmSpec) -> Self {
348 self.inner = self.inner.source_encryption_algorithm(input);
349 self
350 }
351 /// <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>
352 /// <p>Specify the same algorithm that was used to encrypt the ciphertext. If you specify a different algorithm, the decrypt attempt fails.</p>
353 /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key.</p>
354 pub fn set_source_encryption_algorithm(mut self, input: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>) -> Self {
355 self.inner = self.inner.set_source_encryption_algorithm(input);
356 self
357 }
358 /// <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>
359 /// <p>Specify the same algorithm that was used to encrypt the ciphertext. If you specify a different algorithm, the decrypt attempt fails.</p>
360 /// <p>This parameter is required only when the ciphertext was encrypted under an asymmetric KMS key.</p>
361 pub fn get_source_encryption_algorithm(&self) -> &::std::option::Option<crate::types::EncryptionAlgorithmSpec> {
362 self.inner.get_source_encryption_algorithm()
363 }
364 /// <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>
365 /// <p>This parameter is required only when the destination KMS key is an asymmetric KMS key.</p>
366 pub fn destination_encryption_algorithm(mut self, input: crate::types::EncryptionAlgorithmSpec) -> Self {
367 self.inner = self.inner.destination_encryption_algorithm(input);
368 self
369 }
370 /// <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>
371 /// <p>This parameter is required only when the destination KMS key is an asymmetric KMS key.</p>
372 pub fn set_destination_encryption_algorithm(mut self, input: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>) -> Self {
373 self.inner = self.inner.set_destination_encryption_algorithm(input);
374 self
375 }
376 /// <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>
377 /// <p>This parameter is required only when the destination KMS key is an asymmetric KMS key.</p>
378 pub fn get_destination_encryption_algorithm(&self) -> &::std::option::Option<crate::types::EncryptionAlgorithmSpec> {
379 self.inner.get_destination_encryption_algorithm()
380 }
381 ///
382 /// Appends an item to `GrantTokens`.
383 ///
384 /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
385 ///
386 /// <p>A list of grant tokens.</p>
387 /// <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>
388 pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
389 self.inner = self.inner.grant_tokens(input.into());
390 self
391 }
392 /// <p>A list of grant tokens.</p>
393 /// <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>
394 pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
395 self.inner = self.inner.set_grant_tokens(input);
396 self
397 }
398 /// <p>A list of grant tokens.</p>
399 /// <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>
400 pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
401 self.inner.get_grant_tokens()
402 }
403 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
404 /// <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>
405 pub fn dry_run(mut self, input: bool) -> Self {
406 self.inner = self.inner.dry_run(input);
407 self
408 }
409 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
410 /// <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>
411 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
412 self.inner = self.inner.set_dry_run(input);
413 self
414 }
415 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
416 /// <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>
417 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
418 self.inner.get_dry_run()
419 }
420 ///
421 /// Appends an item to `DryRunModifiers`.
422 ///
423 /// To override the contents of this collection use [`set_dry_run_modifiers`](Self::set_dry_run_modifiers).
424 ///
425 /// <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>
426 /// <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>
427 /// <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>
428 pub fn dry_run_modifiers(mut self, input: crate::types::DryRunModifierType) -> Self {
429 self.inner = self.inner.dry_run_modifiers(input);
430 self
431 }
432 /// <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>
433 /// <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>
434 /// <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>
435 pub fn set_dry_run_modifiers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DryRunModifierType>>) -> Self {
436 self.inner = self.inner.set_dry_run_modifiers(input);
437 self
438 }
439 /// <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>
440 /// <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>
441 /// <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>
442 pub fn get_dry_run_modifiers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DryRunModifierType>> {
443 self.inner.get_dry_run_modifiers()
444 }
445}