pub(crate) mod internal {
pub type BoxFuture<T> = ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = T> + ::std::marker::Send>>;
pub type SendResult<T, E> =
::std::result::Result<T, ::aws_smithy_runtime_api::client::result::SdkError<E, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>>;
pub trait CustomizableSend<T, E>: ::std::marker::Send + ::std::marker::Sync {
fn send(self, config_override: crate::config::Builder) -> BoxFuture<SendResult<T, E>>;
}
}
pub struct CustomizableOperation<T, E, B> {
customizable_send: B,
config_override: ::std::option::Option<crate::config::Builder>,
interceptors: Vec<::aws_smithy_runtime_api::client::interceptors::SharedInterceptor>,
runtime_plugins: Vec<::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin>,
_output: ::std::marker::PhantomData<T>,
_error: ::std::marker::PhantomData<E>,
}
impl<T, E, B> CustomizableOperation<T, E, B> {
#[allow(dead_code)] pub(crate) fn new(customizable_send: B) -> Self {
Self {
customizable_send,
config_override: ::std::option::Option::None,
interceptors: vec![],
runtime_plugins: vec![],
_output: ::std::marker::PhantomData,
_error: ::std::marker::PhantomData,
}
}
pub fn interceptor(mut self, interceptor: impl ::aws_smithy_runtime_api::client::interceptors::Intercept + 'static) -> Self {
self.interceptors
.push(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new(interceptor));
self
}
#[allow(unused)]
pub(crate) fn runtime_plugin(mut self, runtime_plugin: impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin + 'static) -> Self {
self.runtime_plugins
.push(::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin::new(runtime_plugin));
self
}
pub fn map_request<F, MapE>(mut self, f: F) -> Self
where
F: ::std::ops::Fn(
::aws_smithy_runtime_api::client::orchestrator::HttpRequest,
) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, MapE>
+ ::std::marker::Send
+ ::std::marker::Sync
+ 'static,
MapE: ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static,
{
self.interceptors
.push(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new(
::aws_smithy_runtime::client::interceptors::MapRequestInterceptor::new(f),
));
self
}
pub fn mutate_request<F>(mut self, f: F) -> Self
where
F: ::std::ops::Fn(&mut ::aws_smithy_runtime_api::client::orchestrator::HttpRequest) + ::std::marker::Send + ::std::marker::Sync + 'static,
{
self.interceptors
.push(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new(
::aws_smithy_runtime::client::interceptors::MutateRequestInterceptor::new(f),
));
self
}
pub fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.config_override = Some(config_override.into());
self
}
pub async fn send(self) -> crate::client::customize::internal::SendResult<T, E>
where
E: std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static,
B: crate::client::customize::internal::CustomizableSend<T, E>,
{
let mut config_override = self.config_override.unwrap_or_default();
self.interceptors.into_iter().for_each(|interceptor| {
config_override.push_interceptor(interceptor);
});
self.runtime_plugins.into_iter().for_each(|plugin| {
config_override.push_runtime_plugin(plugin);
});
self.customizable_send.send(config_override).await
}
}