aws_db_esdk/deps/aws_cryptography_materialProviders/operation/get_client/
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_materialProviders::operation::get_client::_get_client_output::GetClientOutputBuilder;
5
6pub use crate::deps::aws_cryptography_materialProviders::operation::get_client::_get_client_input::GetClientInputBuilder;
7
8impl GetClientInputBuilder {
9    /// Sends a request with this input using the given client.
10    pub async fn send_with(
11        self,
12        client_supplier: &crate::deps::aws_cryptography_materialProviders::types::client_supplier::ClientSupplierRef,
13    ) -> ::std::result::Result<
14        crate::deps::com_amazonaws_kms::client::Client,
15        crate::deps::aws_cryptography_materialProviders::types::error::Error,
16    > {
17        let mut fluent_builder = client_supplier.get_client();
18        fluent_builder.inner = self;
19        fluent_builder.send().await
20    }
21}
22/// Fluent builder constructing a request to `GetClient`.
23///
24/// Returns an AWS KMS Client.
25#[derive(::std::clone::Clone, ::std::fmt::Debug)]
26pub struct GetClientFluentBuilder {
27    client_supplier: crate::deps::aws_cryptography_materialProviders::types::client_supplier::ClientSupplierRef,
28    pub(crate) inner: crate::deps::aws_cryptography_materialProviders::operation::get_client::builders::GetClientInputBuilder,
29}
30impl GetClientFluentBuilder {
31    /// Creates a new `GetClient`.
32    pub(crate) fn new(
33        client_supplier: crate::deps::aws_cryptography_materialProviders::types::client_supplier::ClientSupplierRef,
34    ) -> Self {
35        Self {
36            client_supplier,
37            inner: ::std::default::Default::default(),
38        }
39    }
40    /// Access the GetClient as a reference.
41    pub fn as_input(&self) -> &crate::deps::aws_cryptography_materialProviders::operation::get_client::builders::GetClientInputBuilder{
42        &self.inner
43    }
44    /// Sends the request and returns the response.
45    pub async fn send(
46        self,
47    ) -> ::std::result::Result<
48        crate::deps::com_amazonaws_kms::client::Client,
49        crate::deps::aws_cryptography_materialProviders::types::error::Error,
50    > {
51        let input = self
52            .inner
53            .build()
54            // Using Opaque since we don't have a validation-specific error yet.
55            // Operations' models don't declare their own validation error,
56            // and smithy-rs seems to not generate a ValidationError case unless there is.
57            // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError.
58            .map_err(|mut e| {
59	     let msg = format!("{:?}", e);
60             crate::deps::aws_cryptography_materialProviders::types::error::Error::OpaqueWithText {
61                obj: ::dafny_runtime::Object::from_ref(&mut e as &mut ::dafny_runtime::DynAny),
62		objMessage: msg
63             }})?;
64        crate::deps::aws_cryptography_materialProviders::operation::get_client::GetClient::send(
65            &self.client_supplier,
66            input,
67        )
68        .await
69    }
70
71    /// The region the client should be created in.
72    pub fn region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
73        self.inner = self.inner.region(input.into());
74        self
75    }
76    /// The region the client should be created in.
77    pub fn set_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
78        self.inner = self.inner.set_region(input);
79        self
80    }
81    /// The region the client should be created in.
82    pub fn get_region(&self) -> &::std::option::Option<::std::string::String> {
83        self.inner.get_region()
84    }
85}