aws_sdk_s3/client/
customize.rs1impl<E, B> CustomizableOperation<crate::operation::upload_part::UploadPartOutput, E, B> {
4 pub fn disable_payload_signing(self) -> Self {
11 self.runtime_plugin(::aws_runtime::auth::PayloadSigningOverrideRuntimePlugin::unsigned())
12 }
13}
14
15impl<E, B> CustomizableOperation<crate::operation::put_object::PutObjectOutput, E, B> {
16 pub fn disable_payload_signing(self) -> Self {
23 self.runtime_plugin(::aws_runtime::auth::PayloadSigningOverrideRuntimePlugin::unsigned())
24 }
25}
26
27pub struct CustomizableOperation<T, E, B> {
29 customizable_send: B,
30 config_override: ::std::option::Option<crate::config::Builder>,
31 interceptors: Vec<::aws_smithy_runtime_api::client::interceptors::SharedInterceptor>,
32 runtime_plugins: Vec<::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin>,
33 _output: ::std::marker::PhantomData<T>,
34 _error: ::std::marker::PhantomData<E>,
35}
36
37impl<T, E, B> CustomizableOperation<T, E, B> {
38 #[allow(dead_code)] pub(crate) fn new(customizable_send: B) -> Self {
41 Self {
42 customizable_send,
43 config_override: ::std::option::Option::None,
44 interceptors: vec![],
45 runtime_plugins: vec![],
46 _output: ::std::marker::PhantomData,
47 _error: ::std::marker::PhantomData,
48 }
49 }
50
51 pub(crate) fn execute<U>(self, f: impl ::std::ops::FnOnce(B, crate::config::Builder) -> U) -> U {
52 let mut config_override = self.config_override.unwrap_or_default();
53 self.interceptors.into_iter().for_each(|interceptor| {
54 config_override.push_interceptor(interceptor);
55 });
56 self.runtime_plugins.into_iter().for_each(|plugin| {
57 config_override.push_runtime_plugin(plugin);
58 });
59 f(self.customizable_send, config_override)
60 }
61
62 pub fn interceptor(mut self, interceptor: impl ::aws_smithy_runtime_api::client::interceptors::Intercept + 'static) -> Self {
69 self.interceptors
70 .push(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new(interceptor));
71 self
72 }
73
74 #[allow(unused)]
76 pub(crate) fn runtime_plugin(mut self, runtime_plugin: impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin + 'static) -> Self {
77 self.runtime_plugins
78 .push(::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin::new(runtime_plugin));
79 self
80 }
81
82 pub fn map_request<F, MapE>(mut self, f: F) -> Self
84 where
85 F: ::std::ops::Fn(
86 ::aws_smithy_runtime_api::client::orchestrator::HttpRequest,
87 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, MapE>
88 + ::std::marker::Send
89 + ::std::marker::Sync
90 + 'static,
91 MapE: ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static,
92 {
93 self.interceptors
94 .push(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new(
95 ::aws_smithy_runtime::client::interceptors::MapRequestInterceptor::new(f),
96 ));
97 self
98 }
99
100 pub fn mutate_request<F>(mut self, f: F) -> Self
102 where
103 F: ::std::ops::Fn(&mut ::aws_smithy_runtime_api::client::orchestrator::HttpRequest) + ::std::marker::Send + ::std::marker::Sync + 'static,
104 {
105 self.interceptors
106 .push(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new(
107 ::aws_smithy_runtime::client::interceptors::MutateRequestInterceptor::new(f),
108 ));
109 self
110 }
111
112 pub fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
124 self.config_override = Some(config_override.into());
125 self
126 }
127
128 pub async fn send(self) -> crate::client::customize::internal::SendResult<T, E>
130 where
131 E: std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static,
132 B: crate::client::customize::internal::CustomizableSend<T, E>,
133 {
134 self.execute(|sender, config| sender.send(config)).await
135 }
136
137 #[allow(unused_mut)]
139 pub async fn presigned(
140 mut self,
141 presigning_config: crate::presigning::PresigningConfig,
142 ) -> ::std::result::Result<crate::presigning::PresignedRequest, crate::error::SdkError<E>>
143 where
144 E: std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static,
145 B: crate::client::customize::internal::CustomizablePresigned<E>,
146 {
147 self.execute(move |sender, conf| sender.presign(conf, presigning_config)).await
148 }
149}
150
151pub(crate) mod internal;