Skip to main content

aws_esdk/deps/aws_cryptography_primitives/operation/generate_random_bytes/
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::generate_random_bytes::_generate_random_bytes_output::GenerateRandomBytesOutputBuilder;
5
6pub use crate::deps::aws_cryptography_primitives::operation::generate_random_bytes::_generate_random_bytes_input::GenerateRandomBytesInputBuilder;
7
8impl GenerateRandomBytesInputBuilder {
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.generate_random_bytes();
18        fluent_builder.inner = self;
19        fluent_builder.send().await
20    }
21}
22/// Fluent builder constructing a request to `GenerateRandomBytes`.
23///
24#[derive(::std::clone::Clone, ::std::fmt::Debug)]
25pub struct GenerateRandomBytesFluentBuilder {
26    client: crate::deps::aws_cryptography_primitives::client::Client,
27    pub(crate) inner: crate::deps::aws_cryptography_primitives::operation::generate_random_bytes::builders::GenerateRandomBytesInputBuilder,
28}
29impl GenerateRandomBytesFluentBuilder {
30    /// Creates a new `GenerateRandomBytes`.
31    pub(crate) fn new(client: crate::deps::aws_cryptography_primitives::client::Client) -> Self {
32        Self {
33            client,
34            inner: ::std::default::Default::default(),
35        }
36    }
37    /// Access the GenerateRandomBytes as a reference.
38    pub fn as_input(&self) -> &crate::deps::aws_cryptography_primitives::operation::generate_random_bytes::builders::GenerateRandomBytesInputBuilder{
39        &self.inner
40    }
41    /// Sends the request and returns the response.
42    pub async fn send(
43        self,
44    ) -> ::std::result::Result<
45        ::aws_smithy_types::Blob,
46        crate::deps::aws_cryptography_primitives::types::error::Error,
47    > {
48        let input = self
49            .inner
50            .build()
51            // Using Opaque since we don't have a validation-specific error yet.
52            // Operations' models don't declare their own validation error,
53            // and smithy-rs seems to not generate a ValidationError case unless there is.
54            // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError.
55            .map_err(|mut e| {
56                let msg = format!("{:?}", e);
57                crate::deps::aws_cryptography_primitives::types::error::Error::OpaqueWithText {
58                    obj: ::dafny_runtime::Object::from_ref(&mut e as &mut ::dafny_runtime::DynAny),
59                    objMessage: msg,
60                }
61            })?;
62        crate::deps::aws_cryptography_primitives::operation::generate_random_bytes::GenerateRandomBytes::send(&self.client, input).await
63    }
64
65    #[allow(missing_docs)]
66    pub fn length(mut self, input: impl ::std::convert::Into<::std::primitive::i32>) -> Self {
67        self.inner = self.inner.length(input.into());
68        self
69    }
70    #[allow(missing_docs)]
71    pub fn set_length(mut self, input: ::std::option::Option<::std::primitive::i32>) -> Self {
72        self.inner = self.inner.set_length(input);
73        self
74    }
75    #[allow(missing_docs)]
76    pub fn get_length(&self) -> &::std::option::Option<::std::primitive::i32> {
77        self.inner.get_length()
78    }
79}