Skip to main content

aws_sdk_s3/operation/
copy_object.rs

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