aws_sdk_kms/operation/encrypt/_encrypt_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct EncryptInput {
6 /// <p>Identifies the KMS key to use in the encryption operation. The KMS key must have a <code>KeyUsage</code> of <code>ENCRYPT_DECRYPT</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
7 /// <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>
8 /// <p>For example:</p>
9 /// <ul>
10 /// <li>
11 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
12 /// <li>
13 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
14 /// <li>
15 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
16 /// <li>
17 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
18 /// </ul>
19 /// <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>
20 pub key_id: ::std::option::Option<::std::string::String>,
21 /// <p>Data to be encrypted.</p>
22 pub plaintext: ::std::option::Option<::aws_smithy_types::Blob>,
23 /// <p>Specifies the encryption context that will be used to encrypt the data. An encryption context is valid only for <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> with a symmetric encryption KMS key. The standard asymmetric encryption algorithms and HMAC algorithms that KMS uses do not support an encryption context.</p><important>
24 /// <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>
25 /// </important>
26 /// <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>
27 /// <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>
28 pub encryption_context: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
29 /// <p>A list of grant tokens.</p>
30 /// <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>
31 pub grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
32 /// <p>Specifies the encryption algorithm that KMS will use to encrypt the plaintext message. The algorithm must be compatible with the KMS key that you specify.</p>
33 /// <p>This parameter is required only for asymmetric KMS keys. The default value, <code>SYMMETRIC_DEFAULT</code>, is the algorithm used for symmetric encryption KMS keys. If you are using an asymmetric KMS key, we recommend RSAES_OAEP_SHA_256.</p>
34 /// <p>The SM2PKE algorithm is only available in China Regions.</p>
35 pub encryption_algorithm: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>,
36 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
37 /// <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>
38 pub dry_run: ::std::option::Option<bool>,
39}
40impl EncryptInput {
41 /// <p>Identifies the KMS key to use in the encryption operation. The KMS key must have a <code>KeyUsage</code> of <code>ENCRYPT_DECRYPT</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
42 /// <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>
43 /// <p>For example:</p>
44 /// <ul>
45 /// <li>
46 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
47 /// <li>
48 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
49 /// <li>
50 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
51 /// <li>
52 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
53 /// </ul>
54 /// <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>
55 pub fn key_id(&self) -> ::std::option::Option<&str> {
56 self.key_id.as_deref()
57 }
58 /// <p>Data to be encrypted.</p>
59 pub fn plaintext(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
60 self.plaintext.as_ref()
61 }
62 /// <p>Specifies the encryption context that will be used to encrypt the data. An encryption context is valid only for <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> with a symmetric encryption KMS key. The standard asymmetric encryption algorithms and HMAC algorithms that KMS uses do not support an encryption context.</p><important>
63 /// <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>
64 /// </important>
65 /// <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>
66 /// <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>
67 pub fn encryption_context(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
68 self.encryption_context.as_ref()
69 }
70 /// <p>A list of grant tokens.</p>
71 /// <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>
72 ///
73 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.grant_tokens.is_none()`.
74 pub fn grant_tokens(&self) -> &[::std::string::String] {
75 self.grant_tokens.as_deref().unwrap_or_default()
76 }
77 /// <p>Specifies the encryption algorithm that KMS will use to encrypt the plaintext message. The algorithm must be compatible with the KMS key that you specify.</p>
78 /// <p>This parameter is required only for asymmetric KMS keys. The default value, <code>SYMMETRIC_DEFAULT</code>, is the algorithm used for symmetric encryption KMS keys. If you are using an asymmetric KMS key, we recommend RSAES_OAEP_SHA_256.</p>
79 /// <p>The SM2PKE algorithm is only available in China Regions.</p>
80 pub fn encryption_algorithm(&self) -> ::std::option::Option<&crate::types::EncryptionAlgorithmSpec> {
81 self.encryption_algorithm.as_ref()
82 }
83 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
84 /// <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>
85 pub fn dry_run(&self) -> ::std::option::Option<bool> {
86 self.dry_run
87 }
88}
89impl ::std::fmt::Debug for EncryptInput {
90 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
91 let mut formatter = f.debug_struct("EncryptInput");
92 formatter.field("key_id", &self.key_id);
93 formatter.field("plaintext", &"*** Sensitive Data Redacted ***");
94 formatter.field("encryption_context", &self.encryption_context);
95 formatter.field("grant_tokens", &self.grant_tokens);
96 formatter.field("encryption_algorithm", &self.encryption_algorithm);
97 formatter.field("dry_run", &self.dry_run);
98 formatter.finish()
99 }
100}
101impl EncryptInput {
102 /// Creates a new builder-style object to manufacture [`EncryptInput`](crate::operation::encrypt::EncryptInput).
103 pub fn builder() -> crate::operation::encrypt::builders::EncryptInputBuilder {
104 crate::operation::encrypt::builders::EncryptInputBuilder::default()
105 }
106}
107
108/// A builder for [`EncryptInput`](crate::operation::encrypt::EncryptInput).
109#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
110#[non_exhaustive]
111pub struct EncryptInputBuilder {
112 pub(crate) key_id: ::std::option::Option<::std::string::String>,
113 pub(crate) plaintext: ::std::option::Option<::aws_smithy_types::Blob>,
114 pub(crate) encryption_context: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
115 pub(crate) grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
116 pub(crate) encryption_algorithm: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>,
117 pub(crate) dry_run: ::std::option::Option<bool>,
118}
119impl EncryptInputBuilder {
120 /// <p>Identifies the KMS key to use in the encryption operation. The KMS key must have a <code>KeyUsage</code> of <code>ENCRYPT_DECRYPT</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
121 /// <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>
122 /// <p>For example:</p>
123 /// <ul>
124 /// <li>
125 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
126 /// <li>
127 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
128 /// <li>
129 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
130 /// <li>
131 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
132 /// </ul>
133 /// <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>
134 /// This field is required.
135 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136 self.key_id = ::std::option::Option::Some(input.into());
137 self
138 }
139 /// <p>Identifies the KMS key to use in the encryption operation. The KMS key must have a <code>KeyUsage</code> of <code>ENCRYPT_DECRYPT</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
140 /// <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>
141 /// <p>For example:</p>
142 /// <ul>
143 /// <li>
144 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
145 /// <li>
146 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
147 /// <li>
148 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
149 /// <li>
150 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
151 /// </ul>
152 /// <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>
153 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154 self.key_id = input;
155 self
156 }
157 /// <p>Identifies the KMS key to use in the encryption operation. The KMS key must have a <code>KeyUsage</code> of <code>ENCRYPT_DECRYPT</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
158 /// <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>
159 /// <p>For example:</p>
160 /// <ul>
161 /// <li>
162 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
163 /// <li>
164 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
165 /// <li>
166 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
167 /// <li>
168 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
169 /// </ul>
170 /// <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>
171 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
172 &self.key_id
173 }
174 /// <p>Data to be encrypted.</p>
175 /// This field is required.
176 pub fn plaintext(mut self, input: ::aws_smithy_types::Blob) -> Self {
177 self.plaintext = ::std::option::Option::Some(input);
178 self
179 }
180 /// <p>Data to be encrypted.</p>
181 pub fn set_plaintext(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
182 self.plaintext = input;
183 self
184 }
185 /// <p>Data to be encrypted.</p>
186 pub fn get_plaintext(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
187 &self.plaintext
188 }
189 /// Adds a key-value pair to `encryption_context`.
190 ///
191 /// To override the contents of this collection use [`set_encryption_context`](Self::set_encryption_context).
192 ///
193 /// <p>Specifies the encryption context that will be used to encrypt the data. An encryption context is valid only for <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> with a symmetric encryption KMS key. The standard asymmetric encryption algorithms and HMAC algorithms that KMS uses do not support an encryption context.</p><important>
194 /// <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>
195 /// </important>
196 /// <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>
197 /// <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>
198 pub fn encryption_context(
199 mut self,
200 k: impl ::std::convert::Into<::std::string::String>,
201 v: impl ::std::convert::Into<::std::string::String>,
202 ) -> Self {
203 let mut hash_map = self.encryption_context.unwrap_or_default();
204 hash_map.insert(k.into(), v.into());
205 self.encryption_context = ::std::option::Option::Some(hash_map);
206 self
207 }
208 /// <p>Specifies the encryption context that will be used to encrypt the data. An encryption context is valid only for <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> with a symmetric encryption KMS key. The standard asymmetric encryption algorithms and HMAC algorithms that KMS uses do not support an encryption context.</p><important>
209 /// <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>
210 /// </important>
211 /// <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>
212 /// <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>
213 pub fn set_encryption_context(
214 mut self,
215 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
216 ) -> Self {
217 self.encryption_context = input;
218 self
219 }
220 /// <p>Specifies the encryption context that will be used to encrypt the data. An encryption context is valid only for <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> with a symmetric encryption KMS key. The standard asymmetric encryption algorithms and HMAC algorithms that KMS uses do not support an encryption context.</p><important>
221 /// <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>
222 /// </important>
223 /// <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>
224 /// <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>
225 pub fn get_encryption_context(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
226 &self.encryption_context
227 }
228 /// Appends an item to `grant_tokens`.
229 ///
230 /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
231 ///
232 /// <p>A list of grant tokens.</p>
233 /// <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>
234 pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
235 let mut v = self.grant_tokens.unwrap_or_default();
236 v.push(input.into());
237 self.grant_tokens = ::std::option::Option::Some(v);
238 self
239 }
240 /// <p>A list of grant tokens.</p>
241 /// <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>
242 pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
243 self.grant_tokens = input;
244 self
245 }
246 /// <p>A list of grant tokens.</p>
247 /// <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>
248 pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
249 &self.grant_tokens
250 }
251 /// <p>Specifies the encryption algorithm that KMS will use to encrypt the plaintext message. The algorithm must be compatible with the KMS key that you specify.</p>
252 /// <p>This parameter is required only for asymmetric KMS keys. The default value, <code>SYMMETRIC_DEFAULT</code>, is the algorithm used for symmetric encryption KMS keys. If you are using an asymmetric KMS key, we recommend RSAES_OAEP_SHA_256.</p>
253 /// <p>The SM2PKE algorithm is only available in China Regions.</p>
254 pub fn encryption_algorithm(mut self, input: crate::types::EncryptionAlgorithmSpec) -> Self {
255 self.encryption_algorithm = ::std::option::Option::Some(input);
256 self
257 }
258 /// <p>Specifies the encryption algorithm that KMS will use to encrypt the plaintext message. The algorithm must be compatible with the KMS key that you specify.</p>
259 /// <p>This parameter is required only for asymmetric KMS keys. The default value, <code>SYMMETRIC_DEFAULT</code>, is the algorithm used for symmetric encryption KMS keys. If you are using an asymmetric KMS key, we recommend RSAES_OAEP_SHA_256.</p>
260 /// <p>The SM2PKE algorithm is only available in China Regions.</p>
261 pub fn set_encryption_algorithm(mut self, input: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>) -> Self {
262 self.encryption_algorithm = input;
263 self
264 }
265 /// <p>Specifies the encryption algorithm that KMS will use to encrypt the plaintext message. The algorithm must be compatible with the KMS key that you specify.</p>
266 /// <p>This parameter is required only for asymmetric KMS keys. The default value, <code>SYMMETRIC_DEFAULT</code>, is the algorithm used for symmetric encryption KMS keys. If you are using an asymmetric KMS key, we recommend RSAES_OAEP_SHA_256.</p>
267 /// <p>The SM2PKE algorithm is only available in China Regions.</p>
268 pub fn get_encryption_algorithm(&self) -> &::std::option::Option<crate::types::EncryptionAlgorithmSpec> {
269 &self.encryption_algorithm
270 }
271 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
272 /// <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>
273 pub fn dry_run(mut self, input: bool) -> Self {
274 self.dry_run = ::std::option::Option::Some(input);
275 self
276 }
277 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
278 /// <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>
279 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
280 self.dry_run = input;
281 self
282 }
283 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
284 /// <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>
285 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
286 &self.dry_run
287 }
288 /// Consumes the builder and constructs a [`EncryptInput`](crate::operation::encrypt::EncryptInput).
289 pub fn build(self) -> ::std::result::Result<crate::operation::encrypt::EncryptInput, ::aws_smithy_types::error::operation::BuildError> {
290 ::std::result::Result::Ok(crate::operation::encrypt::EncryptInput {
291 key_id: self.key_id,
292 plaintext: self.plaintext,
293 encryption_context: self.encryption_context,
294 grant_tokens: self.grant_tokens,
295 encryption_algorithm: self.encryption_algorithm,
296 dry_run: self.dry_run,
297 })
298 }
299}
300impl ::std::fmt::Debug for EncryptInputBuilder {
301 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
302 let mut formatter = f.debug_struct("EncryptInputBuilder");
303 formatter.field("key_id", &self.key_id);
304 formatter.field("plaintext", &"*** Sensitive Data Redacted ***");
305 formatter.field("encryption_context", &self.encryption_context);
306 formatter.field("grant_tokens", &self.grant_tokens);
307 formatter.field("encryption_algorithm", &self.encryption_algorithm);
308 formatter.field("dry_run", &self.dry_run);
309 formatter.finish()
310 }
311}