Skip to main content

aws_sdk_s3/operation/
get_object_annotation.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `GetObjectAnnotation`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetObjectAnnotation;
6impl GetObjectAnnotation {
7    /// Creates a new `GetObjectAnnotation`
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::get_object_annotation::GetObjectAnnotationInput,
14    ) -> ::std::result::Result<
15        crate::operation::get_object_annotation::GetObjectAnnotationOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::get_object_annotation::GetObjectAnnotationError,
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_annotation::GetObjectAnnotationError>()
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_annotation::GetObjectAnnotationOutput>()
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_annotation::GetObjectAnnotationInput,
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", "GetObjectAnnotation", 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.GetObjectAnnotation",
59                "rpc.service" = "S3",
60                "rpc.method" = "GetObjectAnnotation",
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 GetObjectAnnotation {
88    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetObjectAnnotation");
90
91        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92            GetObjectAnnotationRequestSerializer,
93        ));
94        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95            GetObjectAnnotationResponseDeserializer,
96        ));
97
98        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99            crate::config::auth::Params::builder()
100                .operation_name("GetObjectAnnotation")
101                .build()
102                .expect("required fields set"),
103        ));
104
105        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("GetObjectAnnotation", "S3"));
106        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
107        signing_options.double_uri_encode = false;
108        signing_options.content_sha256_header = true;
109        signing_options.normalize_uri_path = false;
110        signing_options.payload_override = None;
111
112        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
113            signing_options,
114            ..::std::default::Default::default()
115        });
116
117        ::std::option::Option::Some(cfg.freeze())
118    }
119
120    fn runtime_components(
121        &self,
122        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
123    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
124        #[allow(unused_mut)]
125                    let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetObjectAnnotation")
126                            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(GetObjectAnnotationTelemetryInputCaptureInterceptor))
127.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()))
128.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(GetObjectAnnotationEndpointParamsInterceptor))
129.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(crate::http_response_checksum::ResponseChecksumInterceptor::new(
130                                ["crc64nvme", "crc32", "crc32c", "sha256", "sha1", "sha512", "md5", "xxhash64", "xxhash3", "xxhash128"].as_slice(),
131                                |input: &::aws_smithy_runtime_api::client::interceptors::context::Input| {
132
133                                    let input: &crate::operation::get_object_annotation::GetObjectAnnotationInput = 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_annotation::GetObjectAnnotationInput>()
139                                        .ok_or("failed to downcast to crate::operation::get_object_annotation::GetObjectAnnotationInput")?;
140
141                                    let request_validation_enabled =
142                                        matches!(input.checksum_mode(), Some(crate::types::ChecksumMode::Enabled));
143
144                                    if !request_validation_enabled {
145                                        // This value is set by the user on the SdkConfig to indicate their preference
146                                        let response_checksum_validation = cfg
147                                            .load::<::aws_smithy_types::checksum_config::ResponseChecksumValidation>()
148                                            .unwrap_or(&::aws_smithy_types::checksum_config::ResponseChecksumValidation::WhenSupported);
149
150                                        let is_presigned_req = cfg.load::<crate::presigning::PresigningMarker>().is_some();
151
152                                        // For presigned requests we do not enable the checksum-mode header.
153                                        if is_presigned_req {
154                                            return ::std::result::Result::Ok(())
155                                        }
156
157                                        // If validation setting is WhenSupported (or unknown) we enable response checksum
158                                        // validation. If it is WhenRequired we do not enable (since there is no way to
159                                        // indicate that a response checksum is required).
160                                        #[allow(clippy::wildcard_in_or_patterns)]
161                                        match response_checksum_validation {
162                                            ::aws_smithy_types::checksum_config::ResponseChecksumValidation::WhenRequired => {}
163                                            ::aws_smithy_types::checksum_config::ResponseChecksumValidation::WhenSupported | _ => {
164                                                input.checksum_mode = Some(crate::types::ChecksumMode::Enabled);
165                                            }
166                                        }
167                                    }
168
169                                    ::std::result::Result::Ok(())
170                                }
171                            )))
172                            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::get_object_annotation::GetObjectAnnotationError>::new())
173.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::get_object_annotation::GetObjectAnnotationError>::new())
174.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::get_object_annotation::GetObjectAnnotationError>::builder().transient_errors({
175                                            let mut transient_errors: Vec<&'static str> = ::aws_runtime::retries::classifiers::TRANSIENT_ERRORS.into();
176                                            transient_errors.push("InternalError");
177                                            ::std::borrow::Cow::Owned(transient_errors)
178                                            }).build())
179.with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<crate::operation::get_object_annotation::GetObjectAnnotationError>::new());
180
181        ::std::borrow::Cow::Owned(rcb)
182    }
183}
184
185#[derive(Debug)]
186struct GetObjectAnnotationTelemetryInputCaptureInterceptor;
187
188#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
189impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetObjectAnnotationTelemetryInputCaptureInterceptor {
190    fn name(&self) -> &'static str {
191        "GetObjectAnnotationTelemetryInputCaptureInterceptor"
192    }
193
194    fn read_before_execution(
195        &self,
196        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
197            '_,
198            ::aws_smithy_runtime_api::client::interceptors::context::Input,
199            ::aws_smithy_runtime_api::client::interceptors::context::Output,
200            ::aws_smithy_runtime_api::client::interceptors::context::Error,
201        >,
202        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
203    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
204        // Nothing to do unless the customer opted in by naming members to record.
205        let ::std::option::Option::Some(requested) = cfg
206            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
207            .filter(|r| !r.is_empty())
208        else {
209            return ::std::result::Result::Ok(());
210        };
211
212        let ::std::option::Option::Some(input) = context.input().downcast_ref::<GetObjectAnnotationInput>() else {
213            // A mismatched input is not this interceptor's concern; skip quietly.
214            return ::std::result::Result::Ok(());
215        };
216
217        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
218        if requested.should_capture("Bucket") {
219            if let ::std::option::Option::Some(value) = input.bucket.as_deref() {
220                captured.insert("Bucket", value);
221            }
222        }
223        if requested.should_capture("Key") {
224            if let ::std::option::Option::Some(value) = input.key.as_deref() {
225                captured.insert("Key", value);
226            }
227        }
228        if requested.should_capture("AnnotationName") {
229            if let ::std::option::Option::Some(value) = input.annotation_name.as_deref() {
230                captured.insert("AnnotationName", value);
231            }
232        }
233        if requested.should_capture("VersionId") {
234            if let ::std::option::Option::Some(value) = input.version_id.as_deref() {
235                captured.insert("VersionId", value);
236            }
237        }
238        if requested.should_capture("ExpectedBucketOwner") {
239            if let ::std::option::Option::Some(value) = input.expected_bucket_owner.as_deref() {
240                captured.insert("ExpectedBucketOwner", value);
241            }
242        }
243
244        cfg.interceptor_state().store_put(captured);
245        ::std::result::Result::Ok(())
246    }
247}
248#[derive(Debug)]
249struct GetObjectAnnotationResponseDeserializer;
250impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetObjectAnnotationResponseDeserializer {
251    fn deserialize_streaming(
252        &self,
253        response: &mut ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
254    ) -> ::std::option::Option<::aws_smithy_runtime_api::client::interceptors::context::OutputOrError> {
255        #[allow(unused_mut)]
256        let mut force_error = false;
257        ::tracing::debug!(extended_request_id = ?crate::s3_request_id::RequestIdExt::extended_request_id(response));
258        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
259
260        // If this is an error, defer to the non-streaming parser
261        if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
262            return ::std::option::Option::None;
263        }
264        ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
265            crate::protocol_serde::shape_get_object_annotation::de_get_object_annotation_http_response(response),
266        ))
267    }
268
269    fn deserialize_nonstreaming_with_config(
270        &self,
271        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
272        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
273    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
274        // For streaming operations, we only hit this case if its an error
275        let body = response.body().bytes().expect("body loaded");
276        crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_get_object_annotation::de_get_object_annotation_http_error(
277            response.status().as_u16(),
278            response.headers(),
279            body,
280        ))
281    }
282}
283#[derive(Debug)]
284struct GetObjectAnnotationRequestSerializer;
285impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetObjectAnnotationRequestSerializer {
286    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
287    fn serialize_input(
288        &self,
289        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
290        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
291    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
292        let input = input
293            .downcast::<crate::operation::get_object_annotation::GetObjectAnnotationInput>()
294            .expect("correct type");
295        let _header_serialization_settings = _cfg
296            .load::<crate::serialization_settings::HeaderSerializationSettings>()
297            .cloned()
298            .unwrap_or_default();
299        let mut request_builder = {
300            #[allow(clippy::uninlined_format_args)]
301            fn uri_base(
302                _input: &crate::operation::get_object_annotation::GetObjectAnnotationInput,
303                output: &mut ::std::string::String,
304            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
305                use ::std::fmt::Write as _;
306                let input_1 = &_input.key;
307                let input_1 = input_1
308                    .as_ref()
309                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "cannot be empty or unset"))?;
310                let key = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Greedy);
311                if key.is_empty() {
312                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
313                        "key",
314                        "cannot be empty or unset",
315                    ));
316                }
317                ::std::write!(output, "/{Key}", Key = key).expect("formatting should succeed");
318                ::std::result::Result::Ok(())
319            }
320            fn uri_query(
321                _input: &crate::operation::get_object_annotation::GetObjectAnnotationInput,
322                mut output: &mut ::std::string::String,
323            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
324                let mut query = ::aws_smithy_http::query::Writer::new(output);
325                query.push_v("annotation");
326                query.push_kv("x-id", "GetObjectAnnotation");
327                let inner_2 = &_input.annotation_name;
328                let inner_2 = inner_2
329                    .as_ref()
330                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("annotation_name", "cannot be empty or unset"))?;
331                if inner_2.is_empty() {
332                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
333                        "annotation_name",
334                        "cannot be empty or unset",
335                    ));
336                }
337                query.push_kv("annotationName", &::aws_smithy_http::query::fmt_string(inner_2));
338                if let ::std::option::Option::Some(inner_3) = &_input.version_id {
339                    {
340                        query.push_kv("versionId", &::aws_smithy_http::query::fmt_string(inner_3));
341                    }
342                }
343                ::std::result::Result::Ok(())
344            }
345            #[allow(clippy::unnecessary_wraps)]
346            fn update_http_builder(
347                input: &crate::operation::get_object_annotation::GetObjectAnnotationInput,
348                builder: ::http_1x::request::Builder,
349            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
350                let mut uri = ::std::string::String::new();
351                uri_base(input, &mut uri)?;
352                uri_query(input, &mut uri)?;
353                let builder = crate::protocol_serde::shape_get_object_annotation::ser_get_object_annotation_headers(input, builder)?;
354                ::std::result::Result::Ok(builder.method("GET").uri(uri))
355            }
356            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
357            builder
358        };
359        let body = ::aws_smithy_types::body::SdkBody::from("");
360
361        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
362    }
363}
364#[derive(Debug)]
365struct GetObjectAnnotationEndpointParamsInterceptor;
366
367#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
368impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetObjectAnnotationEndpointParamsInterceptor {
369    fn name(&self) -> &'static str {
370        "GetObjectAnnotationEndpointParamsInterceptor"
371    }
372
373    fn read_before_execution(
374        &self,
375        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
376            '_,
377            ::aws_smithy_runtime_api::client::interceptors::context::Input,
378            ::aws_smithy_runtime_api::client::interceptors::context::Output,
379            ::aws_smithy_runtime_api::client::interceptors::context::Error,
380        >,
381        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
382    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
383        let _input = context
384            .input()
385            .downcast_ref::<GetObjectAnnotationInput>()
386            .ok_or("failed to downcast to GetObjectAnnotationInput")?;
387
388        let params = crate::config::endpoint::Params::builder()
389            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
390            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
391            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
392            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
393            .set_force_path_style(cfg.load::<crate::config::ForcePathStyle>().map(|ty| ty.0))
394            .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
395            .set_disable_multi_region_access_points(cfg.load::<crate::config::DisableMultiRegionAccessPoints>().map(|ty| ty.0))
396            .set_accelerate(cfg.load::<crate::config::Accelerate>().map(|ty| ty.0))
397            .set_disable_s3_express_session_auth(cfg.load::<crate::config::DisableS3ExpressSessionAuth>().map(|ty| ty.0))
398            .set_bucket(Some(
399                _input
400                    .bucket
401                    .clone()
402                    .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
403                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bucket", "A required field was not set"))?,
404            ))
405            .set_key(Some(
406                _input
407                    .key
408                    .clone()
409                    .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
410                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "A required field was not set"))?,
411            ))
412            .build()
413            .map_err(|err| {
414                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
415            })?;
416        cfg.interceptor_state()
417            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
418        ::std::result::Result::Ok(())
419    }
420}
421
422// The get_* functions below are generated from JMESPath expressions in the
423// operationContextParams trait. They target the operation's input shape.
424
425/// Error type for the `GetObjectAnnotationError` operation.
426#[non_exhaustive]
427#[derive(::std::fmt::Debug)]
428pub enum GetObjectAnnotationError {
429    /// <p>The specified annotation does not exist on this object.</p>
430    NoSuchAnnotation(crate::types::error::NoSuchAnnotation),
431    /// <p>The specified bucket does not exist.</p>
432    NoSuchBucket(crate::types::error::NoSuchBucket),
433    /// <p>The specified key does not exist.</p>
434    NoSuchKey(crate::types::error::NoSuchKey),
435    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
436    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
437    variable wildcard pattern and check `.code()`:
438     \
439    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
440     \
441    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetObjectAnnotationError) for what information is available for the error.")]
442    Unhandled(crate::error::sealed_unhandled::Unhandled),
443}
444impl GetObjectAnnotationError {
445    /// Creates the `GetObjectAnnotationError::Unhandled` variant from any error type.
446    pub fn unhandled(
447        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
448    ) -> Self {
449        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
450            source: err.into(),
451            meta: ::std::default::Default::default(),
452        })
453    }
454
455    /// Creates the `GetObjectAnnotationError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
456    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
457        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
458            source: err.clone().into(),
459            meta: err,
460        })
461    }
462    ///
463    /// Returns error metadata, which includes the error code, message,
464    /// request ID, and potentially additional information.
465    ///
466    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
467        match self {
468            Self::NoSuchAnnotation(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
469            Self::NoSuchBucket(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
470            Self::NoSuchKey(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
471            Self::Unhandled(e) => &e.meta,
472        }
473    }
474    /// Returns `true` if the error kind is `GetObjectAnnotationError::NoSuchAnnotation`.
475    pub fn is_no_such_annotation(&self) -> bool {
476        matches!(self, Self::NoSuchAnnotation(_))
477    }
478    /// Returns `true` if the error kind is `GetObjectAnnotationError::NoSuchBucket`.
479    pub fn is_no_such_bucket(&self) -> bool {
480        matches!(self, Self::NoSuchBucket(_))
481    }
482    /// Returns `true` if the error kind is `GetObjectAnnotationError::NoSuchKey`.
483    pub fn is_no_such_key(&self) -> bool {
484        matches!(self, Self::NoSuchKey(_))
485    }
486}
487impl ::std::error::Error for GetObjectAnnotationError {
488    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
489        match self {
490            Self::NoSuchAnnotation(_inner) => ::std::option::Option::Some(_inner),
491            Self::NoSuchBucket(_inner) => ::std::option::Option::Some(_inner),
492            Self::NoSuchKey(_inner) => ::std::option::Option::Some(_inner),
493            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
494        }
495    }
496}
497impl ::std::fmt::Display for GetObjectAnnotationError {
498    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
499        match self {
500            Self::NoSuchAnnotation(_inner) => _inner.fmt(f),
501            Self::NoSuchBucket(_inner) => _inner.fmt(f),
502            Self::NoSuchKey(_inner) => _inner.fmt(f),
503            Self::Unhandled(_inner) => {
504                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
505                    write!(f, "unhandled error ({code})")
506                } else {
507                    f.write_str("unhandled error")
508                }
509            }
510        }
511    }
512}
513impl ::aws_smithy_types::retry::ProvideErrorKind for GetObjectAnnotationError {
514    fn code(&self) -> ::std::option::Option<&str> {
515        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
516    }
517    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
518        ::std::option::Option::None
519    }
520}
521impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetObjectAnnotationError {
522    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
523        match self {
524            Self::NoSuchAnnotation(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
525            Self::NoSuchBucket(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
526            Self::NoSuchKey(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
527            Self::Unhandled(_inner) => &_inner.meta,
528        }
529    }
530}
531impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetObjectAnnotationError {
532    fn create_unhandled_error(
533        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
534        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
535    ) -> Self {
536        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
537            source,
538            meta: meta.unwrap_or_default(),
539        })
540    }
541}
542impl crate::s3_request_id::RequestIdExt for crate::operation::get_object_annotation::GetObjectAnnotationError {
543    fn extended_request_id(&self) -> Option<&str> {
544        self.meta().extended_request_id()
545    }
546}
547impl ::aws_types::request_id::RequestId for crate::operation::get_object_annotation::GetObjectAnnotationError {
548    fn request_id(&self) -> Option<&str> {
549        self.meta().request_id()
550    }
551}
552
553pub use crate::operation::get_object_annotation::_get_object_annotation_input::GetObjectAnnotationInput;
554
555pub use crate::operation::get_object_annotation::_get_object_annotation_output::GetObjectAnnotationOutput;
556
557mod _get_object_annotation_input;
558
559mod _get_object_annotation_output;
560
561/// Builders
562pub mod builders;