aws_esdk/deps/aws_cryptography_primitives/operation/h_mac/
builders.rs

1// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
4pub use crate::deps::aws_cryptography_primitives::operation::h_mac::_h_mac_output::HMacOutputBuilder;
5
6pub use crate::deps::aws_cryptography_primitives::operation::h_mac::_h_mac_input::HMacInputBuilder;
7
8impl HMacInputBuilder {
9    /// Sends a request with this input using the given client.
10    pub async fn send_with(
11        self,
12        client: &crate::deps::aws_cryptography_primitives::client::Client,
13    ) -> ::std::result::Result<
14        ::aws_smithy_types::Blob,
15        crate::deps::aws_cryptography_primitives::types::error::Error,
16    > {
17        let mut fluent_builder = client.h_mac();
18        fluent_builder.inner = self;
19        fluent_builder.send().await
20    }
21}
22/// Fluent builder constructing a request to `HMac`.
23///
24#[derive(::std::clone::Clone, ::std::fmt::Debug)]
25pub struct HMacFluentBuilder {
26    client: crate::deps::aws_cryptography_primitives::client::Client,
27    pub(crate) inner:
28        crate::deps::aws_cryptography_primitives::operation::h_mac::builders::HMacInputBuilder,
29}
30impl HMacFluentBuilder {
31    /// Creates a new `HMac`.
32    pub(crate) fn new(client: crate::deps::aws_cryptography_primitives::client::Client) -> Self {
33        Self {
34            client,
35            inner: ::std::default::Default::default(),
36        }
37    }
38    /// Access the HMac as a reference.
39    pub fn as_input(
40        &self,
41    ) -> &crate::deps::aws_cryptography_primitives::operation::h_mac::builders::HMacInputBuilder
42    {
43        &self.inner
44    }
45    /// Sends the request and returns the response.
46    pub async fn send(
47        self,
48    ) -> ::std::result::Result<
49        ::aws_smithy_types::Blob,
50        crate::deps::aws_cryptography_primitives::types::error::Error,
51    > {
52        let input = self
53            .inner
54            .build()
55            // Using Opaque since we don't have a validation-specific error yet.
56            // Operations' models don't declare their own validation error,
57            // and smithy-rs seems to not generate a ValidationError case unless there is.
58            // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError.
59            .map_err(|mut e| {
60                let msg = format!("{:?}", e);
61                crate::deps::aws_cryptography_primitives::types::error::Error::OpaqueWithText {
62                    obj: ::dafny_runtime::Object::from_ref(&mut e as &mut ::dafny_runtime::DynAny),
63                    objMessage: msg,
64                }
65            })?;
66        crate::deps::aws_cryptography_primitives::operation::h_mac::HMac::send(&self.client, input)
67            .await
68    }
69
70    #[allow(missing_docs)]
71    pub fn digest_algorithm(
72        mut self,
73        input: impl ::std::convert::Into<
74            crate::deps::aws_cryptography_primitives::types::DigestAlgorithm,
75        >,
76    ) -> Self {
77        self.inner = self.inner.digest_algorithm(input.into());
78        self
79    }
80    #[allow(missing_docs)]
81    pub fn set_digest_algorithm(
82        mut self,
83        input: ::std::option::Option<
84            crate::deps::aws_cryptography_primitives::types::DigestAlgorithm,
85        >,
86    ) -> Self {
87        self.inner = self.inner.set_digest_algorithm(input);
88        self
89    }
90    #[allow(missing_docs)]
91    pub fn get_digest_algorithm(
92        &self,
93    ) -> &::std::option::Option<crate::deps::aws_cryptography_primitives::types::DigestAlgorithm>
94    {
95        self.inner.get_digest_algorithm()
96    }
97    #[allow(missing_docs)]
98    pub fn key(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self {
99        self.inner = self.inner.key(input.into());
100        self
101    }
102    #[allow(missing_docs)]
103    pub fn set_key(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
104        self.inner = self.inner.set_key(input);
105        self
106    }
107    #[allow(missing_docs)]
108    pub fn get_key(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
109        self.inner.get_key()
110    }
111    #[allow(missing_docs)]
112    pub fn message(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self {
113        self.inner = self.inner.message(input.into());
114        self
115    }
116    #[allow(missing_docs)]
117    pub fn set_message(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
118        self.inner = self.inner.set_message(input);
119        self
120    }
121    #[allow(missing_docs)]
122    pub fn get_message(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
123        self.inner.get_message()
124    }
125}