aws_sdk_kms/operation/generate_mac/_generate_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 GenerateMacInput {
6 /// <p>The message to be hashed. Specify a message of up to 4,096 bytes.</p>
7 /// <p><code>GenerateMac</code> and <code>VerifyMac</code> do not provide special handling for message digests. If you generate an HMAC for a hash digest of a message, you must verify the HMAC of the same hash digest.</p>
8 pub message: ::std::option::Option<::aws_smithy_types::Blob>,
9 /// <p>The HMAC KMS key to use in the operation. The MAC algorithm computes the HMAC for the message and the key as described in <a href="https://datatracker.ietf.org/doc/html/rfc2104">RFC 2104</a>.</p>
10 /// <p>To identify an HMAC KMS key, use the <code>DescribeKey</code> operation and see the <code>KeySpec</code> field in the response.</p>
11 pub key_id: ::std::option::Option<::std::string::String>,
12 /// <p>The MAC algorithm used in the operation.</p>
13 /// <p>The algorithm must be compatible with the HMAC KMS key that you specify. To find the MAC algorithms that your HMAC KMS key supports, use the <code>DescribeKey</code> operation and see the <code>MacAlgorithms</code> field in the <code>DescribeKey</code> response.</p>
14 pub mac_algorithm: ::std::option::Option<crate::types::MacAlgorithmSpec>,
15 /// <p>A list of grant tokens.</p>
16 /// <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>
17 pub grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
18 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
19 /// <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>
20 pub dry_run: ::std::option::Option<bool>,
21}
22impl GenerateMacInput {
23 /// <p>The message to be hashed. Specify a message of up to 4,096 bytes.</p>
24 /// <p><code>GenerateMac</code> and <code>VerifyMac</code> do not provide special handling for message digests. If you generate an HMAC for a hash digest of a message, you must verify the HMAC of the same hash digest.</p>
25 pub fn message(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
26 self.message.as_ref()
27 }
28 /// <p>The HMAC KMS key to use in the operation. The MAC algorithm computes the HMAC for the message and the key as described in <a href="https://datatracker.ietf.org/doc/html/rfc2104">RFC 2104</a>.</p>
29 /// <p>To identify an HMAC KMS key, use the <code>DescribeKey</code> operation and see the <code>KeySpec</code> field in the response.</p>
30 pub fn key_id(&self) -> ::std::option::Option<&str> {
31 self.key_id.as_deref()
32 }
33 /// <p>The MAC algorithm used in the operation.</p>
34 /// <p>The algorithm must be compatible with the HMAC KMS key that you specify. To find the MAC algorithms that your HMAC KMS key supports, use the <code>DescribeKey</code> operation and see the <code>MacAlgorithms</code> field in the <code>DescribeKey</code> response.</p>
35 pub fn mac_algorithm(&self) -> ::std::option::Option<&crate::types::MacAlgorithmSpec> {
36 self.mac_algorithm.as_ref()
37 }
38 /// <p>A list of grant tokens.</p>
39 /// <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>
40 ///
41 /// 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()`.
42 pub fn grant_tokens(&self) -> &[::std::string::String] {
43 self.grant_tokens.as_deref().unwrap_or_default()
44 }
45 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
46 /// <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>
47 pub fn dry_run(&self) -> ::std::option::Option<bool> {
48 self.dry_run
49 }
50}
51impl ::std::fmt::Debug for GenerateMacInput {
52 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
53 let mut formatter = f.debug_struct("GenerateMacInput");
54 formatter.field("message", &"*** Sensitive Data Redacted ***");
55 formatter.field("key_id", &self.key_id);
56 formatter.field("mac_algorithm", &self.mac_algorithm);
57 formatter.field("grant_tokens", &self.grant_tokens);
58 formatter.field("dry_run", &self.dry_run);
59 formatter.finish()
60 }
61}
62impl GenerateMacInput {
63 /// Creates a new builder-style object to manufacture [`GenerateMacInput`](crate::operation::generate_mac::GenerateMacInput).
64 pub fn builder() -> crate::operation::generate_mac::builders::GenerateMacInputBuilder {
65 crate::operation::generate_mac::builders::GenerateMacInputBuilder::default()
66 }
67}
68
69/// A builder for [`GenerateMacInput`](crate::operation::generate_mac::GenerateMacInput).
70#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
71#[non_exhaustive]
72pub struct GenerateMacInputBuilder {
73 pub(crate) message: ::std::option::Option<::aws_smithy_types::Blob>,
74 pub(crate) key_id: ::std::option::Option<::std::string::String>,
75 pub(crate) mac_algorithm: ::std::option::Option<crate::types::MacAlgorithmSpec>,
76 pub(crate) grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
77 pub(crate) dry_run: ::std::option::Option<bool>,
78}
79impl GenerateMacInputBuilder {
80 /// <p>The message to be hashed. Specify a message of up to 4,096 bytes.</p>
81 /// <p><code>GenerateMac</code> and <code>VerifyMac</code> do not provide special handling for message digests. If you generate an HMAC for a hash digest of a message, you must verify the HMAC of the same hash digest.</p>
82 /// This field is required.
83 pub fn message(mut self, input: ::aws_smithy_types::Blob) -> Self {
84 self.message = ::std::option::Option::Some(input);
85 self
86 }
87 /// <p>The message to be hashed. Specify a message of up to 4,096 bytes.</p>
88 /// <p><code>GenerateMac</code> and <code>VerifyMac</code> do not provide special handling for message digests. If you generate an HMAC for a hash digest of a message, you must verify the HMAC of the same hash digest.</p>
89 pub fn set_message(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
90 self.message = input;
91 self
92 }
93 /// <p>The message to be hashed. Specify a message of up to 4,096 bytes.</p>
94 /// <p><code>GenerateMac</code> and <code>VerifyMac</code> do not provide special handling for message digests. If you generate an HMAC for a hash digest of a message, you must verify the HMAC of the same hash digest.</p>
95 pub fn get_message(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
96 &self.message
97 }
98 /// <p>The HMAC KMS key to use in the operation. The MAC algorithm computes the HMAC for the message and the key as described in <a href="https://datatracker.ietf.org/doc/html/rfc2104">RFC 2104</a>.</p>
99 /// <p>To identify an HMAC KMS key, use the <code>DescribeKey</code> operation and see the <code>KeySpec</code> field in the response.</p>
100 /// This field is required.
101 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102 self.key_id = ::std::option::Option::Some(input.into());
103 self
104 }
105 /// <p>The HMAC KMS key to use in the operation. The MAC algorithm computes the HMAC for the message and the key as described in <a href="https://datatracker.ietf.org/doc/html/rfc2104">RFC 2104</a>.</p>
106 /// <p>To identify an HMAC KMS key, use the <code>DescribeKey</code> operation and see the <code>KeySpec</code> field in the response.</p>
107 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108 self.key_id = input;
109 self
110 }
111 /// <p>The HMAC KMS key to use in the operation. The MAC algorithm computes the HMAC for the message and the key as described in <a href="https://datatracker.ietf.org/doc/html/rfc2104">RFC 2104</a>.</p>
112 /// <p>To identify an HMAC KMS key, use the <code>DescribeKey</code> operation and see the <code>KeySpec</code> field in the response.</p>
113 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
114 &self.key_id
115 }
116 /// <p>The MAC algorithm used in the operation.</p>
117 /// <p>The algorithm must be compatible with the HMAC KMS key that you specify. To find the MAC algorithms that your HMAC KMS key supports, use the <code>DescribeKey</code> operation and see the <code>MacAlgorithms</code> field in the <code>DescribeKey</code> response.</p>
118 /// This field is required.
119 pub fn mac_algorithm(mut self, input: crate::types::MacAlgorithmSpec) -> Self {
120 self.mac_algorithm = ::std::option::Option::Some(input);
121 self
122 }
123 /// <p>The MAC algorithm used in the operation.</p>
124 /// <p>The algorithm must be compatible with the HMAC KMS key that you specify. To find the MAC algorithms that your HMAC KMS key supports, use the <code>DescribeKey</code> operation and see the <code>MacAlgorithms</code> field in the <code>DescribeKey</code> response.</p>
125 pub fn set_mac_algorithm(mut self, input: ::std::option::Option<crate::types::MacAlgorithmSpec>) -> Self {
126 self.mac_algorithm = input;
127 self
128 }
129 /// <p>The MAC algorithm used in the operation.</p>
130 /// <p>The algorithm must be compatible with the HMAC KMS key that you specify. To find the MAC algorithms that your HMAC KMS key supports, use the <code>DescribeKey</code> operation and see the <code>MacAlgorithms</code> field in the <code>DescribeKey</code> response.</p>
131 pub fn get_mac_algorithm(&self) -> &::std::option::Option<crate::types::MacAlgorithmSpec> {
132 &self.mac_algorithm
133 }
134 /// Appends an item to `grant_tokens`.
135 ///
136 /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
137 ///
138 /// <p>A list of grant tokens.</p>
139 /// <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>
140 pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141 let mut v = self.grant_tokens.unwrap_or_default();
142 v.push(input.into());
143 self.grant_tokens = ::std::option::Option::Some(v);
144 self
145 }
146 /// <p>A list of grant tokens.</p>
147 /// <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>
148 pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
149 self.grant_tokens = input;
150 self
151 }
152 /// <p>A list of grant tokens.</p>
153 /// <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>
154 pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
155 &self.grant_tokens
156 }
157 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
158 /// <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>
159 pub fn dry_run(mut self, input: bool) -> Self {
160 self.dry_run = ::std::option::Option::Some(input);
161 self
162 }
163 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
164 /// <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>
165 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
166 self.dry_run = input;
167 self
168 }
169 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
170 /// <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>
171 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
172 &self.dry_run
173 }
174 /// Consumes the builder and constructs a [`GenerateMacInput`](crate::operation::generate_mac::GenerateMacInput).
175 pub fn build(self) -> ::std::result::Result<crate::operation::generate_mac::GenerateMacInput, ::aws_smithy_types::error::operation::BuildError> {
176 ::std::result::Result::Ok(crate::operation::generate_mac::GenerateMacInput {
177 message: self.message,
178 key_id: self.key_id,
179 mac_algorithm: self.mac_algorithm,
180 grant_tokens: self.grant_tokens,
181 dry_run: self.dry_run,
182 })
183 }
184}
185impl ::std::fmt::Debug for GenerateMacInputBuilder {
186 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
187 let mut formatter = f.debug_struct("GenerateMacInputBuilder");
188 formatter.field("message", &"*** Sensitive Data Redacted ***");
189 formatter.field("key_id", &self.key_id);
190 formatter.field("mac_algorithm", &self.mac_algorithm);
191 formatter.field("grant_tokens", &self.grant_tokens);
192 formatter.field("dry_run", &self.dry_run);
193 formatter.finish()
194 }
195}