aws_sdk_kms/operation/generate_random/
_generate_random_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 GenerateRandomOutput {
6    /// <p>The random byte string. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
7    /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
8    pub plaintext: ::std::option::Option<::aws_smithy_types::Blob>,
9    /// <p>The plaintext random bytes encrypted with the public key from the Nitro enclave. This ciphertext can be decrypted only by using a private key in the Nitro enclave.</p>
10    /// <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>
11    pub ciphertext_for_recipient: ::std::option::Option<::aws_smithy_types::Blob>,
12    _request_id: Option<String>,
13}
14impl GenerateRandomOutput {
15    /// <p>The random byte string. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
16    /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
17    pub fn plaintext(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
18        self.plaintext.as_ref()
19    }
20    /// <p>The plaintext random bytes encrypted with the public key from the Nitro enclave. This ciphertext can be decrypted only by using a private key in the Nitro enclave.</p>
21    /// <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>
22    pub fn ciphertext_for_recipient(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
23        self.ciphertext_for_recipient.as_ref()
24    }
25}
26impl ::std::fmt::Debug for GenerateRandomOutput {
27    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
28        let mut formatter = f.debug_struct("GenerateRandomOutput");
29        formatter.field("plaintext", &"*** Sensitive Data Redacted ***");
30        formatter.field("ciphertext_for_recipient", &self.ciphertext_for_recipient);
31        formatter.field("_request_id", &self._request_id);
32        formatter.finish()
33    }
34}
35impl ::aws_types::request_id::RequestId for GenerateRandomOutput {
36    fn request_id(&self) -> Option<&str> {
37        self._request_id.as_deref()
38    }
39}
40impl GenerateRandomOutput {
41    /// Creates a new builder-style object to manufacture [`GenerateRandomOutput`](crate::operation::generate_random::GenerateRandomOutput).
42    pub fn builder() -> crate::operation::generate_random::builders::GenerateRandomOutputBuilder {
43        crate::operation::generate_random::builders::GenerateRandomOutputBuilder::default()
44    }
45}
46
47/// A builder for [`GenerateRandomOutput`](crate::operation::generate_random::GenerateRandomOutput).
48#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
49#[non_exhaustive]
50pub struct GenerateRandomOutputBuilder {
51    pub(crate) plaintext: ::std::option::Option<::aws_smithy_types::Blob>,
52    pub(crate) ciphertext_for_recipient: ::std::option::Option<::aws_smithy_types::Blob>,
53    _request_id: Option<String>,
54}
55impl GenerateRandomOutputBuilder {
56    /// <p>The random byte string. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
57    /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
58    pub fn plaintext(mut self, input: ::aws_smithy_types::Blob) -> Self {
59        self.plaintext = ::std::option::Option::Some(input);
60        self
61    }
62    /// <p>The random byte string. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
63    /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
64    pub fn set_plaintext(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
65        self.plaintext = input;
66        self
67    }
68    /// <p>The random byte string. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
69    /// <p>If the response includes the <code>CiphertextForRecipient</code> field, the <code>Plaintext</code> field is null or empty.</p>
70    pub fn get_plaintext(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
71        &self.plaintext
72    }
73    /// <p>The plaintext random bytes encrypted with the public key from the Nitro enclave. This ciphertext can be decrypted only by using a private key in the Nitro enclave.</p>
74    /// <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>
75    pub fn ciphertext_for_recipient(mut self, input: ::aws_smithy_types::Blob) -> Self {
76        self.ciphertext_for_recipient = ::std::option::Option::Some(input);
77        self
78    }
79    /// <p>The plaintext random bytes encrypted with the public key from the Nitro enclave. This ciphertext can be decrypted only by using a private key in the Nitro enclave.</p>
80    /// <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>
81    pub fn set_ciphertext_for_recipient(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
82        self.ciphertext_for_recipient = input;
83        self
84    }
85    /// <p>The plaintext random bytes encrypted with the public key from the Nitro enclave. This ciphertext can be decrypted only by using a private key in the Nitro enclave.</p>
86    /// <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>
87    pub fn get_ciphertext_for_recipient(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
88        &self.ciphertext_for_recipient
89    }
90    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
91        self._request_id = Some(request_id.into());
92        self
93    }
94
95    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
96        self._request_id = request_id;
97        self
98    }
99    /// Consumes the builder and constructs a [`GenerateRandomOutput`](crate::operation::generate_random::GenerateRandomOutput).
100    pub fn build(self) -> crate::operation::generate_random::GenerateRandomOutput {
101        crate::operation::generate_random::GenerateRandomOutput {
102            plaintext: self.plaintext,
103            ciphertext_for_recipient: self.ciphertext_for_recipient,
104            _request_id: self._request_id,
105        }
106    }
107}
108impl ::std::fmt::Debug for GenerateRandomOutputBuilder {
109    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
110        let mut formatter = f.debug_struct("GenerateRandomOutputBuilder");
111        formatter.field("plaintext", &"*** Sensitive Data Redacted ***");
112        formatter.field("ciphertext_for_recipient", &self.ciphertext_for_recipient);
113        formatter.field("_request_id", &self._request_id);
114        formatter.finish()
115    }
116}