Skip to main content

aws_sdk_s3/operation/
put_object_annotation.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `PutObjectAnnotation`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct PutObjectAnnotation;
6impl PutObjectAnnotation {
7    /// Creates a new `PutObjectAnnotation`
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::put_object_annotation::PutObjectAnnotationInput,
14    ) -> ::std::result::Result<
15        crate::operation::put_object_annotation::PutObjectAnnotationOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::put_object_annotation::PutObjectAnnotationError,
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::put_object_annotation::PutObjectAnnotationError>()
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::put_object_annotation::PutObjectAnnotationOutput>()
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::put_object_annotation::PutObjectAnnotationInput,
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", "PutObjectAnnotation", 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.PutObjectAnnotation",
59                "rpc.service" = "S3",
60                "rpc.method" = "PutObjectAnnotation",
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 PutObjectAnnotation {
88    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("PutObjectAnnotation");
90
91        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92            PutObjectAnnotationRequestSerializer,
93        ));
94        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95            PutObjectAnnotationResponseDeserializer,
96        ));
97
98        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99            crate::config::auth::Params::builder()
100                .operation_name("PutObjectAnnotation")
101                .build()
102                .expect("required fields set"),
103        ));
104
105        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("PutObjectAnnotation", "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("PutObjectAnnotation")
126                            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()))
127.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(PutObjectAnnotationEndpointParamsInterceptor))
128.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(crate::http_request_checksum::RequestChecksumInterceptor::new(
129                                |input: &::aws_smithy_runtime_api::client::interceptors::context::Input| {
130                                    let input: &crate::operation::put_object_annotation::PutObjectAnnotationInput = input.downcast_ref().expect("correct type");
131                                    let checksum_algorithm = input.checksum_algorithm();
132                                    let checksum_algorithm = checksum_algorithm.map(|algorithm| algorithm.as_str());
133                                    (checksum_algorithm.map(|s| s.to_string()), false)
134                                },
135                                |request: &mut ::aws_smithy_runtime_api::http::Request, cfg: &::aws_smithy_types::config_bag::ConfigBag| {
136                                    // We check if the user has set any of the checksum values manually
137                                    let mut user_set_checksum_value = false;
138                                    let headers_to_check = request.headers().iter().filter_map(|(name, _val)| {
139                                        if name.starts_with("x-amz-checksum-") {
140                                            Some(name)
141                                        } else {
142                                            None
143                                        }
144                                    });
145                                    for algo_header in headers_to_check {
146                                        if request.headers().get(algo_header).is_some() {
147                                            user_set_checksum_value = true;
148                                        }
149                                    }
150
151                                    // We check if the user set the checksum algo manually
152                                    let user_set_checksum_algo = request.headers()
153                                        .get("x-amz-sdk-checksum-algorithm")
154                                        .is_some();
155
156                                    // This value is set by the user on the SdkConfig to indicate their preference
157                                    let request_checksum_calculation = cfg
158                                        .load::<::aws_smithy_types::checksum_config::RequestChecksumCalculation>()
159                                        .unwrap_or(&::aws_smithy_types::checksum_config::RequestChecksumCalculation::WhenSupported);
160
161                                    // From the httpChecksum trait
162                                    let http_checksum_required = false;
163
164                                    let is_presigned_req = cfg.load::<crate::presigning::PresigningMarker>().is_some();
165
166                                    // If the request is presigned we do not set a default.
167                                    // If the RequestChecksumCalculation is WhenSupported and the user has not set a checksum value or algo
168                                    // we set the default. If it is WhenRequired and a checksum is required by the trait and the user has not
169                                    // set a checksum value or algo we also set the default. In all other cases we do nothing.
170                                    match (
171                                        request_checksum_calculation,
172                                        http_checksum_required,
173                                        user_set_checksum_value,
174                                        user_set_checksum_algo,
175                                        is_presigned_req,
176                                    ) {
177                                        (_, _, _, _, true) => {}
178                                        (::aws_smithy_types::checksum_config::RequestChecksumCalculation::WhenSupported, _, false, false, _)
179                                        | (::aws_smithy_types::checksum_config::RequestChecksumCalculation::WhenRequired, true, false, false, _) => {
180                                            request.headers_mut().insert("x-amz-sdk-checksum-algorithm", "CRC32");
181                                        }
182                                        _ => {},
183                                    }
184
185                                    // We return a bool indicating if the user did set the checksum value, if they did
186                                    // we can short circuit and exit the interceptor early.
187                                    Ok(user_set_checksum_value)
188                                }
189                                )))
190.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(crate::aws_chunked::AwsChunkedContentEncodingInterceptor))
191                            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::put_object_annotation::PutObjectAnnotationError>::new())
192.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::put_object_annotation::PutObjectAnnotationError>::new())
193.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::put_object_annotation::PutObjectAnnotationError>::builder().transient_errors({
194                                            let mut transient_errors: Vec<&'static str> = ::aws_runtime::retries::classifiers::TRANSIENT_ERRORS.into();
195                                            transient_errors.push("InternalError");
196                                            ::std::borrow::Cow::Owned(transient_errors)
197                                            }).build());
198
199        ::std::borrow::Cow::Owned(rcb)
200    }
201}
202
203#[derive(Debug)]
204struct PutObjectAnnotationResponseDeserializer;
205impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PutObjectAnnotationResponseDeserializer {
206    fn deserialize_nonstreaming_with_config(
207        &self,
208        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
209        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
210    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
211        let (success, status) = (response.status().is_success(), response.status().as_u16());
212        let headers = response.headers();
213        let body = response.body().bytes().expect("body loaded");
214        #[allow(unused_mut)]
215        let mut force_error = false;
216        ::tracing::debug!(extended_request_id = ?crate::s3_request_id::RequestIdExt::extended_request_id(response));
217        if matches!(crate::rest_xml_unwrapped_errors::body_is_error(body), Ok(true)) {
218            force_error = true;
219        }
220        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
221        let parse_result = if !success && status != 200 || force_error {
222            crate::protocol_serde::shape_put_object_annotation::de_put_object_annotation_http_error(status, headers, body)
223        } else {
224            crate::protocol_serde::shape_put_object_annotation::de_put_object_annotation_http_response(status, headers, body)
225        };
226        crate::protocol_serde::type_erase_result(parse_result)
227    }
228}
229#[derive(Debug)]
230struct PutObjectAnnotationRequestSerializer;
231impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PutObjectAnnotationRequestSerializer {
232    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
233    fn serialize_input(
234        &self,
235        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
236        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
237    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
238        let input = input
239            .downcast::<crate::operation::put_object_annotation::PutObjectAnnotationInput>()
240            .expect("correct type");
241        let _header_serialization_settings = _cfg
242            .load::<crate::serialization_settings::HeaderSerializationSettings>()
243            .cloned()
244            .unwrap_or_default();
245        let mut request_builder = {
246            #[allow(clippy::uninlined_format_args)]
247            fn uri_base(
248                _input: &crate::operation::put_object_annotation::PutObjectAnnotationInput,
249                output: &mut ::std::string::String,
250            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
251                use ::std::fmt::Write as _;
252                let input_1 = &_input.key;
253                let input_1 = input_1
254                    .as_ref()
255                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "cannot be empty or unset"))?;
256                let key = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Greedy);
257                if key.is_empty() {
258                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
259                        "key",
260                        "cannot be empty or unset",
261                    ));
262                }
263                ::std::write!(output, "/{Key}", Key = key).expect("formatting should succeed");
264                ::std::result::Result::Ok(())
265            }
266            fn uri_query(
267                _input: &crate::operation::put_object_annotation::PutObjectAnnotationInput,
268                mut output: &mut ::std::string::String,
269            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
270                let mut query = ::aws_smithy_http::query::Writer::new(output);
271                query.push_v("annotation");
272                if let ::std::option::Option::Some(inner_2) = &_input.version_id {
273                    {
274                        query.push_kv("versionId", &::aws_smithy_http::query::fmt_string(inner_2));
275                    }
276                }
277                let inner_3 = &_input.annotation_name;
278                let inner_3 = inner_3
279                    .as_ref()
280                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("annotation_name", "cannot be empty or unset"))?;
281                if inner_3.is_empty() {
282                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
283                        "annotation_name",
284                        "cannot be empty or unset",
285                    ));
286                }
287                query.push_kv("annotationName", &::aws_smithy_http::query::fmt_string(inner_3));
288                ::std::result::Result::Ok(())
289            }
290            #[allow(clippy::unnecessary_wraps)]
291            fn update_http_builder(
292                input: &crate::operation::put_object_annotation::PutObjectAnnotationInput,
293                builder: ::http_1x::request::Builder,
294            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
295                let mut uri = ::std::string::String::new();
296                uri_base(input, &mut uri)?;
297                uri_query(input, &mut uri)?;
298                let builder = crate::protocol_serde::shape_put_object_annotation::ser_put_object_annotation_headers(input, builder)?;
299                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
300            }
301            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
302            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/octet-stream");
303            builder
304        };
305        let body =
306            crate::protocol_serde::shape_put_object_annotation_input::ser_annotation_payload_http_payload(input.annotation_payload)?.into_inner();
307        if let Some(content_length) = body.content_length() {
308            let content_length = content_length.to_string();
309            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
310        }
311        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
312    }
313}
314#[derive(Debug)]
315struct PutObjectAnnotationEndpointParamsInterceptor;
316
317#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
318impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutObjectAnnotationEndpointParamsInterceptor {
319    fn name(&self) -> &'static str {
320        "PutObjectAnnotationEndpointParamsInterceptor"
321    }
322
323    fn read_before_execution(
324        &self,
325        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
326            '_,
327            ::aws_smithy_runtime_api::client::interceptors::context::Input,
328            ::aws_smithy_runtime_api::client::interceptors::context::Output,
329            ::aws_smithy_runtime_api::client::interceptors::context::Error,
330        >,
331        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
332    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
333        let _input = context
334            .input()
335            .downcast_ref::<PutObjectAnnotationInput>()
336            .ok_or("failed to downcast to PutObjectAnnotationInput")?;
337
338        let params = crate::config::endpoint::Params::builder()
339            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
340            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
341            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
342            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
343            .set_force_path_style(cfg.load::<crate::config::ForcePathStyle>().map(|ty| ty.0))
344            .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
345            .set_disable_multi_region_access_points(cfg.load::<crate::config::DisableMultiRegionAccessPoints>().map(|ty| ty.0))
346            .set_accelerate(cfg.load::<crate::config::Accelerate>().map(|ty| ty.0))
347            .set_disable_s3_express_session_auth(cfg.load::<crate::config::DisableS3ExpressSessionAuth>().map(|ty| ty.0))
348            .set_bucket(Some(
349                _input
350                    .bucket
351                    .clone()
352                    .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
353                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bucket", "A required field was not set"))?,
354            ))
355            .set_key(Some(
356                _input
357                    .key
358                    .clone()
359                    .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
360                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "A required field was not set"))?,
361            ))
362            .build()
363            .map_err(|err| {
364                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
365            })?;
366        cfg.interceptor_state()
367            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
368        ::std::result::Result::Ok(())
369    }
370}
371
372// The get_* functions below are generated from JMESPath expressions in the
373// operationContextParams trait. They target the operation's input shape.
374
375/// Error type for the `PutObjectAnnotationError` operation.
376#[non_exhaustive]
377#[derive(::std::fmt::Debug)]
378pub enum PutObjectAnnotationError {
379    /// <p>The request would exceed the maximum number of annotations allowed per object.</p>
380    AnnotationLimitExceeded(crate::types::error::AnnotationLimitExceeded),
381    /// <p>The annotation name exceeds 512 bytes.</p>
382    AnnotationNameTooLong(crate::types::error::AnnotationNameTooLong),
383    /// <p>The annotation name you provided is invalid.</p>
384    InvalidAnnotationName(crate::types::error::InvalidAnnotationName),
385    /// <p>A parameter or header in your request isn't valid. For details, see the description of this API operation.</p>
386    InvalidRequest(crate::types::error::InvalidRequest),
387    /// <p>The specified bucket does not exist.</p>
388    NoSuchBucket(crate::types::error::NoSuchBucket),
389    /// <p>The specified key does not exist.</p>
390    NoSuchKey(crate::types::error::NoSuchKey),
391    /// <p>The annotation payload is not valid UTF-8 encoded text.</p>
392    UnsupportedMediaType(crate::types::error::UnsupportedMediaType),
393    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
394    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
395    variable wildcard pattern and check `.code()`:
396     \
397    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
398     \
399    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-PutObjectAnnotationError) for what information is available for the error.")]
400    Unhandled(crate::error::sealed_unhandled::Unhandled),
401}
402impl PutObjectAnnotationError {
403    /// Creates the `PutObjectAnnotationError::Unhandled` variant from any error type.
404    pub fn unhandled(
405        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
406    ) -> Self {
407        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
408            source: err.into(),
409            meta: ::std::default::Default::default(),
410        })
411    }
412
413    /// Creates the `PutObjectAnnotationError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
414    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
415        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
416            source: err.clone().into(),
417            meta: err,
418        })
419    }
420    ///
421    /// Returns error metadata, which includes the error code, message,
422    /// request ID, and potentially additional information.
423    ///
424    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
425        match self {
426            Self::AnnotationLimitExceeded(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
427            Self::AnnotationNameTooLong(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
428            Self::InvalidAnnotationName(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
429            Self::InvalidRequest(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
430            Self::NoSuchBucket(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
431            Self::NoSuchKey(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
432            Self::UnsupportedMediaType(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
433            Self::Unhandled(e) => &e.meta,
434        }
435    }
436    /// Returns `true` if the error kind is `PutObjectAnnotationError::AnnotationLimitExceeded`.
437    pub fn is_annotation_limit_exceeded(&self) -> bool {
438        matches!(self, Self::AnnotationLimitExceeded(_))
439    }
440    /// Returns `true` if the error kind is `PutObjectAnnotationError::AnnotationNameTooLong`.
441    pub fn is_annotation_name_too_long(&self) -> bool {
442        matches!(self, Self::AnnotationNameTooLong(_))
443    }
444    /// Returns `true` if the error kind is `PutObjectAnnotationError::InvalidAnnotationName`.
445    pub fn is_invalid_annotation_name(&self) -> bool {
446        matches!(self, Self::InvalidAnnotationName(_))
447    }
448    /// Returns `true` if the error kind is `PutObjectAnnotationError::InvalidRequest`.
449    pub fn is_invalid_request(&self) -> bool {
450        matches!(self, Self::InvalidRequest(_))
451    }
452    /// Returns `true` if the error kind is `PutObjectAnnotationError::NoSuchBucket`.
453    pub fn is_no_such_bucket(&self) -> bool {
454        matches!(self, Self::NoSuchBucket(_))
455    }
456    /// Returns `true` if the error kind is `PutObjectAnnotationError::NoSuchKey`.
457    pub fn is_no_such_key(&self) -> bool {
458        matches!(self, Self::NoSuchKey(_))
459    }
460    /// Returns `true` if the error kind is `PutObjectAnnotationError::UnsupportedMediaType`.
461    pub fn is_unsupported_media_type(&self) -> bool {
462        matches!(self, Self::UnsupportedMediaType(_))
463    }
464}
465impl ::std::error::Error for PutObjectAnnotationError {
466    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
467        match self {
468            Self::AnnotationLimitExceeded(_inner) => ::std::option::Option::Some(_inner),
469            Self::AnnotationNameTooLong(_inner) => ::std::option::Option::Some(_inner),
470            Self::InvalidAnnotationName(_inner) => ::std::option::Option::Some(_inner),
471            Self::InvalidRequest(_inner) => ::std::option::Option::Some(_inner),
472            Self::NoSuchBucket(_inner) => ::std::option::Option::Some(_inner),
473            Self::NoSuchKey(_inner) => ::std::option::Option::Some(_inner),
474            Self::UnsupportedMediaType(_inner) => ::std::option::Option::Some(_inner),
475            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
476        }
477    }
478}
479impl ::std::fmt::Display for PutObjectAnnotationError {
480    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
481        match self {
482            Self::AnnotationLimitExceeded(_inner) => _inner.fmt(f),
483            Self::AnnotationNameTooLong(_inner) => _inner.fmt(f),
484            Self::InvalidAnnotationName(_inner) => _inner.fmt(f),
485            Self::InvalidRequest(_inner) => _inner.fmt(f),
486            Self::NoSuchBucket(_inner) => _inner.fmt(f),
487            Self::NoSuchKey(_inner) => _inner.fmt(f),
488            Self::UnsupportedMediaType(_inner) => _inner.fmt(f),
489            Self::Unhandled(_inner) => {
490                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
491                    write!(f, "unhandled error ({code})")
492                } else {
493                    f.write_str("unhandled error")
494                }
495            }
496        }
497    }
498}
499impl ::aws_smithy_types::retry::ProvideErrorKind for PutObjectAnnotationError {
500    fn code(&self) -> ::std::option::Option<&str> {
501        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
502    }
503    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
504        ::std::option::Option::None
505    }
506}
507impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for PutObjectAnnotationError {
508    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
509        match self {
510            Self::AnnotationLimitExceeded(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
511            Self::AnnotationNameTooLong(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
512            Self::InvalidAnnotationName(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
513            Self::InvalidRequest(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
514            Self::NoSuchBucket(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
515            Self::NoSuchKey(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
516            Self::UnsupportedMediaType(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
517            Self::Unhandled(_inner) => &_inner.meta,
518        }
519    }
520}
521impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for PutObjectAnnotationError {
522    fn create_unhandled_error(
523        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
524        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
525    ) -> Self {
526        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
527            source,
528            meta: meta.unwrap_or_default(),
529        })
530    }
531}
532impl crate::s3_request_id::RequestIdExt for crate::operation::put_object_annotation::PutObjectAnnotationError {
533    fn extended_request_id(&self) -> Option<&str> {
534        self.meta().extended_request_id()
535    }
536}
537impl ::aws_types::request_id::RequestId for crate::operation::put_object_annotation::PutObjectAnnotationError {
538    fn request_id(&self) -> Option<&str> {
539        self.meta().request_id()
540    }
541}
542
543pub use crate::operation::put_object_annotation::_put_object_annotation_input::PutObjectAnnotationInput;
544
545pub use crate::operation::put_object_annotation::_put_object_annotation_output::PutObjectAnnotationOutput;
546
547mod _put_object_annotation_input;
548
549mod _put_object_annotation_output;
550
551/// Builders
552pub mod builders;