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