1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct SelectObjectContent;
6impl SelectObjectContent {
7 pub fn new() -> Self {
9 Self
10 }
11 pub(crate) async fn orchestrate(
12 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13 input: crate::operation::select_object_content::SelectObjectContentInput,
14 ) -> ::std::result::Result<
15 crate::operation::select_object_content::SelectObjectContentOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::select_object_content::SelectObjectContentError,
18 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19 >,
20 > {
21 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22 ::aws_smithy_runtime_api::client::interceptors::context::Error,
23 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24 >| {
25 err.map_service_error(|err| {
26 err.downcast::<crate::operation::select_object_content::SelectObjectContentError>()
27 .expect("correct error type")
28 })
29 };
30 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31 .await
32 .map_err(map_err)?;
33 let output = context.finalize().map_err(map_err)?;
34 ::std::result::Result::Ok(
35 output
36 .downcast::<crate::operation::select_object_content::SelectObjectContentOutput>()
37 .expect("correct output type"),
38 )
39 }
40
41 pub(crate) async fn orchestrate_with_stop_point(
42 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43 input: crate::operation::select_object_content::SelectObjectContentInput,
44 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45 ) -> ::std::result::Result<
46 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47 ::aws_smithy_runtime_api::client::result::SdkError<
48 ::aws_smithy_runtime_api::client::interceptors::context::Error,
49 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50 >,
51 > {
52 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53 use ::tracing::Instrument;
54 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("S3", "SelectObjectContent", input, runtime_plugins, stop_point)
55 .instrument(::tracing::debug_span!(
58 "S3.SelectObjectContent",
59 "rpc.service" = "S3",
60 "rpc.method" = "SelectObjectContent",
61 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62 "rpc.system" = "aws-api",
63 ))
64 .await
65 }
66
67 pub(crate) fn operation_runtime_plugins(
68 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
69 client_config: &crate::config::Config,
70 config_override: ::std::option::Option<crate::config::Builder>,
71 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
72 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
73
74 if let ::std::option::Option::Some(config_override) = config_override {
75 for plugin in config_override.runtime_plugins.iter().cloned() {
76 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
77 }
78 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
79 config_override,
80 client_config.config.clone(),
81 &client_config.runtime_components,
82 ));
83 }
84 runtime_plugins
85 }
86}
87impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for SelectObjectContent {
88 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("SelectObjectContent");
90
91 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92 SelectObjectContentRequestSerializer,
93 ));
94 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95 SelectObjectContentResponseDeserializer,
96 ));
97
98 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99 crate::config::auth::Params::builder()
100 .operation_name("SelectObjectContent")
101 .build()
102 .expect("required fields set"),
103 ));
104
105 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("SelectObjectContent", "S3"));
106 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
107 signing_options.double_uri_encode = false;
108 signing_options.content_sha256_header = true;
109 signing_options.normalize_uri_path = false;
110 signing_options.payload_override = None;
111
112 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
113 signing_options,
114 ..::std::default::Default::default()
115 });
116
117 ::std::option::Option::Some(cfg.freeze())
118 }
119
120 fn runtime_components(
121 &self,
122 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
123 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
124 #[allow(unused_mut)]
125 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("SelectObjectContent")
126 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(SelectObjectContentTelemetryInputCaptureInterceptor))
127.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(SelectObjectContentEndpointParamsInterceptor))
128 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::select_object_content::SelectObjectContentError>::new())
129.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::select_object_content::SelectObjectContentError>::new())
130.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::select_object_content::SelectObjectContentError>::builder().transient_errors({
131 let mut transient_errors: Vec<&'static str> = ::aws_runtime::retries::classifiers::TRANSIENT_ERRORS.into();
132 transient_errors.push("InternalError");
133 ::std::borrow::Cow::Owned(transient_errors)
134 }).build());
135
136 ::std::borrow::Cow::Owned(rcb)
137 }
138}
139
140#[derive(Debug)]
141struct SelectObjectContentTelemetryInputCaptureInterceptor;
142
143#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
144impl ::aws_smithy_runtime_api::client::interceptors::Intercept for SelectObjectContentTelemetryInputCaptureInterceptor {
145 fn name(&self) -> &'static str {
146 "SelectObjectContentTelemetryInputCaptureInterceptor"
147 }
148
149 fn read_before_execution(
150 &self,
151 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
152 '_,
153 ::aws_smithy_runtime_api::client::interceptors::context::Input,
154 ::aws_smithy_runtime_api::client::interceptors::context::Output,
155 ::aws_smithy_runtime_api::client::interceptors::context::Error,
156 >,
157 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
158 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
159 let ::std::option::Option::Some(requested) = cfg
161 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
162 .filter(|r| !r.is_empty())
163 else {
164 return ::std::result::Result::Ok(());
165 };
166
167 let ::std::option::Option::Some(input) = context.input().downcast_ref::<SelectObjectContentInput>() else {
168 return ::std::result::Result::Ok(());
170 };
171
172 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
173 if requested.should_capture("Bucket") {
174 if let ::std::option::Option::Some(value) = input.bucket.as_deref() {
175 captured.insert("Bucket", value);
176 }
177 }
178 if requested.should_capture("Key") {
179 if let ::std::option::Option::Some(value) = input.key.as_deref() {
180 captured.insert("Key", value);
181 }
182 }
183 if requested.should_capture("SSECustomerAlgorithm") {
184 if let ::std::option::Option::Some(value) = input.sse_customer_algorithm.as_deref() {
185 captured.insert("SSECustomerAlgorithm", value);
186 }
187 }
188 if requested.should_capture("SSECustomerKeyMD5") {
189 if let ::std::option::Option::Some(value) = input.sse_customer_key_md5.as_deref() {
190 captured.insert("SSECustomerKeyMD5", value);
191 }
192 }
193 if requested.should_capture("Expression") {
194 if let ::std::option::Option::Some(value) = input.expression.as_deref() {
195 captured.insert("Expression", value);
196 }
197 }
198 if requested.should_capture("ExpectedBucketOwner") {
199 if let ::std::option::Option::Some(value) = input.expected_bucket_owner.as_deref() {
200 captured.insert("ExpectedBucketOwner", value);
201 }
202 }
203
204 cfg.interceptor_state().store_put(captured);
205 ::std::result::Result::Ok(())
206 }
207}
208#[derive(Debug)]
209struct SelectObjectContentResponseDeserializer;
210impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for SelectObjectContentResponseDeserializer {
211 fn deserialize_streaming(
212 &self,
213 response: &mut ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
214 ) -> ::std::option::Option<::aws_smithy_runtime_api::client::interceptors::context::OutputOrError> {
215 #[allow(unused_mut)]
216 let mut force_error = false;
217 ::tracing::debug!(extended_request_id = ?crate::s3_request_id::RequestIdExt::extended_request_id(response));
218 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
219
220 if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
222 return ::std::option::Option::None;
223 }
224 ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
225 crate::protocol_serde::shape_select_object_content::de_select_object_content_http_response(response),
226 ))
227 }
228
229 fn deserialize_nonstreaming_with_config(
230 &self,
231 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
232 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
233 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
234 let body = response.body().bytes().expect("body loaded");
236 crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_select_object_content::de_select_object_content_http_error(
237 response.status().as_u16(),
238 response.headers(),
239 body,
240 ))
241 }
242}
243#[derive(Debug)]
244struct SelectObjectContentRequestSerializer;
245impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for SelectObjectContentRequestSerializer {
246 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
247 fn serialize_input(
248 &self,
249 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
250 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
251 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
252 let input = input
253 .downcast::<crate::operation::select_object_content::SelectObjectContentInput>()
254 .expect("correct type");
255 let _header_serialization_settings = _cfg
256 .load::<crate::serialization_settings::HeaderSerializationSettings>()
257 .cloned()
258 .unwrap_or_default();
259 let mut request_builder = {
260 #[allow(clippy::uninlined_format_args)]
261 fn uri_base(
262 _input: &crate::operation::select_object_content::SelectObjectContentInput,
263 output: &mut ::std::string::String,
264 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
265 use ::std::fmt::Write as _;
266 let input_1 = &_input.key;
267 let input_1 = input_1
268 .as_ref()
269 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "cannot be empty or unset"))?;
270 let key = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Greedy);
271 if key.is_empty() {
272 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
273 "key",
274 "cannot be empty or unset",
275 ));
276 }
277 ::std::write!(output, "/{Key}", Key = key).expect("formatting should succeed");
278 ::std::result::Result::Ok(())
279 }
280 fn uri_query(
281 _input: &crate::operation::select_object_content::SelectObjectContentInput,
282 mut output: &mut ::std::string::String,
283 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
284 let mut query = ::aws_smithy_http::query::Writer::new(output);
285 query.push_v("select");
286 query.push_kv("select-type", "2");
287 ::std::result::Result::Ok(())
288 }
289 #[allow(clippy::unnecessary_wraps)]
290 fn update_http_builder(
291 input: &crate::operation::select_object_content::SelectObjectContentInput,
292 builder: ::http_1x::request::Builder,
293 ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
294 let mut uri = ::std::string::String::new();
295 uri_base(input, &mut uri)?;
296 uri_query(input, &mut uri)?;
297 let builder = crate::protocol_serde::shape_select_object_content::ser_select_object_content_headers(input, builder)?;
298 ::std::result::Result::Ok(builder.method("POST").uri(uri))
299 }
300 let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
301 builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/xml");
302 builder
303 };
304 let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_select_object_content::ser_select_object_content_op_input(
305 &input,
306 )?);
307 if let Some(content_length) = body.content_length() {
308 let content_length = content_length.to_string();
309 request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
310 }
311 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
312 }
313}
314#[derive(Debug)]
315struct SelectObjectContentEndpointParamsInterceptor;
316
317#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
318impl ::aws_smithy_runtime_api::client::interceptors::Intercept for SelectObjectContentEndpointParamsInterceptor {
319 fn name(&self) -> &'static str {
320 "SelectObjectContentEndpointParamsInterceptor"
321 }
322
323 fn read_before_execution(
324 &self,
325 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
326 '_,
327 ::aws_smithy_runtime_api::client::interceptors::context::Input,
328 ::aws_smithy_runtime_api::client::interceptors::context::Output,
329 ::aws_smithy_runtime_api::client::interceptors::context::Error,
330 >,
331 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
332 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
333 let _input = context
334 .input()
335 .downcast_ref::<SelectObjectContentInput>()
336 .ok_or("failed to downcast to SelectObjectContentInput")?;
337
338 let params = crate::config::endpoint::Params::builder()
339 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
340 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
341 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
342 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
343 .set_force_path_style(cfg.load::<crate::config::ForcePathStyle>().map(|ty| ty.0))
344 .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
345 .set_disable_multi_region_access_points(cfg.load::<crate::config::DisableMultiRegionAccessPoints>().map(|ty| ty.0))
346 .set_accelerate(cfg.load::<crate::config::Accelerate>().map(|ty| ty.0))
347 .set_disable_s3_express_session_auth(cfg.load::<crate::config::DisableS3ExpressSessionAuth>().map(|ty| ty.0))
348 .set_bucket(Some(
349 _input
350 .bucket
351 .clone()
352 .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
353 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bucket", "A required field was not set"))?,
354 ))
355 .build()
356 .map_err(|err| {
357 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
358 })?;
359 cfg.interceptor_state()
360 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
361 ::std::result::Result::Ok(())
362 }
363}
364
365#[non_exhaustive]
370#[derive(::std::fmt::Debug)]
371pub enum SelectObjectContentError {
372 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
374 variable wildcard pattern and check `.code()`:
375 \
376 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
377 \
378 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-SelectObjectContentError) for what information is available for the error.")]
379 Unhandled(crate::error::sealed_unhandled::Unhandled),
380}
381impl SelectObjectContentError {
382 pub fn unhandled(
384 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
385 ) -> Self {
386 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
387 source: err.into(),
388 meta: ::std::default::Default::default(),
389 })
390 }
391
392 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
394 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
395 source: err.clone().into(),
396 meta: err,
397 })
398 }
399 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
404 match self {
405 Self::Unhandled(e) => &e.meta,
406 }
407 }
408}
409impl ::std::error::Error for SelectObjectContentError {
410 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
411 match self {
412 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
413 }
414 }
415}
416impl ::std::fmt::Display for SelectObjectContentError {
417 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
418 match self {
419 Self::Unhandled(_inner) => {
420 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
421 write!(f, "unhandled error ({code})")
422 } else {
423 f.write_str("unhandled error")
424 }
425 }
426 }
427 }
428}
429impl ::aws_smithy_types::retry::ProvideErrorKind for SelectObjectContentError {
430 fn code(&self) -> ::std::option::Option<&str> {
431 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
432 }
433 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
434 ::std::option::Option::None
435 }
436}
437impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for SelectObjectContentError {
438 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
439 match self {
440 Self::Unhandled(_inner) => &_inner.meta,
441 }
442 }
443}
444impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for SelectObjectContentError {
445 fn create_unhandled_error(
446 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
447 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
448 ) -> Self {
449 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
450 source,
451 meta: meta.unwrap_or_default(),
452 })
453 }
454}
455impl crate::s3_request_id::RequestIdExt for crate::operation::select_object_content::SelectObjectContentError {
456 fn extended_request_id(&self) -> Option<&str> {
457 self.meta().extended_request_id()
458 }
459}
460impl ::aws_types::request_id::RequestId for crate::operation::select_object_content::SelectObjectContentError {
461 fn request_id(&self) -> Option<&str> {
462 self.meta().request_id()
463 }
464}
465
466pub use crate::operation::select_object_content::_select_object_content_input::SelectObjectContentInput;
467
468pub use crate::operation::select_object_content::_select_object_content_output::SelectObjectContentOutput;
469
470mod _select_object_content_input;
471
472mod _select_object_content_output;
473
474pub mod builders;