aws_sdk_cloudwatchlogs/client/
customize.rspub 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(crate) fn execute<U>(self, f: impl ::std::ops::FnOnce(B, crate::config::Builder) -> U) -> U {
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);
});
f(self.customizable_send, config_override)
}
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>,
{
self.execute(|sender, config| sender.send(config)).await
}
}
pub(crate) mod internal;