1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetObject;
6impl GetObject {
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::get_object::GetObjectInput,
14 ) -> ::std::result::Result<
15 crate::operation::get_object::GetObjectOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::get_object::GetObjectError,
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::get_object::GetObjectError>()
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::get_object::GetObjectOutput>()
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::get_object::GetObjectInput,
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", "GetObject", input, runtime_plugins, stop_point)
55 .instrument(::tracing::debug_span!(
58 "S3.GetObject",
59 "rpc.service" = "S3",
60 "rpc.method" = "GetObject",
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 GetObject {
88 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetObject");
90
91 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92 GetObjectRequestSerializer,
93 ));
94 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95 GetObjectResponseDeserializer,
96 ));
97
98 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99 crate::config::auth::Params::builder()
100 .operation_name("GetObject")
101 .build()
102 .expect("required fields set"),
103 ));
104
105 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
106 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("GetObject", "S3"));
107 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
108 signing_options.double_uri_encode = false;
109 signing_options.content_sha256_header = true;
110 signing_options.normalize_uri_path = false;
111 signing_options.payload_override = None;
112
113 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
114 signing_options,
115 ..::std::default::Default::default()
116 });
117
118 ::std::option::Option::Some(cfg.freeze())
119 }
120
121 fn runtime_components(
122 &self,
123 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
124 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
125 #[allow(unused_mut)]
126 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetObject")
127 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
128 .with_interceptor(GetObjectEndpointParamsInterceptor)
129 .with_interceptor(crate::s3_expires_interceptor::S3ExpiresInterceptor)
130 .with_interceptor(crate::http_response_checksum::ResponseChecksumInterceptor::new(
131 ["crc64nvme", "crc32", "crc32c", "sha256", "sha1"].as_slice(),
132 |input: &::aws_smithy_runtime_api::client::interceptors::context::Input| {
133 let input: &crate::operation::get_object::GetObjectInput = input.downcast_ref().expect("correct type");
134 matches!(input.checksum_mode(), ::std::option::Option::Some(crate::types::ChecksumMode::Enabled))
135 },
136 |input: &mut ::aws_smithy_runtime_api::client::interceptors::context::Input, cfg: &::aws_smithy_types::config_bag::ConfigBag| {
137 let input = input
138 .downcast_mut::<crate::operation::get_object::GetObjectInput>()
139 .ok_or("failed to downcast to crate::operation::get_object::GetObjectInput")?;
140
141 let request_validation_enabled = matches!(input.checksum_mode(), Some(crate::types::ChecksumMode::Enabled));
142
143 if !request_validation_enabled {
144 let response_checksum_validation = cfg
146 .load::<::aws_smithy_types::checksum_config::ResponseChecksumValidation>()
147 .unwrap_or(&::aws_smithy_types::checksum_config::ResponseChecksumValidation::WhenSupported);
148
149 let is_presigned_req = cfg.load::<crate::presigning::PresigningMarker>().is_some();
150
151 if is_presigned_req {
153 return ::std::result::Result::Ok(());
154 }
155
156 #[allow(clippy::wildcard_in_or_patterns)]
160 match response_checksum_validation {
161 ::aws_smithy_types::checksum_config::ResponseChecksumValidation::WhenRequired => {}
162 ::aws_smithy_types::checksum_config::ResponseChecksumValidation::WhenSupported | _ => {
163 input.checksum_mode = Some(crate::types::ChecksumMode::Enabled);
164 }
165 }
166 }
167
168 ::std::result::Result::Ok(())
169 },
170 ))
171 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
172 crate::operation::get_object::GetObjectError,
173 >::new())
174 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
175 crate::operation::get_object::GetObjectError,
176 >::new())
177 .with_retry_classifier(
178 ::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::get_object::GetObjectError>::builder()
179 .transient_errors({
180 let mut transient_errors: Vec<&'static str> = ::aws_runtime::retries::classifiers::TRANSIENT_ERRORS.into();
181 transient_errors.push("InternalError");
182 ::std::borrow::Cow::Owned(transient_errors)
183 })
184 .build(),
185 );
186
187 ::std::borrow::Cow::Owned(rcb)
188 }
189}
190
191#[derive(Debug)]
192struct GetObjectResponseDeserializer;
193impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetObjectResponseDeserializer {
194 fn deserialize_streaming(
195 &self,
196 response: &mut ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
197 ) -> ::std::option::Option<::aws_smithy_runtime_api::client::interceptors::context::OutputOrError> {
198 #[allow(unused_mut)]
199 let mut force_error = false;
200 ::tracing::debug!(extended_request_id = ?crate::s3_request_id::RequestIdExt::extended_request_id(response));
201 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
202
203 if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
205 return ::std::option::Option::None;
206 }
207 ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
208 crate::protocol_serde::shape_get_object::de_get_object_http_response(response),
209 ))
210 }
211
212 fn deserialize_nonstreaming(
213 &self,
214 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
215 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
216 let body = response.body().bytes().expect("body loaded");
218 crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_get_object::de_get_object_http_error(
219 response.status().as_u16(),
220 response.headers(),
221 body,
222 ))
223 }
224}
225#[derive(Debug)]
226struct GetObjectRequestSerializer;
227impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetObjectRequestSerializer {
228 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
229 fn serialize_input(
230 &self,
231 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
232 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
233 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
234 let input = input.downcast::<crate::operation::get_object::GetObjectInput>().expect("correct type");
235 let _header_serialization_settings = _cfg
236 .load::<crate::serialization_settings::HeaderSerializationSettings>()
237 .cloned()
238 .unwrap_or_default();
239 let mut request_builder = {
240 #[allow(clippy::uninlined_format_args)]
241 fn uri_base(
242 _input: &crate::operation::get_object::GetObjectInput,
243 output: &mut ::std::string::String,
244 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
245 use ::std::fmt::Write as _;
246 let input_1 = &_input.key;
247 let input_1 = input_1
248 .as_ref()
249 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "cannot be empty or unset"))?;
250 let key = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Greedy);
251 if key.is_empty() {
252 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
253 "key",
254 "cannot be empty or unset",
255 ));
256 }
257 ::std::write!(output, "/{Key}", Key = key).expect("formatting should succeed");
258 ::std::result::Result::Ok(())
259 }
260 fn uri_query(
261 _input: &crate::operation::get_object::GetObjectInput,
262 mut output: &mut ::std::string::String,
263 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
264 let mut query = ::aws_smithy_http::query::Writer::new(output);
265 query.push_kv("x-id", "GetObject");
266 if let ::std::option::Option::Some(inner_2) = &_input.response_cache_control {
267 {
268 query.push_kv("response-cache-control", &::aws_smithy_http::query::fmt_string(inner_2));
269 }
270 }
271 if let ::std::option::Option::Some(inner_3) = &_input.response_content_disposition {
272 {
273 query.push_kv("response-content-disposition", &::aws_smithy_http::query::fmt_string(inner_3));
274 }
275 }
276 if let ::std::option::Option::Some(inner_4) = &_input.response_content_encoding {
277 {
278 query.push_kv("response-content-encoding", &::aws_smithy_http::query::fmt_string(inner_4));
279 }
280 }
281 if let ::std::option::Option::Some(inner_5) = &_input.response_content_language {
282 {
283 query.push_kv("response-content-language", &::aws_smithy_http::query::fmt_string(inner_5));
284 }
285 }
286 if let ::std::option::Option::Some(inner_6) = &_input.response_content_type {
287 {
288 query.push_kv("response-content-type", &::aws_smithy_http::query::fmt_string(inner_6));
289 }
290 }
291 if let ::std::option::Option::Some(inner_7) = &_input.response_expires {
292 {
293 query.push_kv(
294 "response-expires",
295 &::aws_smithy_http::query::fmt_timestamp(inner_7, ::aws_smithy_types::date_time::Format::HttpDate)?,
296 );
297 }
298 }
299 if let ::std::option::Option::Some(inner_8) = &_input.version_id {
300 {
301 query.push_kv("versionId", &::aws_smithy_http::query::fmt_string(inner_8));
302 }
303 }
304 if let ::std::option::Option::Some(inner_9) = &_input.part_number {
305 {
306 query.push_kv("partNumber", ::aws_smithy_types::primitive::Encoder::from(*inner_9).encode());
307 }
308 }
309 ::std::result::Result::Ok(())
310 }
311 #[allow(clippy::unnecessary_wraps)]
312 fn update_http_builder(
313 input: &crate::operation::get_object::GetObjectInput,
314 builder: ::http::request::Builder,
315 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
316 let mut uri = ::std::string::String::new();
317 uri_base(input, &mut uri)?;
318 uri_query(input, &mut uri)?;
319 let builder = crate::protocol_serde::shape_get_object::ser_get_object_headers(input, builder)?;
320 ::std::result::Result::Ok(builder.method("GET").uri(uri))
321 }
322 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
323 builder
324 };
325 let body = ::aws_smithy_types::body::SdkBody::from("");
326
327 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
328 }
329}
330#[derive(Debug)]
331struct GetObjectEndpointParamsInterceptor;
332
333impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetObjectEndpointParamsInterceptor {
334 fn name(&self) -> &'static str {
335 "GetObjectEndpointParamsInterceptor"
336 }
337
338 fn read_before_execution(
339 &self,
340 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
341 '_,
342 ::aws_smithy_runtime_api::client::interceptors::context::Input,
343 ::aws_smithy_runtime_api::client::interceptors::context::Output,
344 ::aws_smithy_runtime_api::client::interceptors::context::Error,
345 >,
346 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
347 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
348 let _input = context
349 .input()
350 .downcast_ref::<GetObjectInput>()
351 .ok_or("failed to downcast to GetObjectInput")?;
352
353 let params = crate::config::endpoint::Params::builder()
354 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
355 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
356 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
357 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
358 .set_force_path_style(cfg.load::<crate::config::ForcePathStyle>().map(|ty| ty.0))
359 .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
360 .set_disable_multi_region_access_points(cfg.load::<crate::config::DisableMultiRegionAccessPoints>().map(|ty| ty.0))
361 .set_accelerate(cfg.load::<crate::config::Accelerate>().map(|ty| ty.0))
362 .set_disable_s3_express_session_auth(cfg.load::<crate::config::DisableS3ExpressSessionAuth>().map(|ty| ty.0))
363 .set_bucket(Some(
364 _input
365 .bucket
366 .clone()
367 .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
368 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bucket", "A required field was not set"))?,
369 ))
370 .set_key(Some(
371 _input
372 .key
373 .clone()
374 .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
375 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "A required field was not set"))?,
376 ))
377 .build()
378 .map_err(|err| {
379 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
380 })?;
381 cfg.interceptor_state()
382 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
383 ::std::result::Result::Ok(())
384 }
385}
386
387#[allow(unreachable_code, unused_variables)]
391#[cfg(test)]
392mod get_object_test {
393
394 #[::tokio::test]
397 #[::tracing_test::traced_test]
398 async fn get_object_if_modified_since_request() {
399 let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
400 let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
401 let config_builder = config_builder.region(::aws_types::region::Region::new("us-east-1"));
402 let mut config_builder = config_builder;
403 config_builder.set_region(Some(crate::config::Region::new("us-east-1")));
404
405 let config = config_builder.http_client(http_client).build();
406 let client = crate::Client::from_conf(config);
407 let result = client
408 .get_object()
409 .set_bucket(::std::option::Option::Some("test-bucket".to_owned()))
410 .set_key(::std::option::Option::Some("object.txt".to_owned()))
411 .set_if_modified_since(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
412 1626452453, 0.123_f64,
413 )))
414 .send()
415 .await;
416 let _ = dbg!(result);
417 let http_request = request_receiver.expect_request();
418 let expected_headers = [("if-modified-since", "Fri, 16 Jul 2021 16:20:53 GMT")];
419 ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
420 let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
421 ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
422 ::pretty_assertions::assert_eq!(uri.path(), "/object.txt", "path was incorrect");
423 }
424
425 #[::tokio::test]
429 #[::tracing_test::traced_test]
430 async fn s3_preserves_leading_dot_segment_in_uri_label_request() {
431 let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
432 let config_builder = crate::config::Config::builder()
433 .with_test_defaults()
434 .endpoint_url("https://s3.us-west-2.amazonaws.com");
435
436 let mut config_builder = config_builder;
437 config_builder.set_region(Some(crate::config::Region::new("us-east-1")));
438
439 let config = config_builder.http_client(http_client).build();
440 let client = crate::Client::from_conf(config);
441 let result = client
442 .get_object()
443 .set_bucket(::std::option::Option::Some("mybucket".to_owned()))
444 .set_key(::std::option::Option::Some("../key.txt".to_owned()))
445 .send()
446 .await;
447 let _ = dbg!(result);
448 let http_request = request_receiver.expect_request();
449 let body = http_request.body().bytes().expect("body should be strict");
450 ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
452 let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
453 ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
454 ::pretty_assertions::assert_eq!(uri.path(), "/../key.txt", "path was incorrect");
455 ::pretty_assertions::assert_eq!(uri.host().expect("host should be set"), "mybucket.s3.us-west-2.amazonaws.com");
456 }
457
458 #[::tokio::test]
462 #[::tracing_test::traced_test]
463 async fn s3_preserves_embedded_dot_segment_in_uri_label_request() {
464 let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
465 let config_builder = crate::config::Config::builder()
466 .with_test_defaults()
467 .endpoint_url("https://s3.us-west-2.amazonaws.com");
468
469 let mut config_builder = config_builder;
470 config_builder.set_region(Some(crate::config::Region::new("us-east-1")));
471
472 let config = config_builder.http_client(http_client).build();
473 let client = crate::Client::from_conf(config);
474 let result = client
475 .get_object()
476 .set_bucket(::std::option::Option::Some("mybucket".to_owned()))
477 .set_key(::std::option::Option::Some("foo/../key.txt".to_owned()))
478 .send()
479 .await;
480 let _ = dbg!(result);
481 let http_request = request_receiver.expect_request();
482 let body = http_request.body().bytes().expect("body should be strict");
483 ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
485 let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
486 ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
487 ::pretty_assertions::assert_eq!(uri.path(), "/foo/../key.txt", "path was incorrect");
488 ::pretty_assertions::assert_eq!(uri.host().expect("host should be set"), "mybucket.s3.us-west-2.amazonaws.com");
489 }
490}
491
492#[non_exhaustive]
494#[derive(::std::fmt::Debug)]
495pub enum GetObjectError {
496 InvalidObjectState(crate::types::error::InvalidObjectState),
499 NoSuchKey(crate::types::error::NoSuchKey),
501 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
503 variable wildcard pattern and check `.code()`:
504 \
505 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
506 \
507 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetObjectError) for what information is available for the error.")]
508 Unhandled(crate::error::sealed_unhandled::Unhandled),
509}
510impl GetObjectError {
511 pub fn unhandled(
513 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
514 ) -> Self {
515 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
516 source: err.into(),
517 meta: ::std::default::Default::default(),
518 })
519 }
520
521 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
523 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
524 source: err.clone().into(),
525 meta: err,
526 })
527 }
528 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
533 match self {
534 Self::InvalidObjectState(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
535 Self::NoSuchKey(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
536 Self::Unhandled(e) => &e.meta,
537 }
538 }
539 pub fn is_invalid_object_state(&self) -> bool {
541 matches!(self, Self::InvalidObjectState(_))
542 }
543 pub fn is_no_such_key(&self) -> bool {
545 matches!(self, Self::NoSuchKey(_))
546 }
547}
548impl ::std::error::Error for GetObjectError {
549 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
550 match self {
551 Self::InvalidObjectState(_inner) => ::std::option::Option::Some(_inner),
552 Self::NoSuchKey(_inner) => ::std::option::Option::Some(_inner),
553 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
554 }
555 }
556}
557impl ::std::fmt::Display for GetObjectError {
558 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
559 match self {
560 Self::InvalidObjectState(_inner) => _inner.fmt(f),
561 Self::NoSuchKey(_inner) => _inner.fmt(f),
562 Self::Unhandled(_inner) => {
563 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
564 write!(f, "unhandled error ({code})")
565 } else {
566 f.write_str("unhandled error")
567 }
568 }
569 }
570 }
571}
572impl ::aws_smithy_types::retry::ProvideErrorKind for GetObjectError {
573 fn code(&self) -> ::std::option::Option<&str> {
574 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
575 }
576 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
577 ::std::option::Option::None
578 }
579}
580impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetObjectError {
581 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
582 match self {
583 Self::InvalidObjectState(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
584 Self::NoSuchKey(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
585 Self::Unhandled(_inner) => &_inner.meta,
586 }
587 }
588}
589impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetObjectError {
590 fn create_unhandled_error(
591 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
592 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
593 ) -> Self {
594 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
595 source,
596 meta: meta.unwrap_or_default(),
597 })
598 }
599}
600impl crate::s3_request_id::RequestIdExt for crate::operation::get_object::GetObjectError {
601 fn extended_request_id(&self) -> Option<&str> {
602 self.meta().extended_request_id()
603 }
604}
605impl ::aws_types::request_id::RequestId for crate::operation::get_object::GetObjectError {
606 fn request_id(&self) -> Option<&str> {
607 self.meta().request_id()
608 }
609}
610
611pub use crate::operation::get_object::_get_object_output::GetObjectOutput;
612
613pub use crate::operation::get_object::_get_object_input::GetObjectInput;
614
615mod _get_object_input;
616
617mod _get_object_output;
618
619pub mod builders;