aws_sdk_kms/operation/verify_mac/_verify_mac_input.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 VerifyMacInput {
6 /// <p>The message that will be used in the verification. Enter the same message that was used to generate the HMAC.</p>
7 /// <p><code>GenerateMac</code> and <code>VerifyMac</code> do not provide special handling for message digests. If you generated an HMAC for a hash digest of a message, you must verify the HMAC for the same hash digest.</p>
8 pub message: ::std::option::Option<::aws_smithy_types::Blob>,
9 /// <p>The KMS key that will be used in the verification.</p>
10 /// <p>Enter a key ID of the KMS key that was used to generate the HMAC. If you identify a different KMS key, the <code>VerifyMac</code> operation fails.</p>
11 pub key_id: ::std::option::Option<::std::string::String>,
12 /// <p>The MAC algorithm that will be used in the verification. Enter the same MAC algorithm that was used to compute the HMAC. This algorithm must be supported by the HMAC KMS key identified by the <code>KeyId</code> parameter.</p>
13 pub mac_algorithm: ::std::option::Option<crate::types::MacAlgorithmSpec>,
14 /// <p>The HMAC to verify. Enter the HMAC that was generated by the <code>GenerateMac</code> operation when you specified the same message, HMAC KMS key, and MAC algorithm as the values specified in this request.</p>
15 pub mac: ::std::option::Option<::aws_smithy_types::Blob>,
16 /// <p>A list of grant tokens.</p>
17 /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
18 pub grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
19 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
20 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
21 pub dry_run: ::std::option::Option<bool>,
22}
23impl VerifyMacInput {
24 /// <p>The message that will be used in the verification. Enter the same message that was used to generate the HMAC.</p>
25 /// <p><code>GenerateMac</code> and <code>VerifyMac</code> do not provide special handling for message digests. If you generated an HMAC for a hash digest of a message, you must verify the HMAC for the same hash digest.</p>
26 pub fn message(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
27 self.message.as_ref()
28 }
29 /// <p>The KMS key that will be used in the verification.</p>
30 /// <p>Enter a key ID of the KMS key that was used to generate the HMAC. If you identify a different KMS key, the <code>VerifyMac</code> operation fails.</p>
31 pub fn key_id(&self) -> ::std::option::Option<&str> {
32 self.key_id.as_deref()
33 }
34 /// <p>The MAC algorithm that will be used in the verification. Enter the same MAC algorithm that was used to compute the HMAC. This algorithm must be supported by the HMAC KMS key identified by the <code>KeyId</code> parameter.</p>
35 pub fn mac_algorithm(&self) -> ::std::option::Option<&crate::types::MacAlgorithmSpec> {
36 self.mac_algorithm.as_ref()
37 }
38 /// <p>The HMAC to verify. Enter the HMAC that was generated by the <code>GenerateMac</code> operation when you specified the same message, HMAC KMS key, and MAC algorithm as the values specified in this request.</p>
39 pub fn mac(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
40 self.mac.as_ref()
41 }
42 /// <p>A list of grant tokens.</p>
43 /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
44 ///
45 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.grant_tokens.is_none()`.
46 pub fn grant_tokens(&self) -> &[::std::string::String] {
47 self.grant_tokens.as_deref().unwrap_or_default()
48 }
49 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
50 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
51 pub fn dry_run(&self) -> ::std::option::Option<bool> {
52 self.dry_run
53 }
54}
55impl ::std::fmt::Debug for VerifyMacInput {
56 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
57 let mut formatter = f.debug_struct("VerifyMacInput");
58 formatter.field("message", &"*** Sensitive Data Redacted ***");
59 formatter.field("key_id", &self.key_id);
60 formatter.field("mac_algorithm", &self.mac_algorithm);
61 formatter.field("mac", &self.mac);
62 formatter.field("grant_tokens", &self.grant_tokens);
63 formatter.field("dry_run", &self.dry_run);
64 formatter.finish()
65 }
66}
67impl VerifyMacInput {
68 /// Creates a new builder-style object to manufacture [`VerifyMacInput`](crate::operation::verify_mac::VerifyMacInput).
69 pub fn builder() -> crate::operation::verify_mac::builders::VerifyMacInputBuilder {
70 crate::operation::verify_mac::builders::VerifyMacInputBuilder::default()
71 }
72}
73
74/// A builder for [`VerifyMacInput`](crate::operation::verify_mac::VerifyMacInput).
75#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
76#[non_exhaustive]
77pub struct VerifyMacInputBuilder {
78 pub(crate) message: ::std::option::Option<::aws_smithy_types::Blob>,
79 pub(crate) key_id: ::std::option::Option<::std::string::String>,
80 pub(crate) mac_algorithm: ::std::option::Option<crate::types::MacAlgorithmSpec>,
81 pub(crate) mac: ::std::option::Option<::aws_smithy_types::Blob>,
82 pub(crate) grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
83 pub(crate) dry_run: ::std::option::Option<bool>,
84}
85impl VerifyMacInputBuilder {
86 /// <p>The message that will be used in the verification. Enter the same message that was used to generate the HMAC.</p>
87 /// <p><code>GenerateMac</code> and <code>VerifyMac</code> do not provide special handling for message digests. If you generated an HMAC for a hash digest of a message, you must verify the HMAC for the same hash digest.</p>
88 /// This field is required.
89 pub fn message(mut self, input: ::aws_smithy_types::Blob) -> Self {
90 self.message = ::std::option::Option::Some(input);
91 self
92 }
93 /// <p>The message that will be used in the verification. Enter the same message that was used to generate the HMAC.</p>
94 /// <p><code>GenerateMac</code> and <code>VerifyMac</code> do not provide special handling for message digests. If you generated an HMAC for a hash digest of a message, you must verify the HMAC for the same hash digest.</p>
95 pub fn set_message(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
96 self.message = input;
97 self
98 }
99 /// <p>The message that will be used in the verification. Enter the same message that was used to generate the HMAC.</p>
100 /// <p><code>GenerateMac</code> and <code>VerifyMac</code> do not provide special handling for message digests. If you generated an HMAC for a hash digest of a message, you must verify the HMAC for the same hash digest.</p>
101 pub fn get_message(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
102 &self.message
103 }
104 /// <p>The KMS key that will be used in the verification.</p>
105 /// <p>Enter a key ID of the KMS key that was used to generate the HMAC. If you identify a different KMS key, the <code>VerifyMac</code> operation fails.</p>
106 /// This field is required.
107 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
108 self.key_id = ::std::option::Option::Some(input.into());
109 self
110 }
111 /// <p>The KMS key that will be used in the verification.</p>
112 /// <p>Enter a key ID of the KMS key that was used to generate the HMAC. If you identify a different KMS key, the <code>VerifyMac</code> operation fails.</p>
113 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
114 self.key_id = input;
115 self
116 }
117 /// <p>The KMS key that will be used in the verification.</p>
118 /// <p>Enter a key ID of the KMS key that was used to generate the HMAC. If you identify a different KMS key, the <code>VerifyMac</code> operation fails.</p>
119 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
120 &self.key_id
121 }
122 /// <p>The MAC algorithm that will be used in the verification. Enter the same MAC algorithm that was used to compute the HMAC. This algorithm must be supported by the HMAC KMS key identified by the <code>KeyId</code> parameter.</p>
123 /// This field is required.
124 pub fn mac_algorithm(mut self, input: crate::types::MacAlgorithmSpec) -> Self {
125 self.mac_algorithm = ::std::option::Option::Some(input);
126 self
127 }
128 /// <p>The MAC algorithm that will be used in the verification. Enter the same MAC algorithm that was used to compute the HMAC. This algorithm must be supported by the HMAC KMS key identified by the <code>KeyId</code> parameter.</p>
129 pub fn set_mac_algorithm(mut self, input: ::std::option::Option<crate::types::MacAlgorithmSpec>) -> Self {
130 self.mac_algorithm = input;
131 self
132 }
133 /// <p>The MAC algorithm that will be used in the verification. Enter the same MAC algorithm that was used to compute the HMAC. This algorithm must be supported by the HMAC KMS key identified by the <code>KeyId</code> parameter.</p>
134 pub fn get_mac_algorithm(&self) -> &::std::option::Option<crate::types::MacAlgorithmSpec> {
135 &self.mac_algorithm
136 }
137 /// <p>The HMAC to verify. Enter the HMAC that was generated by the <code>GenerateMac</code> operation when you specified the same message, HMAC KMS key, and MAC algorithm as the values specified in this request.</p>
138 /// This field is required.
139 pub fn mac(mut self, input: ::aws_smithy_types::Blob) -> Self {
140 self.mac = ::std::option::Option::Some(input);
141 self
142 }
143 /// <p>The HMAC to verify. Enter the HMAC that was generated by the <code>GenerateMac</code> operation when you specified the same message, HMAC KMS key, and MAC algorithm as the values specified in this request.</p>
144 pub fn set_mac(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
145 self.mac = input;
146 self
147 }
148 /// <p>The HMAC to verify. Enter the HMAC that was generated by the <code>GenerateMac</code> operation when you specified the same message, HMAC KMS key, and MAC algorithm as the values specified in this request.</p>
149 pub fn get_mac(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
150 &self.mac
151 }
152 /// Appends an item to `grant_tokens`.
153 ///
154 /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
155 ///
156 /// <p>A list of grant tokens.</p>
157 /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
158 pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
159 let mut v = self.grant_tokens.unwrap_or_default();
160 v.push(input.into());
161 self.grant_tokens = ::std::option::Option::Some(v);
162 self
163 }
164 /// <p>A list of grant tokens.</p>
165 /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
166 pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
167 self.grant_tokens = input;
168 self
169 }
170 /// <p>A list of grant tokens.</p>
171 /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
172 pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
173 &self.grant_tokens
174 }
175 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
176 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
177 pub fn dry_run(mut self, input: bool) -> Self {
178 self.dry_run = ::std::option::Option::Some(input);
179 self
180 }
181 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
182 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
183 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
184 self.dry_run = input;
185 self
186 }
187 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
188 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
189 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
190 &self.dry_run
191 }
192 /// Consumes the builder and constructs a [`VerifyMacInput`](crate::operation::verify_mac::VerifyMacInput).
193 pub fn build(self) -> ::std::result::Result<crate::operation::verify_mac::VerifyMacInput, ::aws_smithy_types::error::operation::BuildError> {
194 ::std::result::Result::Ok(crate::operation::verify_mac::VerifyMacInput {
195 message: self.message,
196 key_id: self.key_id,
197 mac_algorithm: self.mac_algorithm,
198 mac: self.mac,
199 grant_tokens: self.grant_tokens,
200 dry_run: self.dry_run,
201 })
202 }
203}
204impl ::std::fmt::Debug for VerifyMacInputBuilder {
205 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
206 let mut formatter = f.debug_struct("VerifyMacInputBuilder");
207 formatter.field("message", &"*** Sensitive Data Redacted ***");
208 formatter.field("key_id", &self.key_id);
209 formatter.field("mac_algorithm", &self.mac_algorithm);
210 formatter.field("mac", &self.mac);
211 formatter.field("grant_tokens", &self.grant_tokens);
212 formatter.field("dry_run", &self.dry_run);
213 formatter.finish()
214 }
215}