aws_sdk_kms/operation/verify_mac/
_verify_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, ::std::fmt::Debug)]
5pub struct VerifyMacOutput {
6    /// <p>The HMAC KMS key used in the verification.</p>
7    pub key_id: ::std::option::Option<::std::string::String>,
8    /// <p>A Boolean value that indicates whether the HMAC was verified. A value of <code>True</code> indicates that the HMAC (<code>Mac</code>) was generated with the specified <code>Message</code>, HMAC KMS key (<code>KeyID</code>) and <code>MacAlgorithm.</code>.</p>
9    /// <p>If the HMAC is not verified, the <code>VerifyMac</code> operation fails with a <code>KMSInvalidMacException</code> exception. This exception indicates that one or more of the inputs changed since the HMAC was computed.</p>
10    pub mac_valid: bool,
11    /// <p>The MAC algorithm used in the verification.</p>
12    pub mac_algorithm: ::std::option::Option<crate::types::MacAlgorithmSpec>,
13    _request_id: Option<String>,
14}
15impl VerifyMacOutput {
16    /// <p>The HMAC KMS key used in the verification.</p>
17    pub fn key_id(&self) -> ::std::option::Option<&str> {
18        self.key_id.as_deref()
19    }
20    /// <p>A Boolean value that indicates whether the HMAC was verified. A value of <code>True</code> indicates that the HMAC (<code>Mac</code>) was generated with the specified <code>Message</code>, HMAC KMS key (<code>KeyID</code>) and <code>MacAlgorithm.</code>.</p>
21    /// <p>If the HMAC is not verified, the <code>VerifyMac</code> operation fails with a <code>KMSInvalidMacException</code> exception. This exception indicates that one or more of the inputs changed since the HMAC was computed.</p>
22    pub fn mac_valid(&self) -> bool {
23        self.mac_valid
24    }
25    /// <p>The MAC algorithm used in the verification.</p>
26    pub fn mac_algorithm(&self) -> ::std::option::Option<&crate::types::MacAlgorithmSpec> {
27        self.mac_algorithm.as_ref()
28    }
29}
30impl ::aws_types::request_id::RequestId for VerifyMacOutput {
31    fn request_id(&self) -> Option<&str> {
32        self._request_id.as_deref()
33    }
34}
35impl VerifyMacOutput {
36    /// Creates a new builder-style object to manufacture [`VerifyMacOutput`](crate::operation::verify_mac::VerifyMacOutput).
37    pub fn builder() -> crate::operation::verify_mac::builders::VerifyMacOutputBuilder {
38        crate::operation::verify_mac::builders::VerifyMacOutputBuilder::default()
39    }
40}
41
42/// A builder for [`VerifyMacOutput`](crate::operation::verify_mac::VerifyMacOutput).
43#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
44#[non_exhaustive]
45pub struct VerifyMacOutputBuilder {
46    pub(crate) key_id: ::std::option::Option<::std::string::String>,
47    pub(crate) mac_valid: ::std::option::Option<bool>,
48    pub(crate) mac_algorithm: ::std::option::Option<crate::types::MacAlgorithmSpec>,
49    _request_id: Option<String>,
50}
51impl VerifyMacOutputBuilder {
52    /// <p>The HMAC KMS key used in the verification.</p>
53    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
54        self.key_id = ::std::option::Option::Some(input.into());
55        self
56    }
57    /// <p>The HMAC KMS key used in the verification.</p>
58    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
59        self.key_id = input;
60        self
61    }
62    /// <p>The HMAC KMS key used in the verification.</p>
63    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
64        &self.key_id
65    }
66    /// <p>A Boolean value that indicates whether the HMAC was verified. A value of <code>True</code> indicates that the HMAC (<code>Mac</code>) was generated with the specified <code>Message</code>, HMAC KMS key (<code>KeyID</code>) and <code>MacAlgorithm.</code>.</p>
67    /// <p>If the HMAC is not verified, the <code>VerifyMac</code> operation fails with a <code>KMSInvalidMacException</code> exception. This exception indicates that one or more of the inputs changed since the HMAC was computed.</p>
68    pub fn mac_valid(mut self, input: bool) -> Self {
69        self.mac_valid = ::std::option::Option::Some(input);
70        self
71    }
72    /// <p>A Boolean value that indicates whether the HMAC was verified. A value of <code>True</code> indicates that the HMAC (<code>Mac</code>) was generated with the specified <code>Message</code>, HMAC KMS key (<code>KeyID</code>) and <code>MacAlgorithm.</code>.</p>
73    /// <p>If the HMAC is not verified, the <code>VerifyMac</code> operation fails with a <code>KMSInvalidMacException</code> exception. This exception indicates that one or more of the inputs changed since the HMAC was computed.</p>
74    pub fn set_mac_valid(mut self, input: ::std::option::Option<bool>) -> Self {
75        self.mac_valid = input;
76        self
77    }
78    /// <p>A Boolean value that indicates whether the HMAC was verified. A value of <code>True</code> indicates that the HMAC (<code>Mac</code>) was generated with the specified <code>Message</code>, HMAC KMS key (<code>KeyID</code>) and <code>MacAlgorithm.</code>.</p>
79    /// <p>If the HMAC is not verified, the <code>VerifyMac</code> operation fails with a <code>KMSInvalidMacException</code> exception. This exception indicates that one or more of the inputs changed since the HMAC was computed.</p>
80    pub fn get_mac_valid(&self) -> &::std::option::Option<bool> {
81        &self.mac_valid
82    }
83    /// <p>The MAC algorithm used in the verification.</p>
84    pub fn mac_algorithm(mut self, input: crate::types::MacAlgorithmSpec) -> Self {
85        self.mac_algorithm = ::std::option::Option::Some(input);
86        self
87    }
88    /// <p>The MAC algorithm used in the verification.</p>
89    pub fn set_mac_algorithm(mut self, input: ::std::option::Option<crate::types::MacAlgorithmSpec>) -> Self {
90        self.mac_algorithm = input;
91        self
92    }
93    /// <p>The MAC algorithm used in the verification.</p>
94    pub fn get_mac_algorithm(&self) -> &::std::option::Option<crate::types::MacAlgorithmSpec> {
95        &self.mac_algorithm
96    }
97    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
98        self._request_id = Some(request_id.into());
99        self
100    }
101
102    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
103        self._request_id = request_id;
104        self
105    }
106    /// Consumes the builder and constructs a [`VerifyMacOutput`](crate::operation::verify_mac::VerifyMacOutput).
107    pub fn build(self) -> crate::operation::verify_mac::VerifyMacOutput {
108        crate::operation::verify_mac::VerifyMacOutput {
109            key_id: self.key_id,
110            mac_valid: self.mac_valid.unwrap_or_default(),
111            mac_algorithm: self.mac_algorithm,
112            _request_id: self._request_id,
113        }
114    }
115}