Skip to main content

aws_sdk_s3/operation/
update_object_encryption.rs

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