aws_sdk_kms/operation/decrypt/_decrypt_output.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 DecryptOutput {
6 /// <p>The Amazon Resource Name (<a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN">key ARN</a>) of the KMS key that was used to decrypt the ciphertext.</p>
7 pub key_id: ::std::option::Option<::std::string::String>,
8 /// <p>Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
9 /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
10 pub plaintext: ::std::option::Option<::aws_smithy_types::Blob>,
11 /// <p>The encryption algorithm that was used to decrypt the ciphertext.</p>
12 pub encryption_algorithm: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>,
13 /// <p>The plaintext data encrypted with the public key from the attestation document. This ciphertext can be decrypted only by using a private key from the attested environment.</p>
14 /// <p>This field is included in the response only when the <code>Recipient</code> parameter in the request includes a valid attestation document from an Amazon Web Services Nitro enclave or NitroTPM. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves or Amazon Web Services NitroTPM, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/cryptographic-attestation.html">Cryptographic attestation support in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
15 pub ciphertext_for_recipient: ::std::option::Option<::aws_smithy_types::Blob>,
16 /// <p>The identifier of the key material used to decrypt the ciphertext. This field is present only when the operation uses a symmetric encryption KMS key. This field is omitted if the request includes the <code>Recipient</code> parameter.</p>
17 pub key_material_id: ::std::option::Option<::std::string::String>,
18 _request_id: Option<String>,
19}
20impl DecryptOutput {
21 /// <p>The Amazon Resource Name (<a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN">key ARN</a>) of the KMS key that was used to decrypt the ciphertext.</p>
22 pub fn key_id(&self) -> ::std::option::Option<&str> {
23 self.key_id.as_deref()
24 }
25 /// <p>Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
26 /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
27 pub fn plaintext(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
28 self.plaintext.as_ref()
29 }
30 /// <p>The encryption algorithm that was used to decrypt the ciphertext.</p>
31 pub fn encryption_algorithm(&self) -> ::std::option::Option<&crate::types::EncryptionAlgorithmSpec> {
32 self.encryption_algorithm.as_ref()
33 }
34 /// <p>The plaintext data encrypted with the public key from the attestation document. This ciphertext can be decrypted only by using a private key from the attested environment.</p>
35 /// <p>This field is included in the response only when the <code>Recipient</code> parameter in the request includes a valid attestation document from an Amazon Web Services Nitro enclave or NitroTPM. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves or Amazon Web Services NitroTPM, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/cryptographic-attestation.html">Cryptographic attestation support in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
36 pub fn ciphertext_for_recipient(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
37 self.ciphertext_for_recipient.as_ref()
38 }
39 /// <p>The identifier of the key material used to decrypt the ciphertext. This field is present only when the operation uses a symmetric encryption KMS key. This field is omitted if the request includes the <code>Recipient</code> parameter.</p>
40 pub fn key_material_id(&self) -> ::std::option::Option<&str> {
41 self.key_material_id.as_deref()
42 }
43}
44impl ::std::fmt::Debug for DecryptOutput {
45 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
46 let mut formatter = f.debug_struct("DecryptOutput");
47 formatter.field("key_id", &self.key_id);
48 formatter.field("plaintext", &"*** Sensitive Data Redacted ***");
49 formatter.field("encryption_algorithm", &self.encryption_algorithm);
50 formatter.field("ciphertext_for_recipient", &self.ciphertext_for_recipient);
51 formatter.field("key_material_id", &self.key_material_id);
52 formatter.field("_request_id", &self._request_id);
53 formatter.finish()
54 }
55}
56impl ::aws_types::request_id::RequestId for DecryptOutput {
57 fn request_id(&self) -> Option<&str> {
58 self._request_id.as_deref()
59 }
60}
61impl DecryptOutput {
62 /// Creates a new builder-style object to manufacture [`DecryptOutput`](crate::operation::decrypt::DecryptOutput).
63 pub fn builder() -> crate::operation::decrypt::builders::DecryptOutputBuilder {
64 crate::operation::decrypt::builders::DecryptOutputBuilder::default()
65 }
66}
67
68/// A builder for [`DecryptOutput`](crate::operation::decrypt::DecryptOutput).
69#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
70#[non_exhaustive]
71pub struct DecryptOutputBuilder {
72 pub(crate) key_id: ::std::option::Option<::std::string::String>,
73 pub(crate) plaintext: ::std::option::Option<::aws_smithy_types::Blob>,
74 pub(crate) encryption_algorithm: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>,
75 pub(crate) ciphertext_for_recipient: ::std::option::Option<::aws_smithy_types::Blob>,
76 pub(crate) key_material_id: ::std::option::Option<::std::string::String>,
77 _request_id: Option<String>,
78}
79impl DecryptOutputBuilder {
80 /// <p>The Amazon Resource Name (<a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN">key ARN</a>) of the KMS key that was used to decrypt the ciphertext.</p>
81 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82 self.key_id = ::std::option::Option::Some(input.into());
83 self
84 }
85 /// <p>The Amazon Resource Name (<a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN">key ARN</a>) of the KMS key that was used to decrypt the ciphertext.</p>
86 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87 self.key_id = input;
88 self
89 }
90 /// <p>The Amazon Resource Name (<a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN">key ARN</a>) of the KMS key that was used to decrypt the ciphertext.</p>
91 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
92 &self.key_id
93 }
94 /// <p>Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
95 /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
96 pub fn plaintext(mut self, input: ::aws_smithy_types::Blob) -> Self {
97 self.plaintext = ::std::option::Option::Some(input);
98 self
99 }
100 /// <p>Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
101 /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
102 pub fn set_plaintext(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
103 self.plaintext = input;
104 self
105 }
106 /// <p>Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
107 /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
108 pub fn get_plaintext(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
109 &self.plaintext
110 }
111 /// <p>The encryption algorithm that was used to decrypt the ciphertext.</p>
112 pub fn encryption_algorithm(mut self, input: crate::types::EncryptionAlgorithmSpec) -> Self {
113 self.encryption_algorithm = ::std::option::Option::Some(input);
114 self
115 }
116 /// <p>The encryption algorithm that was used to decrypt the ciphertext.</p>
117 pub fn set_encryption_algorithm(mut self, input: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>) -> Self {
118 self.encryption_algorithm = input;
119 self
120 }
121 /// <p>The encryption algorithm that was used to decrypt the ciphertext.</p>
122 pub fn get_encryption_algorithm(&self) -> &::std::option::Option<crate::types::EncryptionAlgorithmSpec> {
123 &self.encryption_algorithm
124 }
125 /// <p>The plaintext data encrypted with the public key from the attestation document. This ciphertext can be decrypted only by using a private key from the attested environment.</p>
126 /// <p>This field is included in the response only when the <code>Recipient</code> parameter in the request includes a valid attestation document from an Amazon Web Services Nitro enclave or NitroTPM. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves or Amazon Web Services NitroTPM, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/cryptographic-attestation.html">Cryptographic attestation support in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
127 pub fn ciphertext_for_recipient(mut self, input: ::aws_smithy_types::Blob) -> Self {
128 self.ciphertext_for_recipient = ::std::option::Option::Some(input);
129 self
130 }
131 /// <p>The plaintext data encrypted with the public key from the attestation document. This ciphertext can be decrypted only by using a private key from the attested environment.</p>
132 /// <p>This field is included in the response only when the <code>Recipient</code> parameter in the request includes a valid attestation document from an Amazon Web Services Nitro enclave or NitroTPM. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves or Amazon Web Services NitroTPM, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/cryptographic-attestation.html">Cryptographic attestation support in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
133 pub fn set_ciphertext_for_recipient(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
134 self.ciphertext_for_recipient = input;
135 self
136 }
137 /// <p>The plaintext data encrypted with the public key from the attestation document. This ciphertext can be decrypted only by using a private key from the attested environment.</p>
138 /// <p>This field is included in the response only when the <code>Recipient</code> parameter in the request includes a valid attestation document from an Amazon Web Services Nitro enclave or NitroTPM. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves or Amazon Web Services NitroTPM, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/cryptographic-attestation.html">Cryptographic attestation support in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
139 pub fn get_ciphertext_for_recipient(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
140 &self.ciphertext_for_recipient
141 }
142 /// <p>The identifier of the key material used to decrypt the ciphertext. This field is present only when the operation uses a symmetric encryption KMS key. This field is omitted if the request includes the <code>Recipient</code> parameter.</p>
143 pub fn key_material_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144 self.key_material_id = ::std::option::Option::Some(input.into());
145 self
146 }
147 /// <p>The identifier of the key material used to decrypt the ciphertext. This field is present only when the operation uses a symmetric encryption KMS key. This field is omitted if the request includes the <code>Recipient</code> parameter.</p>
148 pub fn set_key_material_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149 self.key_material_id = input;
150 self
151 }
152 /// <p>The identifier of the key material used to decrypt the ciphertext. This field is present only when the operation uses a symmetric encryption KMS key. This field is omitted if the request includes the <code>Recipient</code> parameter.</p>
153 pub fn get_key_material_id(&self) -> &::std::option::Option<::std::string::String> {
154 &self.key_material_id
155 }
156 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
157 self._request_id = Some(request_id.into());
158 self
159 }
160
161 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
162 self._request_id = request_id;
163 self
164 }
165 /// Consumes the builder and constructs a [`DecryptOutput`](crate::operation::decrypt::DecryptOutput).
166 pub fn build(self) -> crate::operation::decrypt::DecryptOutput {
167 crate::operation::decrypt::DecryptOutput {
168 key_id: self.key_id,
169 plaintext: self.plaintext,
170 encryption_algorithm: self.encryption_algorithm,
171 ciphertext_for_recipient: self.ciphertext_for_recipient,
172 key_material_id: self.key_material_id,
173 _request_id: self._request_id,
174 }
175 }
176}
177impl ::std::fmt::Debug for DecryptOutputBuilder {
178 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
179 let mut formatter = f.debug_struct("DecryptOutputBuilder");
180 formatter.field("key_id", &self.key_id);
181 formatter.field("plaintext", &"*** Sensitive Data Redacted ***");
182 formatter.field("encryption_algorithm", &self.encryption_algorithm);
183 formatter.field("ciphertext_for_recipient", &self.ciphertext_for_recipient);
184 formatter.field("key_material_id", &self.key_material_id);
185 formatter.field("_request_id", &self._request_id);
186 formatter.finish()
187 }
188}