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_with_config(
252        &self,
253        response: &mut ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
254        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
255    ) -> ::std::option::Option<::aws_smithy_runtime_api::client::interceptors::context::OutputOrError> {
256        #[allow(unused_mut)]
257        let mut force_error = false;
258        ::tracing::debug!(extended_request_id = ?crate::s3_request_id::RequestIdExt::extended_request_id(response));
259        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
260
261        // If this is an error, defer to the non-streaming parser
262        if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
263            return ::std::option::Option::None;
264        }
265        ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
266            crate::protocol_serde::shape_get_object_annotation::de_get_object_annotation_http_response(response, _cfg),
267        ))
268    }
269
270    fn deserialize_nonstreaming_with_config(
271        &self,
272        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
273        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
274    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
275        // For streaming operations, we only hit this case if its an error
276        let body = response.body().bytes().expect("body loaded");
277        crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_get_object_annotation::de_get_object_annotation_http_error(
278            response.status().as_u16(),
279            response.headers(),
280            body,
281            _cfg,
282        ))
283    }
284}
285#[derive(Debug)]
286struct GetObjectAnnotationRequestSerializer;
287impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetObjectAnnotationRequestSerializer {
288    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
289    fn serialize_input(
290        &self,
291        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
292        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
293    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
294        let input = input
295            .downcast::<crate::operation::get_object_annotation::GetObjectAnnotationInput>()
296            .expect("correct type");
297        let _header_serialization_settings = _cfg
298            .load::<crate::serialization_settings::HeaderSerializationSettings>()
299            .cloned()
300            .unwrap_or_default();
301        let mut request_builder = {
302            #[allow(clippy::uninlined_format_args)]
303            fn uri_base(
304                _input: &crate::operation::get_object_annotation::GetObjectAnnotationInput,
305                output: &mut ::std::string::String,
306            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
307                use ::std::fmt::Write as _;
308                let input_1 = &_input.key;
309                let input_1 = input_1
310                    .as_ref()
311                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "cannot be empty or unset"))?;
312                let key = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Greedy);
313                if key.is_empty() {
314                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
315                        "key",
316                        "cannot be empty or unset",
317                    ));
318                }
319                ::std::write!(output, "/{Key}", Key = key).expect("formatting should succeed");
320                ::std::result::Result::Ok(())
321            }
322            fn uri_query(
323                _input: &crate::operation::get_object_annotation::GetObjectAnnotationInput,
324                mut output: &mut ::std::string::String,
325            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
326                let mut query = ::aws_smithy_http::query::Writer::new(output);
327                query.push_v("annotation");
328                query.push_kv("x-id", "GetObjectAnnotation");
329                let inner_2 = &_input.annotation_name;
330                let inner_2 = inner_2
331                    .as_ref()
332                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("annotation_name", "cannot be empty or unset"))?;
333                if inner_2.is_empty() {
334                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
335                        "annotation_name",
336                        "cannot be empty or unset",
337                    ));
338                }
339                query.push_kv("annotationName", &::aws_smithy_http::query::fmt_string(inner_2));
340                if let ::std::option::Option::Some(inner_3) = &_input.version_id {
341                    {
342                        query.push_kv("versionId", &::aws_smithy_http::query::fmt_string(inner_3));
343                    }
344                }
345                ::std::result::Result::Ok(())
346            }
347            #[allow(clippy::unnecessary_wraps)]
348            fn update_http_builder(
349                input: &crate::operation::get_object_annotation::GetObjectAnnotationInput,
350                builder: ::http_1x::request::Builder,
351            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
352                let mut uri = ::std::string::String::new();
353                uri_base(input, &mut uri)?;
354                uri_query(input, &mut uri)?;
355                let builder = crate::protocol_serde::shape_get_object_annotation::ser_get_object_annotation_headers(input, builder)?;
356                ::std::result::Result::Ok(builder.method("GET").uri(uri))
357            }
358            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
359            builder
360        };
361        let body = ::aws_smithy_types::body::SdkBody::from("");
362
363        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
364    }
365}
366#[derive(Debug)]
367struct GetObjectAnnotationEndpointParamsInterceptor;
368
369#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
370impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetObjectAnnotationEndpointParamsInterceptor {
371    fn name(&self) -> &'static str {
372        "GetObjectAnnotationEndpointParamsInterceptor"
373    }
374
375    fn read_before_execution(
376        &self,
377        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
378            '_,
379            ::aws_smithy_runtime_api::client::interceptors::context::Input,
380            ::aws_smithy_runtime_api::client::interceptors::context::Output,
381            ::aws_smithy_runtime_api::client::interceptors::context::Error,
382        >,
383        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
384    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
385        let _input = context
386            .input()
387            .downcast_ref::<GetObjectAnnotationInput>()
388            .ok_or("failed to downcast to GetObjectAnnotationInput")?;
389
390        let params = crate::config::endpoint::Params::builder()
391            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
392            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
393            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
394            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
395            .set_force_path_style(cfg.load::<crate::config::ForcePathStyle>().map(|ty| ty.0))
396            .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
397            .set_disable_multi_region_access_points(cfg.load::<crate::config::DisableMultiRegionAccessPoints>().map(|ty| ty.0))
398            .set_accelerate(cfg.load::<crate::config::Accelerate>().map(|ty| ty.0))
399            .set_disable_s3_express_session_auth(cfg.load::<crate::config::DisableS3ExpressSessionAuth>().map(|ty| ty.0))
400            .set_bucket(Some(
401                _input
402                    .bucket
403                    .clone()
404                    .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
405                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bucket", "A required field was not set"))?,
406            ))
407            .set_key(Some(
408                _input
409                    .key
410                    .clone()
411                    .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
412                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "A required field was not set"))?,
413            ))
414            .build()
415            .map_err(|err| {
416                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
417            })?;
418        cfg.interceptor_state()
419            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
420        ::std::result::Result::Ok(())
421    }
422}
423
424// The get_* functions below are generated from JMESPath expressions in the
425// operationContextParams trait. They target the operation's input shape.
426
427/// Error type for the `GetObjectAnnotationError` operation.
428#[non_exhaustive]
429#[derive(::std::fmt::Debug)]
430pub enum GetObjectAnnotationError {
431    /// <p>The specified annotation does not exist on this object.</p>
432    NoSuchAnnotation(crate::types::error::NoSuchAnnotation),
433    /// <p>The specified bucket does not exist.</p>
434    NoSuchBucket(crate::types::error::NoSuchBucket),
435    /// <p>The specified key does not exist.</p>
436    NoSuchKey(crate::types::error::NoSuchKey),
437    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
438    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
439    variable wildcard pattern and check `.code()`:
440     \
441    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
442     \
443    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetObjectAnnotationError) for what information is available for the error.")]
444    Unhandled(crate::error::sealed_unhandled::Unhandled),
445}
446impl GetObjectAnnotationError {
447    /// Creates the `GetObjectAnnotationError::Unhandled` variant from any error type.
448    pub fn unhandled(
449        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
450    ) -> Self {
451        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
452            source: err.into(),
453            meta: ::std::default::Default::default(),
454        })
455    }
456
457    /// Creates the `GetObjectAnnotationError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
458    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
459        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
460            source: err.clone().into(),
461            meta: err,
462        })
463    }
464    ///
465    /// Returns error metadata, which includes the error code, message,
466    /// request ID, and potentially additional information.
467    ///
468    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
469        match self {
470            Self::NoSuchAnnotation(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
471            Self::NoSuchBucket(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
472            Self::NoSuchKey(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
473            Self::Unhandled(e) => &e.meta,
474        }
475    }
476    /// Returns `true` if the error kind is `GetObjectAnnotationError::NoSuchAnnotation`.
477    pub fn is_no_such_annotation(&self) -> bool {
478        matches!(self, Self::NoSuchAnnotation(_))
479    }
480    /// Returns `true` if the error kind is `GetObjectAnnotationError::NoSuchBucket`.
481    pub fn is_no_such_bucket(&self) -> bool {
482        matches!(self, Self::NoSuchBucket(_))
483    }
484    /// Returns `true` if the error kind is `GetObjectAnnotationError::NoSuchKey`.
485    pub fn is_no_such_key(&self) -> bool {
486        matches!(self, Self::NoSuchKey(_))
487    }
488}
489impl ::std::error::Error for GetObjectAnnotationError {
490    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
491        match self {
492            Self::NoSuchAnnotation(_inner) => ::std::option::Option::Some(_inner),
493            Self::NoSuchBucket(_inner) => ::std::option::Option::Some(_inner),
494            Self::NoSuchKey(_inner) => ::std::option::Option::Some(_inner),
495            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
496        }
497    }
498}
499impl ::std::fmt::Display for GetObjectAnnotationError {
500    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
501        match self {
502            Self::NoSuchAnnotation(_inner) => _inner.fmt(f),
503            Self::NoSuchBucket(_inner) => _inner.fmt(f),
504            Self::NoSuchKey(_inner) => _inner.fmt(f),
505            Self::Unhandled(_inner) => {
506                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
507                    write!(f, "unhandled error ({code})")
508                } else {
509                    f.write_str("unhandled error")
510                }
511            }
512        }
513    }
514}
515impl ::aws_smithy_types::retry::ProvideErrorKind for GetObjectAnnotationError {
516    fn code(&self) -> ::std::option::Option<&str> {
517        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
518    }
519    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
520        ::std::option::Option::None
521    }
522}
523impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetObjectAnnotationError {
524    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
525        match self {
526            Self::NoSuchAnnotation(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
527            Self::NoSuchBucket(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
528            Self::NoSuchKey(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
529            Self::Unhandled(_inner) => &_inner.meta,
530        }
531    }
532}
533impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetObjectAnnotationError {
534    fn create_unhandled_error(
535        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
536        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
537    ) -> Self {
538        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
539            source,
540            meta: meta.unwrap_or_default(),
541        })
542    }
543}
544impl crate::s3_request_id::RequestIdExt for crate::operation::get_object_annotation::GetObjectAnnotationError {
545    fn extended_request_id(&self) -> Option<&str> {
546        self.meta().extended_request_id()
547    }
548}
549impl ::aws_types::request_id::RequestId for crate::operation::get_object_annotation::GetObjectAnnotationError {
550    fn request_id(&self) -> Option<&str> {
551        self.meta().request_id()
552    }
553}
554
555pub use crate::operation::get_object_annotation::_get_object_annotation_input::GetObjectAnnotationInput;
556
557pub use crate::operation::get_object_annotation::_get_object_annotation_output::GetObjectAnnotationOutput;
558
559mod _get_object_annotation_input;
560
561mod _get_object_annotation_output;
562
563/// Builders
564pub mod builders;