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