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 in the attestation document.</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. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html">How Amazon Web Services Nitro Enclaves uses 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    _request_id: Option<String>,
17}
18impl DecryptOutput {
19    /// <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>
20    pub fn key_id(&self) -> ::std::option::Option<&str> {
21        self.key_id.as_deref()
22    }
23    /// <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>
24    /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
25    pub fn plaintext(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
26        self.plaintext.as_ref()
27    }
28    /// <p>The encryption algorithm that was used to decrypt the ciphertext.</p>
29    pub fn encryption_algorithm(&self) -> ::std::option::Option<&crate::types::EncryptionAlgorithmSpec> {
30        self.encryption_algorithm.as_ref()
31    }
32    /// <p>The plaintext data encrypted with the public key in the attestation document.</p>
33    /// <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. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html">How Amazon Web Services Nitro Enclaves uses KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
34    pub fn ciphertext_for_recipient(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
35        self.ciphertext_for_recipient.as_ref()
36    }
37}
38impl ::std::fmt::Debug for DecryptOutput {
39    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
40        let mut formatter = f.debug_struct("DecryptOutput");
41        formatter.field("key_id", &self.key_id);
42        formatter.field("plaintext", &"*** Sensitive Data Redacted ***");
43        formatter.field("encryption_algorithm", &self.encryption_algorithm);
44        formatter.field("ciphertext_for_recipient", &self.ciphertext_for_recipient);
45        formatter.field("_request_id", &self._request_id);
46        formatter.finish()
47    }
48}
49impl ::aws_types::request_id::RequestId for DecryptOutput {
50    fn request_id(&self) -> Option<&str> {
51        self._request_id.as_deref()
52    }
53}
54impl DecryptOutput {
55    /// Creates a new builder-style object to manufacture [`DecryptOutput`](crate::operation::decrypt::DecryptOutput).
56    pub fn builder() -> crate::operation::decrypt::builders::DecryptOutputBuilder {
57        crate::operation::decrypt::builders::DecryptOutputBuilder::default()
58    }
59}
60
61/// A builder for [`DecryptOutput`](crate::operation::decrypt::DecryptOutput).
62#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
63#[non_exhaustive]
64pub struct DecryptOutputBuilder {
65    pub(crate) key_id: ::std::option::Option<::std::string::String>,
66    pub(crate) plaintext: ::std::option::Option<::aws_smithy_types::Blob>,
67    pub(crate) encryption_algorithm: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>,
68    pub(crate) ciphertext_for_recipient: ::std::option::Option<::aws_smithy_types::Blob>,
69    _request_id: Option<String>,
70}
71impl DecryptOutputBuilder {
72    /// <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>
73    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74        self.key_id = ::std::option::Option::Some(input.into());
75        self
76    }
77    /// <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>
78    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.key_id = input;
80        self
81    }
82    /// <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>
83    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
84        &self.key_id
85    }
86    /// <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>
87    /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
88    pub fn plaintext(mut self, input: ::aws_smithy_types::Blob) -> Self {
89        self.plaintext = ::std::option::Option::Some(input);
90        self
91    }
92    /// <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>
93    /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
94    pub fn set_plaintext(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
95        self.plaintext = input;
96        self
97    }
98    /// <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>
99    /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
100    pub fn get_plaintext(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
101        &self.plaintext
102    }
103    /// <p>The encryption algorithm that was used to decrypt the ciphertext.</p>
104    pub fn encryption_algorithm(mut self, input: crate::types::EncryptionAlgorithmSpec) -> Self {
105        self.encryption_algorithm = ::std::option::Option::Some(input);
106        self
107    }
108    /// <p>The encryption algorithm that was used to decrypt the ciphertext.</p>
109    pub fn set_encryption_algorithm(mut self, input: ::std::option::Option<crate::types::EncryptionAlgorithmSpec>) -> Self {
110        self.encryption_algorithm = input;
111        self
112    }
113    /// <p>The encryption algorithm that was used to decrypt the ciphertext.</p>
114    pub fn get_encryption_algorithm(&self) -> &::std::option::Option<crate::types::EncryptionAlgorithmSpec> {
115        &self.encryption_algorithm
116    }
117    /// <p>The plaintext data encrypted with the public key in the attestation document.</p>
118    /// <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. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html">How Amazon Web Services Nitro Enclaves uses KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
119    pub fn ciphertext_for_recipient(mut self, input: ::aws_smithy_types::Blob) -> Self {
120        self.ciphertext_for_recipient = ::std::option::Option::Some(input);
121        self
122    }
123    /// <p>The plaintext data encrypted with the public key in the attestation document.</p>
124    /// <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. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html">How Amazon Web Services Nitro Enclaves uses KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
125    pub fn set_ciphertext_for_recipient(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
126        self.ciphertext_for_recipient = input;
127        self
128    }
129    /// <p>The plaintext data encrypted with the public key in the attestation document.</p>
130    /// <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. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html">How Amazon Web Services Nitro Enclaves uses KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
131    pub fn get_ciphertext_for_recipient(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
132        &self.ciphertext_for_recipient
133    }
134    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
135        self._request_id = Some(request_id.into());
136        self
137    }
138
139    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
140        self._request_id = request_id;
141        self
142    }
143    /// Consumes the builder and constructs a [`DecryptOutput`](crate::operation::decrypt::DecryptOutput).
144    pub fn build(self) -> crate::operation::decrypt::DecryptOutput {
145        crate::operation::decrypt::DecryptOutput {
146            key_id: self.key_id,
147            plaintext: self.plaintext,
148            encryption_algorithm: self.encryption_algorithm,
149            ciphertext_for_recipient: self.ciphertext_for_recipient,
150            _request_id: self._request_id,
151        }
152    }
153}
154impl ::std::fmt::Debug for DecryptOutputBuilder {
155    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
156        let mut formatter = f.debug_struct("DecryptOutputBuilder");
157        formatter.field("key_id", &self.key_id);
158        formatter.field("plaintext", &"*** Sensitive Data Redacted ***");
159        formatter.field("encryption_algorithm", &self.encryption_algorithm);
160        formatter.field("ciphertext_for_recipient", &self.ciphertext_for_recipient);
161        formatter.field("_request_id", &self._request_id);
162        formatter.finish()
163    }
164}