Skip to main content

aws_sdk_s3/operation/
list_object_versions.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `ListObjectVersions`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct ListObjectVersions;
6impl ListObjectVersions {
7    /// Creates a new `ListObjectVersions`
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::list_object_versions::ListObjectVersionsInput,
14    ) -> ::std::result::Result<
15        crate::operation::list_object_versions::ListObjectVersionsOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::list_object_versions::ListObjectVersionsError,
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::list_object_versions::ListObjectVersionsError>()
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::list_object_versions::ListObjectVersionsOutput>()
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::list_object_versions::ListObjectVersionsInput,
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", "ListObjectVersions", 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.ListObjectVersions",
59                "rpc.service" = "S3",
60                "rpc.method" = "ListObjectVersions",
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 ListObjectVersions {
88    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListObjectVersions");
90
91        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92            ListObjectVersionsRequestSerializer,
93        ));
94        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95            ListObjectVersionsResponseDeserializer,
96        ));
97
98        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99            crate::config::auth::Params::builder()
100                .operation_name("ListObjectVersions")
101                .build()
102                .expect("required fields set"),
103        ));
104
105        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("ListObjectVersions", "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("ListObjectVersions")
126                            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(ListObjectVersionsTelemetryInputCaptureInterceptor))
127.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()))
128.with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(ListObjectVersionsEndpointParamsInterceptor))
129                            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::list_object_versions::ListObjectVersionsError>::new())
130.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::list_object_versions::ListObjectVersionsError>::new())
131.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::list_object_versions::ListObjectVersionsError>::builder().transient_errors({
132                                            let mut transient_errors: Vec<&'static str> = ::aws_runtime::retries::classifiers::TRANSIENT_ERRORS.into();
133                                            transient_errors.push("InternalError");
134                                            ::std::borrow::Cow::Owned(transient_errors)
135                                            }).build())
136.with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<crate::operation::list_object_versions::ListObjectVersionsError>::new());
137
138        ::std::borrow::Cow::Owned(rcb)
139    }
140}
141
142#[derive(Debug)]
143struct ListObjectVersionsTelemetryInputCaptureInterceptor;
144
145#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
146impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListObjectVersionsTelemetryInputCaptureInterceptor {
147    fn name(&self) -> &'static str {
148        "ListObjectVersionsTelemetryInputCaptureInterceptor"
149    }
150
151    fn read_before_execution(
152        &self,
153        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
154            '_,
155            ::aws_smithy_runtime_api::client::interceptors::context::Input,
156            ::aws_smithy_runtime_api::client::interceptors::context::Output,
157            ::aws_smithy_runtime_api::client::interceptors::context::Error,
158        >,
159        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
160    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
161        // Nothing to do unless the customer opted in by naming members to record.
162        let ::std::option::Option::Some(requested) = cfg
163            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
164            .filter(|r| !r.is_empty())
165        else {
166            return ::std::result::Result::Ok(());
167        };
168
169        let ::std::option::Option::Some(input) = context.input().downcast_ref::<ListObjectVersionsInput>() else {
170            // A mismatched input is not this interceptor's concern; skip quietly.
171            return ::std::result::Result::Ok(());
172        };
173
174        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
175        if requested.should_capture("Bucket") {
176            if let ::std::option::Option::Some(value) = input.bucket.as_deref() {
177                captured.insert("Bucket", value);
178            }
179        }
180        if requested.should_capture("Delimiter") {
181            if let ::std::option::Option::Some(value) = input.delimiter.as_deref() {
182                captured.insert("Delimiter", value);
183            }
184        }
185        if requested.should_capture("KeyMarker") {
186            if let ::std::option::Option::Some(value) = input.key_marker.as_deref() {
187                captured.insert("KeyMarker", value);
188            }
189        }
190        if requested.should_capture("Prefix") {
191            if let ::std::option::Option::Some(value) = input.prefix.as_deref() {
192                captured.insert("Prefix", value);
193            }
194        }
195        if requested.should_capture("VersionIdMarker") {
196            if let ::std::option::Option::Some(value) = input.version_id_marker.as_deref() {
197                captured.insert("VersionIdMarker", value);
198            }
199        }
200        if requested.should_capture("ExpectedBucketOwner") {
201            if let ::std::option::Option::Some(value) = input.expected_bucket_owner.as_deref() {
202                captured.insert("ExpectedBucketOwner", value);
203            }
204        }
205
206        cfg.interceptor_state().store_put(captured);
207        ::std::result::Result::Ok(())
208    }
209}
210#[derive(Debug)]
211struct ListObjectVersionsResponseDeserializer;
212impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListObjectVersionsResponseDeserializer {
213    fn deserialize_nonstreaming_with_config(
214        &self,
215        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
216        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
217    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
218        let (success, status) = (response.status().is_success(), response.status().as_u16());
219        let headers = response.headers();
220        let body = response.body().bytes().expect("body loaded");
221        #[allow(unused_mut)]
222        let mut force_error = false;
223        ::tracing::debug!(extended_request_id = ?crate::s3_request_id::RequestIdExt::extended_request_id(response));
224        if matches!(crate::rest_xml_unwrapped_errors::body_is_error(body), Ok(true)) {
225            force_error = true;
226        }
227        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
228        let parse_result = if !success && status != 200 || force_error {
229            crate::protocol_serde::shape_list_object_versions::de_list_object_versions_http_error(status, headers, body)
230        } else {
231            crate::protocol_serde::shape_list_object_versions::de_list_object_versions_http_response(status, headers, body)
232        };
233        crate::protocol_serde::type_erase_result(parse_result)
234    }
235}
236#[derive(Debug)]
237struct ListObjectVersionsRequestSerializer;
238impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListObjectVersionsRequestSerializer {
239    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
240    fn serialize_input(
241        &self,
242        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
243        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
244    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
245        let input = input
246            .downcast::<crate::operation::list_object_versions::ListObjectVersionsInput>()
247            .expect("correct type");
248        let _header_serialization_settings = _cfg
249            .load::<crate::serialization_settings::HeaderSerializationSettings>()
250            .cloned()
251            .unwrap_or_default();
252        let mut request_builder = {
253            #[allow(clippy::uninlined_format_args)]
254            fn uri_base(
255                _input: &crate::operation::list_object_versions::ListObjectVersionsInput,
256                output: &mut ::std::string::String,
257            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
258                use ::std::fmt::Write as _;
259                ::std::write!(output, "/").expect("formatting should succeed");
260                ::std::result::Result::Ok(())
261            }
262            fn uri_query(
263                _input: &crate::operation::list_object_versions::ListObjectVersionsInput,
264                mut output: &mut ::std::string::String,
265            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
266                let mut query = ::aws_smithy_http::query::Writer::new(output);
267                query.push_v("versions");
268                if let ::std::option::Option::Some(inner_1) = &_input.delimiter {
269                    {
270                        query.push_kv("delimiter", &::aws_smithy_http::query::fmt_string(inner_1));
271                    }
272                }
273                if let ::std::option::Option::Some(inner_2) = &_input.encoding_type {
274                    {
275                        query.push_kv("encoding-type", &::aws_smithy_http::query::fmt_string(inner_2.as_str()));
276                    }
277                }
278                if let ::std::option::Option::Some(inner_3) = &_input.key_marker {
279                    {
280                        query.push_kv("key-marker", &::aws_smithy_http::query::fmt_string(inner_3));
281                    }
282                }
283                if let ::std::option::Option::Some(inner_4) = &_input.max_keys {
284                    {
285                        query.push_kv("max-keys", ::aws_smithy_types::primitive::Encoder::from(*inner_4).encode());
286                    }
287                }
288                if let ::std::option::Option::Some(inner_5) = &_input.prefix {
289                    {
290                        query.push_kv("prefix", &::aws_smithy_http::query::fmt_string(inner_5));
291                    }
292                }
293                if let ::std::option::Option::Some(inner_6) = &_input.version_id_marker {
294                    {
295                        query.push_kv("version-id-marker", &::aws_smithy_http::query::fmt_string(inner_6));
296                    }
297                }
298                ::std::result::Result::Ok(())
299            }
300            #[allow(clippy::unnecessary_wraps)]
301            fn update_http_builder(
302                input: &crate::operation::list_object_versions::ListObjectVersionsInput,
303                builder: ::http_1x::request::Builder,
304            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
305                let mut uri = ::std::string::String::new();
306                uri_base(input, &mut uri)?;
307                uri_query(input, &mut uri)?;
308                let builder = crate::protocol_serde::shape_list_object_versions::ser_list_object_versions_headers(input, builder)?;
309                ::std::result::Result::Ok(builder.method("GET").uri(uri))
310            }
311            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
312            builder
313        };
314        let body = ::aws_smithy_types::body::SdkBody::from("");
315
316        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
317    }
318}
319#[derive(Debug)]
320struct ListObjectVersionsEndpointParamsInterceptor;
321
322#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
323impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListObjectVersionsEndpointParamsInterceptor {
324    fn name(&self) -> &'static str {
325        "ListObjectVersionsEndpointParamsInterceptor"
326    }
327
328    fn read_before_execution(
329        &self,
330        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
331            '_,
332            ::aws_smithy_runtime_api::client::interceptors::context::Input,
333            ::aws_smithy_runtime_api::client::interceptors::context::Output,
334            ::aws_smithy_runtime_api::client::interceptors::context::Error,
335        >,
336        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
337    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
338        let _input = context
339            .input()
340            .downcast_ref::<ListObjectVersionsInput>()
341            .ok_or("failed to downcast to ListObjectVersionsInput")?;
342
343        let params = crate::config::endpoint::Params::builder()
344            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
345            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
346            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
347            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
348            .set_force_path_style(cfg.load::<crate::config::ForcePathStyle>().map(|ty| ty.0))
349            .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
350            .set_disable_multi_region_access_points(cfg.load::<crate::config::DisableMultiRegionAccessPoints>().map(|ty| ty.0))
351            .set_accelerate(cfg.load::<crate::config::Accelerate>().map(|ty| ty.0))
352            .set_disable_s3_express_session_auth(cfg.load::<crate::config::DisableS3ExpressSessionAuth>().map(|ty| ty.0))
353            .set_bucket(Some(
354                _input
355                    .bucket
356                    .clone()
357                    .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
358                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bucket", "A required field was not set"))?,
359            ))
360            .set_prefix(_input.prefix.clone())
361            .build()
362            .map_err(|err| {
363                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
364            })?;
365        cfg.interceptor_state()
366            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
367        ::std::result::Result::Ok(())
368    }
369}
370
371// The get_* functions below are generated from JMESPath expressions in the
372// operationContextParams trait. They target the operation's input shape.
373
374#[allow(unreachable_code, unused_variables)]
375#[cfg(test)]
376mod list_object_versions_test {
377
378    /// Verify that interleaving list elements (DeleteMarker and Version) from different lists works
379    /// Test ID: OutOfOrderVersions
380    #[::tokio::test]
381    #[::tracing_test::traced_test]
382    async fn out_of_order_versions_response() {
383        let expected_output = crate::operation::list_object_versions::ListObjectVersionsOutput::builder()
384            .set_name(::std::option::Option::Some("sdk-obj-versions-test".to_owned()))
385            .set_prefix(::std::option::Option::Some("".to_owned()))
386            .set_key_marker(::std::option::Option::Some("".to_owned()))
387            .set_version_id_marker(::std::option::Option::Some("".to_owned()))
388            .set_max_keys(::std::option::Option::Some(1000))
389            .set_is_truncated(::std::option::Option::Some(false))
390            .set_delete_markers(::std::option::Option::Some(vec![
391                crate::types::DeleteMarkerEntry::builder()
392                    .set_key(::std::option::Option::Some("build.gradle.kts".to_owned()))
393                    .set_version_id(::std::option::Option::Some("null".to_owned()))
394                    .set_is_latest(::std::option::Option::Some(true))
395                    .set_last_modified(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
396                        1234567890, 0_f64,
397                    )))
398                    .set_owner(::std::option::Option::Some(
399                        crate::types::Owner::builder()
400                            .set_id(::std::option::Option::Some(
401                                "c1665459250c459f1849ddce9b291fc3a72bcf5220dc8f6391a0a1045c683b34".to_owned(),
402                            ))
403                            .set_display_name(::std::option::Option::Some("test-name".to_owned()))
404                            .build(),
405                    ))
406                    .build(),
407                crate::types::DeleteMarkerEntry::builder()
408                    .set_key(::std::option::Option::Some("file-2".to_owned()))
409                    .set_version_id(::std::option::Option::Some("o98RL6vmlOYiymftbX7wgy_4XWQG4AmY".to_owned()))
410                    .set_is_latest(::std::option::Option::Some(true))
411                    .set_last_modified(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
412                        1234567890, 0_f64,
413                    )))
414                    .set_owner(::std::option::Option::Some(
415                        crate::types::Owner::builder()
416                            .set_id(::std::option::Option::Some(
417                                "c1665459250c459f1849ddce9b291fc3a72bcf5220dc8f6391a0a1045c683b34".to_owned(),
418                            ))
419                            .set_display_name(::std::option::Option::Some("test-name".to_owned()))
420                            .build(),
421                    ))
422                    .build(),
423            ]))
424            .set_versions(::std::option::Option::Some(vec![
425                crate::types::ObjectVersion::builder()
426                    .set_key(::std::option::Option::Some("build.gradle.kts".to_owned()))
427                    .set_version_id(::std::option::Option::Some("IfK9Z4.H5TLAtMxFrxN_C7rFEZbufF3V".to_owned()))
428                    .set_is_latest(::std::option::Option::Some(false))
429                    .set_last_modified(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
430                        1234567890, 0_f64,
431                    )))
432                    .set_e_tag(::std::option::Option::Some("\"99613b85e3f38b222c4ee548cde1e59d\"".to_owned()))
433                    .set_size(::std::option::Option::Some(6903))
434                    .set_owner(::std::option::Option::Some(
435                        crate::types::Owner::builder()
436                            .set_id(::std::option::Option::Some(
437                                "c1665459250c459f1849ddce9b291fc3a72bcf5220dc8f6391a0a1045c683b34".to_owned(),
438                            ))
439                            .set_display_name(::std::option::Option::Some("test-name".to_owned()))
440                            .build(),
441                    ))
442                    .set_storage_class(::std::option::Option::Some(
443                        "STANDARD"
444                            .parse::<crate::types::ObjectVersionStorageClass>()
445                            .expect("static value validated to member"),
446                    ))
447                    .build(),
448                crate::types::ObjectVersion::builder()
449                    .set_key(::std::option::Option::Some("file-2".to_owned()))
450                    .set_version_id(::std::option::Option::Some("PSVAbvQihRdsNiktGothjGng7q.5ou9Q".to_owned()))
451                    .set_is_latest(::std::option::Option::Some(false))
452                    .set_last_modified(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
453                        1234567890, 0_f64,
454                    )))
455                    .set_e_tag(::std::option::Option::Some("\"1727d9cb38dd325d9c12c973ef3675fc\"".to_owned()))
456                    .set_size(::std::option::Option::Some(14))
457                    .set_owner(::std::option::Option::Some(
458                        crate::types::Owner::builder()
459                            .set_id(::std::option::Option::Some(
460                                "c1665459250c459f1849ddce9b291fc3a72bcf5220dc8f6391a0a1045c683b34".to_owned(),
461                            ))
462                            .set_display_name(::std::option::Option::Some("test-name".to_owned()))
463                            .build(),
464                    ))
465                    .set_storage_class(::std::option::Option::Some(
466                        "STANDARD"
467                            .parse::<crate::types::ObjectVersionStorageClass>()
468                            .expect("static value validated to member"),
469                    ))
470                    .build(),
471            ]))
472            .build();
473        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(::http_1x::response::Builder::new()
474        .status(200)
475                    .body(::aws_smithy_types::body::SdkBody::from("<?xml version=\"1.0\"?>\n<ListVersionsResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">\n  <Name>sdk-obj-versions-test</Name>\n  <Prefix/>\n  <KeyMarker/>\n  <VersionIdMarker/>\n  <MaxKeys>1000</MaxKeys>\n  <IsTruncated>false</IsTruncated>\n  <DeleteMarker>\n    <Key>build.gradle.kts</Key>\n    <VersionId>null</VersionId>\n    <IsLatest>true</IsLatest>\n    <LastModified>2009-02-13T23:31:30Z</LastModified>\n    <Owner>\n      <ID>c1665459250c459f1849ddce9b291fc3a72bcf5220dc8f6391a0a1045c683b34</ID>\n      <DisplayName>test-name</DisplayName>\n    </Owner>\n  </DeleteMarker>\n  <Version>\n    <Key>build.gradle.kts</Key>\n    <VersionId>IfK9Z4.H5TLAtMxFrxN_C7rFEZbufF3V</VersionId>\n    <IsLatest>false</IsLatest>\n    <LastModified>2009-02-13T23:31:30Z</LastModified>\n    <ETag>\"99613b85e3f38b222c4ee548cde1e59d\"</ETag>\n    <Size>6903</Size>\n    <Owner>\n      <ID>c1665459250c459f1849ddce9b291fc3a72bcf5220dc8f6391a0a1045c683b34</ID>\n      <DisplayName>test-name</DisplayName>\n    </Owner>\n    <StorageClass>STANDARD</StorageClass>\n  </Version>\n  <DeleteMarker>\n    <Key>file-2</Key>\n    <VersionId>o98RL6vmlOYiymftbX7wgy_4XWQG4AmY</VersionId>\n    <IsLatest>true</IsLatest>\n    <LastModified>2009-02-13T23:31:30Z</LastModified>\n    <Owner>\n      <ID>c1665459250c459f1849ddce9b291fc3a72bcf5220dc8f6391a0a1045c683b34</ID>\n      <DisplayName>test-name</DisplayName>\n    </Owner>\n  </DeleteMarker>\n  <Version>\n    <Key>file-2</Key>\n    <VersionId>PSVAbvQihRdsNiktGothjGng7q.5ou9Q</VersionId>\n    <IsLatest>false</IsLatest>\n    <LastModified>2009-02-13T23:31:30Z</LastModified>\n    <ETag>\"1727d9cb38dd325d9c12c973ef3675fc\"</ETag>\n    <Size>14</Size>\n    <Owner>\n      <ID>c1665459250c459f1849ddce9b291fc3a72bcf5220dc8f6391a0a1045c683b34</ID>\n      <DisplayName>test-name</DisplayName>\n    </Owner>\n    <StorageClass>STANDARD</StorageClass>\n  </Version>\n</ListVersionsResult>\n"))
476                    .unwrap()
477                    ).unwrap();
478        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
479        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
480
481        let op = crate::operation::list_object_versions::ListObjectVersions::new();
482        let config = op.config().expect("the operation has config");
483        let de = config
484            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
485            .expect("the config must have a deserializer");
486
487        // Build a config bag with the protocol for schema-based deserialization
488        #[allow(unused_mut)]
489        let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
490
491        let parsed = de.deserialize_streaming(&mut http_response);
492        let parsed = parsed.unwrap_or_else(|| {
493            let http_response = http_response.map(|body| {
494                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
495                    body.bytes().unwrap(),
496                    ::aws_smithy_protocol_test::MediaType::from("application/xml"),
497                )))
498            });
499            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
500        });
501        let parsed = parsed
502            .expect("should be successful response")
503            .downcast::<crate::operation::list_object_versions::ListObjectVersionsOutput>()
504            .unwrap();
505        ::pretty_assertions::assert_eq!(parsed.is_truncated, expected_output.is_truncated, "Unexpected value for `is_truncated`");
506        ::pretty_assertions::assert_eq!(parsed.key_marker, expected_output.key_marker, "Unexpected value for `key_marker`");
507        ::pretty_assertions::assert_eq!(
508            parsed.version_id_marker,
509            expected_output.version_id_marker,
510            "Unexpected value for `version_id_marker`"
511        );
512        ::pretty_assertions::assert_eq!(
513            parsed.next_key_marker,
514            expected_output.next_key_marker,
515            "Unexpected value for `next_key_marker`"
516        );
517        ::pretty_assertions::assert_eq!(
518            parsed.next_version_id_marker,
519            expected_output.next_version_id_marker,
520            "Unexpected value for `next_version_id_marker`"
521        );
522        ::pretty_assertions::assert_eq!(parsed.versions, expected_output.versions, "Unexpected value for `versions`");
523        ::pretty_assertions::assert_eq!(
524            parsed.delete_markers,
525            expected_output.delete_markers,
526            "Unexpected value for `delete_markers`"
527        );
528        ::pretty_assertions::assert_eq!(parsed.name, expected_output.name, "Unexpected value for `name`");
529        ::pretty_assertions::assert_eq!(parsed.prefix, expected_output.prefix, "Unexpected value for `prefix`");
530        ::pretty_assertions::assert_eq!(parsed.delimiter, expected_output.delimiter, "Unexpected value for `delimiter`");
531        ::pretty_assertions::assert_eq!(parsed.max_keys, expected_output.max_keys, "Unexpected value for `max_keys`");
532        ::pretty_assertions::assert_eq!(
533            parsed.common_prefixes,
534            expected_output.common_prefixes,
535            "Unexpected value for `common_prefixes`"
536        );
537        ::pretty_assertions::assert_eq!(
538            parsed.encoding_type,
539            expected_output.encoding_type,
540            "Unexpected value for `encoding_type`"
541        );
542        ::pretty_assertions::assert_eq!(
543            parsed.request_charged,
544            expected_output.request_charged,
545            "Unexpected value for `request_charged`"
546        );
547    }
548}
549
550/// Error type for the `ListObjectVersionsError` operation.
551#[non_exhaustive]
552#[derive(::std::fmt::Debug)]
553pub enum ListObjectVersionsError {
554    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
555    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
556    variable wildcard pattern and check `.code()`:
557     \
558    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
559     \
560    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListObjectVersionsError) for what information is available for the error.")]
561    Unhandled(crate::error::sealed_unhandled::Unhandled),
562}
563impl ListObjectVersionsError {
564    /// Creates the `ListObjectVersionsError::Unhandled` variant from any error type.
565    pub fn unhandled(
566        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
567    ) -> Self {
568        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
569            source: err.into(),
570            meta: ::std::default::Default::default(),
571        })
572    }
573
574    /// Creates the `ListObjectVersionsError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
575    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
576        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
577            source: err.clone().into(),
578            meta: err,
579        })
580    }
581    ///
582    /// Returns error metadata, which includes the error code, message,
583    /// request ID, and potentially additional information.
584    ///
585    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
586        match self {
587            Self::Unhandled(e) => &e.meta,
588        }
589    }
590}
591impl ::std::error::Error for ListObjectVersionsError {
592    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
593        match self {
594            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
595        }
596    }
597}
598impl ::std::fmt::Display for ListObjectVersionsError {
599    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
600        match self {
601            Self::Unhandled(_inner) => {
602                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
603                    write!(f, "unhandled error ({code})")
604                } else {
605                    f.write_str("unhandled error")
606                }
607            }
608        }
609    }
610}
611impl ::aws_smithy_types::retry::ProvideErrorKind for ListObjectVersionsError {
612    fn code(&self) -> ::std::option::Option<&str> {
613        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
614    }
615    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
616        ::std::option::Option::None
617    }
618}
619impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListObjectVersionsError {
620    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
621        match self {
622            Self::Unhandled(_inner) => &_inner.meta,
623        }
624    }
625}
626impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListObjectVersionsError {
627    fn create_unhandled_error(
628        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
629        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
630    ) -> Self {
631        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
632            source,
633            meta: meta.unwrap_or_default(),
634        })
635    }
636}
637impl crate::s3_request_id::RequestIdExt for crate::operation::list_object_versions::ListObjectVersionsError {
638    fn extended_request_id(&self) -> Option<&str> {
639        self.meta().extended_request_id()
640    }
641}
642impl ::aws_types::request_id::RequestId for crate::operation::list_object_versions::ListObjectVersionsError {
643    fn request_id(&self) -> Option<&str> {
644        self.meta().request_id()
645    }
646}
647
648pub use crate::operation::list_object_versions::_list_object_versions_input::ListObjectVersionsInput;
649
650pub use crate::operation::list_object_versions::_list_object_versions_output::ListObjectVersionsOutput;
651
652mod _list_object_versions_input;
653
654mod _list_object_versions_output;
655
656/// Builders
657pub mod builders;