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