Skip to main content

aws_sdk_s3/operation/
head_object.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `HeadObject`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct HeadObject;
6impl HeadObject {
7    /// Creates a new `HeadObject`
8    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::head_object::HeadObjectInput,
14    ) -> ::std::result::Result<
15        crate::operation::head_object::HeadObjectOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::head_object::HeadObjectError,
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::head_object::HeadObjectError>()
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::head_object::HeadObjectOutput>()
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::head_object::HeadObjectInput,
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", "HeadObject", input, runtime_plugins, stop_point)
55            // Create a parent span for the entire operation. Includes a random, internal-only,
56            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
57            .instrument(::tracing::debug_span!(
58                "S3.HeadObject",
59                "rpc.service" = "S3",
60                "rpc.method" = "HeadObject",
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 HeadObject {
88    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("HeadObject");
90
91        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92            HeadObjectRequestSerializer,
93        ));
94        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95            HeadObjectResponseDeserializer,
96        ));
97
98        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99            crate::config::auth::Params::builder()
100                .operation_name("HeadObject")
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("HeadObject", "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("HeadObject")
127            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
128                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
129            ))
130            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
131                HeadObjectEndpointParamsInterceptor,
132            ))
133            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
134                crate::s3_expires_interceptor::S3ExpiresInterceptor,
135            ))
136            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
137                crate::operation::head_object::HeadObjectError,
138            >::new())
139            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
140                crate::operation::head_object::HeadObjectError,
141            >::new())
142            .with_retry_classifier(
143                ::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::head_object::HeadObjectError>::builder()
144                    .transient_errors({
145                        let mut transient_errors: Vec<&'static str> = ::aws_runtime::retries::classifiers::TRANSIENT_ERRORS.into();
146                        transient_errors.push("InternalError");
147                        ::std::borrow::Cow::Owned(transient_errors)
148                    })
149                    .build(),
150            );
151
152        ::std::borrow::Cow::Owned(rcb)
153    }
154}
155
156#[derive(Debug)]
157struct HeadObjectResponseDeserializer;
158impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HeadObjectResponseDeserializer {
159    fn deserialize_nonstreaming_with_config(
160        &self,
161        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
162        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
163    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
164        let (success, status) = (response.status().is_success(), response.status().as_u16());
165        let headers = response.headers();
166        let body = response.body().bytes().expect("body loaded");
167        #[allow(unused_mut)]
168        let mut force_error = false;
169        ::tracing::debug!(extended_request_id = ?crate::s3_request_id::RequestIdExt::extended_request_id(response));
170        if matches!(crate::rest_xml_unwrapped_errors::body_is_error(body), Ok(true)) {
171            force_error = true;
172        }
173        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
174        let parse_result = if !success && status != 200 || force_error {
175            crate::protocol_serde::shape_head_object::de_head_object_http_error(status, headers, body)
176        } else {
177            crate::protocol_serde::shape_head_object::de_head_object_http_response(status, headers, body)
178        };
179        crate::protocol_serde::type_erase_result(parse_result)
180    }
181}
182#[derive(Debug)]
183struct HeadObjectRequestSerializer;
184impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for HeadObjectRequestSerializer {
185    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
186    fn serialize_input(
187        &self,
188        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
189        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
190    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
191        let input = input.downcast::<crate::operation::head_object::HeadObjectInput>().expect("correct type");
192        let _header_serialization_settings = _cfg
193            .load::<crate::serialization_settings::HeaderSerializationSettings>()
194            .cloned()
195            .unwrap_or_default();
196        let mut request_builder = {
197            #[allow(clippy::uninlined_format_args)]
198            fn uri_base(
199                _input: &crate::operation::head_object::HeadObjectInput,
200                output: &mut ::std::string::String,
201            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
202                use ::std::fmt::Write as _;
203                let input_1 = &_input.key;
204                let input_1 = input_1
205                    .as_ref()
206                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "cannot be empty or unset"))?;
207                let key = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Greedy);
208                if key.is_empty() {
209                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
210                        "key",
211                        "cannot be empty or unset",
212                    ));
213                }
214                ::std::write!(output, "/{Key}", Key = key).expect("formatting should succeed");
215                ::std::result::Result::Ok(())
216            }
217            fn uri_query(
218                _input: &crate::operation::head_object::HeadObjectInput,
219                mut output: &mut ::std::string::String,
220            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
221                let mut query = ::aws_smithy_http::query::Writer::new(output);
222                if let ::std::option::Option::Some(inner_2) = &_input.response_cache_control {
223                    {
224                        query.push_kv("response-cache-control", &::aws_smithy_http::query::fmt_string(inner_2));
225                    }
226                }
227                if let ::std::option::Option::Some(inner_3) = &_input.response_content_disposition {
228                    {
229                        query.push_kv("response-content-disposition", &::aws_smithy_http::query::fmt_string(inner_3));
230                    }
231                }
232                if let ::std::option::Option::Some(inner_4) = &_input.response_content_encoding {
233                    {
234                        query.push_kv("response-content-encoding", &::aws_smithy_http::query::fmt_string(inner_4));
235                    }
236                }
237                if let ::std::option::Option::Some(inner_5) = &_input.response_content_language {
238                    {
239                        query.push_kv("response-content-language", &::aws_smithy_http::query::fmt_string(inner_5));
240                    }
241                }
242                if let ::std::option::Option::Some(inner_6) = &_input.response_content_type {
243                    {
244                        query.push_kv("response-content-type", &::aws_smithy_http::query::fmt_string(inner_6));
245                    }
246                }
247                if let ::std::option::Option::Some(inner_7) = &_input.response_expires {
248                    {
249                        query.push_kv(
250                            "response-expires",
251                            &::aws_smithy_http::query::fmt_timestamp(inner_7, ::aws_smithy_types::date_time::Format::HttpDate)?,
252                        );
253                    }
254                }
255                if let ::std::option::Option::Some(inner_8) = &_input.version_id {
256                    {
257                        query.push_kv("versionId", &::aws_smithy_http::query::fmt_string(inner_8));
258                    }
259                }
260                if let ::std::option::Option::Some(inner_9) = &_input.part_number {
261                    {
262                        query.push_kv("partNumber", ::aws_smithy_types::primitive::Encoder::from(*inner_9).encode());
263                    }
264                }
265                ::std::result::Result::Ok(())
266            }
267            #[allow(clippy::unnecessary_wraps)]
268            fn update_http_builder(
269                input: &crate::operation::head_object::HeadObjectInput,
270                builder: ::http_1x::request::Builder,
271            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
272                let mut uri = ::std::string::String::new();
273                uri_base(input, &mut uri)?;
274                uri_query(input, &mut uri)?;
275                let builder = crate::protocol_serde::shape_head_object::ser_head_object_headers(input, builder)?;
276                ::std::result::Result::Ok(builder.method("HEAD").uri(uri))
277            }
278            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
279            builder
280        };
281        let body = ::aws_smithy_types::body::SdkBody::from("");
282
283        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
284    }
285}
286#[derive(Debug)]
287struct HeadObjectEndpointParamsInterceptor;
288
289#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
290impl ::aws_smithy_runtime_api::client::interceptors::Intercept for HeadObjectEndpointParamsInterceptor {
291    fn name(&self) -> &'static str {
292        "HeadObjectEndpointParamsInterceptor"
293    }
294
295    fn read_before_execution(
296        &self,
297        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
298            '_,
299            ::aws_smithy_runtime_api::client::interceptors::context::Input,
300            ::aws_smithy_runtime_api::client::interceptors::context::Output,
301            ::aws_smithy_runtime_api::client::interceptors::context::Error,
302        >,
303        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
304    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
305        let _input = context
306            .input()
307            .downcast_ref::<HeadObjectInput>()
308            .ok_or("failed to downcast to HeadObjectInput")?;
309
310        let params = crate::config::endpoint::Params::builder()
311            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
312            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
313            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
314            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
315            .set_force_path_style(cfg.load::<crate::config::ForcePathStyle>().map(|ty| ty.0))
316            .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
317            .set_disable_multi_region_access_points(cfg.load::<crate::config::DisableMultiRegionAccessPoints>().map(|ty| ty.0))
318            .set_accelerate(cfg.load::<crate::config::Accelerate>().map(|ty| ty.0))
319            .set_disable_s3_express_session_auth(cfg.load::<crate::config::DisableS3ExpressSessionAuth>().map(|ty| ty.0))
320            .set_bucket(Some(
321                _input
322                    .bucket
323                    .clone()
324                    .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
325                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bucket", "A required field was not set"))?,
326            ))
327            .set_key(Some(
328                _input
329                    .key
330                    .clone()
331                    .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
332                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "A required field was not set"))?,
333            ))
334            .build()
335            .map_err(|err| {
336                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
337            })?;
338        cfg.interceptor_state()
339            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
340        ::std::result::Result::Ok(())
341    }
342}
343
344// The get_* functions below are generated from JMESPath expressions in the
345// operationContextParams trait. They target the operation's input shape.
346
347#[allow(unreachable_code, unused_variables)]
348#[cfg(test)]
349mod head_object_test {
350
351    /// https://github.com/awslabs/aws-sdk-rust/issues/331
352    /// Test ID: HeadObjectUriEncoding
353    #[::tokio::test]
354    #[::tracing_test::traced_test]
355    async fn head_object_uri_encoding_request() {
356        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
357        let config_builder = crate::config::Config::builder()
358            .with_test_defaults()
359            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
360            //  Until the incorrect separation is addressed, we need to rely on this workaround.
361            .allow_no_auth()
362            .endpoint_url("https://example.com");
363        let config_builder = config_builder.region(::aws_types::region::Region::new("us-east-1"));
364        let mut config_builder = config_builder;
365        config_builder.set_region(Some(crate::config::Region::new("us-east-1")));
366
367        let config = config_builder.http_client(http_client).build();
368        let client = crate::Client::from_conf(config);
369        let result = client
370            .head_object()
371            .set_bucket(::std::option::Option::Some("test-bucket".to_owned()))
372            .set_key(::std::option::Option::Some("<> `?🐱".to_owned()))
373            .send()
374            .await;
375        let _ = dbg!(result);
376        let http_request = request_receiver.expect_request();
377        let uri: ::http_1x::Uri = http_request.uri().parse().expect("invalid URI sent");
378        ::pretty_assertions::assert_eq!(http_request.method(), "HEAD", "method was incorrect");
379        ::pretty_assertions::assert_eq!(uri.path(), "/%3C%3E%20%60%3F%F0%9F%90%B1", "path was incorrect");
380    }
381
382    /// This test case validates https://github.com/smithy-lang/smithy-rs/issues/456
383    /// Test ID: HeadObjectEmptyBody
384    #[::tokio::test]
385    #[::tracing_test::traced_test]
386    async fn head_object_empty_body_response() {
387        let expected_output = crate::types::error::NotFound::builder().build();
388        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
389            ::http_1x::response::Builder::new()
390                .header("content-type", "application/xml")
391                .header("date", "Thu, 03 Jun 2021 04:05:52 GMT")
392                .header("server", "AmazonS3")
393                .header(
394                    "x-amz-id-2",
395                    "UTniwu6QmCIjVeuK2ZfeWBOnu7SqMQOS3Vac6B/K4H2ZCawYUl+nDbhGTImuyhZ5DFiojR3Kcz4=",
396                )
397                .header("x-amz-request-id", "GRZ6BZ468DF52F2E")
398                .status(404)
399                .body(::aws_smithy_types::body::SdkBody::from(""))
400                .unwrap(),
401        )
402        .unwrap();
403        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
404        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
405
406        let op = crate::operation::head_object::HeadObject::new();
407        let config = op.config().expect("the operation has config");
408        let de = config
409            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
410            .expect("the config must have a deserializer");
411
412        // Build a config bag with the protocol for schema-based deserialization
413        #[allow(unused_mut)]
414        let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
415
416        let parsed = de.deserialize_streaming(&mut http_response);
417        let parsed = parsed.unwrap_or_else(|| {
418            let http_response = http_response.map(|body| {
419                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
420                    body.bytes().unwrap(),
421                    ::aws_smithy_protocol_test::MediaType::from("application/xml"),
422                )))
423            });
424            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
425        });
426        let parsed = parsed.expect_err("should be error response");
427        let parsed: &crate::operation::head_object::HeadObjectError = parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
428        if let crate::operation::head_object::HeadObjectError::NotFound(parsed) = parsed {
429            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
430        } else {
431            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
432        }
433    }
434}
435
436/// Error type for the `HeadObjectError` operation.
437#[non_exhaustive]
438#[derive(::std::fmt::Debug)]
439pub enum HeadObjectError {
440    /// <p>The specified content does not exist.</p>
441    NotFound(crate::types::error::NotFound),
442    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
443    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
444    variable wildcard pattern and check `.code()`:
445     \
446    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
447     \
448    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-HeadObjectError) for what information is available for the error.")]
449    Unhandled(crate::error::sealed_unhandled::Unhandled),
450}
451impl HeadObjectError {
452    /// Creates the `HeadObjectError::Unhandled` variant from any error type.
453    pub fn unhandled(
454        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
455    ) -> Self {
456        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
457            source: err.into(),
458            meta: ::std::default::Default::default(),
459        })
460    }
461
462    /// Creates the `HeadObjectError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
463    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
464        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
465            source: err.clone().into(),
466            meta: err,
467        })
468    }
469    ///
470    /// Returns error metadata, which includes the error code, message,
471    /// request ID, and potentially additional information.
472    ///
473    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
474        match self {
475            Self::NotFound(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
476            Self::Unhandled(e) => &e.meta,
477        }
478    }
479    /// Returns `true` if the error kind is `HeadObjectError::NotFound`.
480    pub fn is_not_found(&self) -> bool {
481        matches!(self, Self::NotFound(_))
482    }
483}
484impl ::std::error::Error for HeadObjectError {
485    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
486        match self {
487            Self::NotFound(_inner) => ::std::option::Option::Some(_inner),
488            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
489        }
490    }
491}
492impl ::std::fmt::Display for HeadObjectError {
493    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
494        match self {
495            Self::NotFound(_inner) => _inner.fmt(f),
496            Self::Unhandled(_inner) => {
497                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
498                    write!(f, "unhandled error ({code})")
499                } else {
500                    f.write_str("unhandled error")
501                }
502            }
503        }
504    }
505}
506impl ::aws_smithy_types::retry::ProvideErrorKind for HeadObjectError {
507    fn code(&self) -> ::std::option::Option<&str> {
508        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
509    }
510    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
511        ::std::option::Option::None
512    }
513}
514impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for HeadObjectError {
515    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
516        match self {
517            Self::NotFound(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
518            Self::Unhandled(_inner) => &_inner.meta,
519        }
520    }
521}
522impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for HeadObjectError {
523    fn create_unhandled_error(
524        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
525        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
526    ) -> Self {
527        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
528            source,
529            meta: meta.unwrap_or_default(),
530        })
531    }
532}
533impl crate::s3_request_id::RequestIdExt for crate::operation::head_object::HeadObjectError {
534    fn extended_request_id(&self) -> Option<&str> {
535        self.meta().extended_request_id()
536    }
537}
538impl ::aws_types::request_id::RequestId for crate::operation::head_object::HeadObjectError {
539    fn request_id(&self) -> Option<&str> {
540        self.meta().request_id()
541    }
542}
543
544pub use crate::operation::head_object::_head_object_input::HeadObjectInput;
545
546pub use crate::operation::head_object::_head_object_output::HeadObjectOutput;
547
548mod _head_object_input;
549
550mod _head_object_output;
551
552/// Builders
553pub mod builders;