aws_sdk_paymentcryptographydata/operation/encrypt_data/
_encrypt_data_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 EncryptDataOutput {
6    /// <p>The <code>keyARN</code> of the encryption key that Amazon Web Services Payment Cryptography uses for plaintext encryption.</p>
7    pub key_arn: ::std::string::String,
8    /// <p>The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed.</p>
9    /// <p>Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification.</p>
10    pub key_check_value: ::std::option::Option<::std::string::String>,
11    /// <p>The encrypted ciphertext.</p>
12    pub cipher_text: ::std::string::String,
13    _request_id: Option<String>,
14}
15impl EncryptDataOutput {
16    /// <p>The <code>keyARN</code> of the encryption key that Amazon Web Services Payment Cryptography uses for plaintext encryption.</p>
17    pub fn key_arn(&self) -> &str {
18        use std::ops::Deref;
19        self.key_arn.deref()
20    }
21    /// <p>The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed.</p>
22    /// <p>Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification.</p>
23    pub fn key_check_value(&self) -> ::std::option::Option<&str> {
24        self.key_check_value.as_deref()
25    }
26    /// <p>The encrypted ciphertext.</p>
27    pub fn cipher_text(&self) -> &str {
28        use std::ops::Deref;
29        self.cipher_text.deref()
30    }
31}
32impl ::std::fmt::Debug for EncryptDataOutput {
33    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
34        let mut formatter = f.debug_struct("EncryptDataOutput");
35        formatter.field("key_arn", &self.key_arn);
36        formatter.field("key_check_value", &self.key_check_value);
37        formatter.field("cipher_text", &"*** Sensitive Data Redacted ***");
38        formatter.field("_request_id", &self._request_id);
39        formatter.finish()
40    }
41}
42impl ::aws_types::request_id::RequestId for EncryptDataOutput {
43    fn request_id(&self) -> Option<&str> {
44        self._request_id.as_deref()
45    }
46}
47impl EncryptDataOutput {
48    /// Creates a new builder-style object to manufacture [`EncryptDataOutput`](crate::operation::encrypt_data::EncryptDataOutput).
49    pub fn builder() -> crate::operation::encrypt_data::builders::EncryptDataOutputBuilder {
50        crate::operation::encrypt_data::builders::EncryptDataOutputBuilder::default()
51    }
52}
53
54/// A builder for [`EncryptDataOutput`](crate::operation::encrypt_data::EncryptDataOutput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
56#[non_exhaustive]
57pub struct EncryptDataOutputBuilder {
58    pub(crate) key_arn: ::std::option::Option<::std::string::String>,
59    pub(crate) key_check_value: ::std::option::Option<::std::string::String>,
60    pub(crate) cipher_text: ::std::option::Option<::std::string::String>,
61    _request_id: Option<String>,
62}
63impl EncryptDataOutputBuilder {
64    /// <p>The <code>keyARN</code> of the encryption key that Amazon Web Services Payment Cryptography uses for plaintext encryption.</p>
65    /// This field is required.
66    pub fn key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
67        self.key_arn = ::std::option::Option::Some(input.into());
68        self
69    }
70    /// <p>The <code>keyARN</code> of the encryption key that Amazon Web Services Payment Cryptography uses for plaintext encryption.</p>
71    pub fn set_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
72        self.key_arn = input;
73        self
74    }
75    /// <p>The <code>keyARN</code> of the encryption key that Amazon Web Services Payment Cryptography uses for plaintext encryption.</p>
76    pub fn get_key_arn(&self) -> &::std::option::Option<::std::string::String> {
77        &self.key_arn
78    }
79    /// <p>The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed.</p>
80    /// <p>Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification.</p>
81    pub fn key_check_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82        self.key_check_value = ::std::option::Option::Some(input.into());
83        self
84    }
85    /// <p>The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed.</p>
86    /// <p>Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification.</p>
87    pub fn set_key_check_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88        self.key_check_value = input;
89        self
90    }
91    /// <p>The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed.</p>
92    /// <p>Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification.</p>
93    pub fn get_key_check_value(&self) -> &::std::option::Option<::std::string::String> {
94        &self.key_check_value
95    }
96    /// <p>The encrypted ciphertext.</p>
97    /// This field is required.
98    pub fn cipher_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.cipher_text = ::std::option::Option::Some(input.into());
100        self
101    }
102    /// <p>The encrypted ciphertext.</p>
103    pub fn set_cipher_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104        self.cipher_text = input;
105        self
106    }
107    /// <p>The encrypted ciphertext.</p>
108    pub fn get_cipher_text(&self) -> &::std::option::Option<::std::string::String> {
109        &self.cipher_text
110    }
111    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
112        self._request_id = Some(request_id.into());
113        self
114    }
115
116    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
117        self._request_id = request_id;
118        self
119    }
120    /// Consumes the builder and constructs a [`EncryptDataOutput`](crate::operation::encrypt_data::EncryptDataOutput).
121    /// This method will fail if any of the following fields are not set:
122    /// - [`key_arn`](crate::operation::encrypt_data::builders::EncryptDataOutputBuilder::key_arn)
123    /// - [`cipher_text`](crate::operation::encrypt_data::builders::EncryptDataOutputBuilder::cipher_text)
124    pub fn build(self) -> ::std::result::Result<crate::operation::encrypt_data::EncryptDataOutput, ::aws_smithy_types::error::operation::BuildError> {
125        ::std::result::Result::Ok(crate::operation::encrypt_data::EncryptDataOutput {
126            key_arn: self.key_arn.ok_or_else(|| {
127                ::aws_smithy_types::error::operation::BuildError::missing_field(
128                    "key_arn",
129                    "key_arn was not specified but it is required when building EncryptDataOutput",
130                )
131            })?,
132            key_check_value: self.key_check_value,
133            cipher_text: self.cipher_text.ok_or_else(|| {
134                ::aws_smithy_types::error::operation::BuildError::missing_field(
135                    "cipher_text",
136                    "cipher_text was not specified but it is required when building EncryptDataOutput",
137                )
138            })?,
139            _request_id: self._request_id,
140        })
141    }
142}
143impl ::std::fmt::Debug for EncryptDataOutputBuilder {
144    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
145        let mut formatter = f.debug_struct("EncryptDataOutputBuilder");
146        formatter.field("key_arn", &self.key_arn);
147        formatter.field("key_check_value", &self.key_check_value);
148        formatter.field("cipher_text", &"*** Sensitive Data Redacted ***");
149        formatter.field("_request_id", &self._request_id);
150        formatter.finish()
151    }
152}