aws_sdk_kms/operation/verify_mac/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::verify_mac::_verify_mac_output::VerifyMacOutputBuilder;
3
4pub use crate::operation::verify_mac::_verify_mac_input::VerifyMacInputBuilder;
5
6impl crate::operation::verify_mac::builders::VerifyMacInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::verify_mac::VerifyMacOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::verify_mac::VerifyMacError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.verify_mac();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `VerifyMac`.
24///
25/// <p>Verifies the hash-based message authentication code (HMAC) for a specified message, HMAC KMS key, and MAC algorithm. To verify the HMAC, <code>VerifyMac</code> computes an HMAC using the message, HMAC KMS key, and MAC algorithm that you specify, and compares the computed HMAC to the HMAC that you specify. If the HMACs are identical, the verification succeeds; otherwise, it fails. Verification indicates that the message hasn't changed since the HMAC was calculated, and the specified key was used to generate and verify the HMAC.</p>
26/// <p>HMAC KMS keys and the HMAC algorithms that KMS uses conform to industry standards defined in <a href="https://datatracker.ietf.org/doc/html/rfc2104">RFC 2104</a>.</p>
27/// <p>This operation is part of KMS support for HMAC KMS keys. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html">HMAC keys in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
28/// <p>The KMS key that you use for this operation must be in a compatible key state. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of KMS keys</a> in the <i>Key Management Service Developer Guide</i>.</p>
29/// <p><b>Cross-account use</b>: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN in the value of the <code>KeyId</code> parameter.</p>
30/// <p><b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:VerifyMac</a> (key policy)</p>
31/// <p><b>Related operations</b>: <code>GenerateMac</code></p>
32/// <p><b>Eventual consistency</b>: The KMS API follows an eventual consistency model. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html">KMS eventual consistency</a>.</p>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct VerifyMacFluentBuilder {
35    handle: ::std::sync::Arc<crate::client::Handle>,
36    inner: crate::operation::verify_mac::builders::VerifyMacInputBuilder,
37    config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl crate::client::customize::internal::CustomizableSend<crate::operation::verify_mac::VerifyMacOutput, crate::operation::verify_mac::VerifyMacError>
40    for VerifyMacFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<crate::operation::verify_mac::VerifyMacOutput, crate::operation::verify_mac::VerifyMacError>,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl VerifyMacFluentBuilder {
52    /// Creates a new `VerifyMacFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the VerifyMac as a reference.
61    pub fn as_input(&self) -> &crate::operation::verify_mac::builders::VerifyMacInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::verify_mac::VerifyMacOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::verify_mac::VerifyMacError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::verify_mac::VerifyMac::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::verify_mac::VerifyMac::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::verify_mac::VerifyMacOutput,
98        crate::operation::verify_mac::VerifyMacError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The message that will be used in the verification. Enter the same message that was used to generate the HMAC.</p>
113    /// <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>
114    pub fn message(mut self, input: ::aws_smithy_types::Blob) -> Self {
115        self.inner = self.inner.message(input);
116        self
117    }
118    /// <p>The message that will be used in the verification. Enter the same message that was used to generate the HMAC.</p>
119    /// <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>
120    pub fn set_message(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
121        self.inner = self.inner.set_message(input);
122        self
123    }
124    /// <p>The message that will be used in the verification. Enter the same message that was used to generate the HMAC.</p>
125    /// <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>
126    pub fn get_message(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
127        self.inner.get_message()
128    }
129    /// <p>The KMS key that will be used in the verification.</p>
130    /// <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>
131    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.inner = self.inner.key_id(input.into());
133        self
134    }
135    /// <p>The KMS key that will be used in the verification.</p>
136    /// <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>
137    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.inner = self.inner.set_key_id(input);
139        self
140    }
141    /// <p>The KMS key that will be used in the verification.</p>
142    /// <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>
143    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
144        self.inner.get_key_id()
145    }
146    /// <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>
147    pub fn mac_algorithm(mut self, input: crate::types::MacAlgorithmSpec) -> Self {
148        self.inner = self.inner.mac_algorithm(input);
149        self
150    }
151    /// <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>
152    pub fn set_mac_algorithm(mut self, input: ::std::option::Option<crate::types::MacAlgorithmSpec>) -> Self {
153        self.inner = self.inner.set_mac_algorithm(input);
154        self
155    }
156    /// <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>
157    pub fn get_mac_algorithm(&self) -> &::std::option::Option<crate::types::MacAlgorithmSpec> {
158        self.inner.get_mac_algorithm()
159    }
160    /// <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>
161    pub fn mac(mut self, input: ::aws_smithy_types::Blob) -> Self {
162        self.inner = self.inner.mac(input);
163        self
164    }
165    /// <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>
166    pub fn set_mac(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
167        self.inner = self.inner.set_mac(input);
168        self
169    }
170    /// <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>
171    pub fn get_mac(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
172        self.inner.get_mac()
173    }
174    ///
175    /// Appends an item to `GrantTokens`.
176    ///
177    /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
178    ///
179    /// <p>A list of grant tokens.</p>
180    /// <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>
181    pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
182        self.inner = self.inner.grant_tokens(input.into());
183        self
184    }
185    /// <p>A list of grant tokens.</p>
186    /// <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>
187    pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
188        self.inner = self.inner.set_grant_tokens(input);
189        self
190    }
191    /// <p>A list of grant tokens.</p>
192    /// <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>
193    pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
194        self.inner.get_grant_tokens()
195    }
196    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
197    /// <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>
198    pub fn dry_run(mut self, input: bool) -> Self {
199        self.inner = self.inner.dry_run(input);
200        self
201    }
202    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
203    /// <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>
204    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
205        self.inner = self.inner.set_dry_run(input);
206        self
207    }
208    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
209    /// <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>
210    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
211        self.inner.get_dry_run()
212    }
213}