aws_sdk_s3/protocol_serde/
shape_list_bucket_analytics_configurations.rs
1#[allow(clippy::unnecessary_wraps)]
3pub fn de_list_bucket_analytics_configurations_http_error(
4 _response_status: u16,
5 _response_headers: &::aws_smithy_runtime_api::http::Headers,
6 _response_body: &[u8],
7) -> std::result::Result<
8 crate::operation::list_bucket_analytics_configurations::ListBucketAnalyticsConfigurationsOutput,
9 crate::operation::list_bucket_analytics_configurations::ListBucketAnalyticsConfigurationsError,
10> {
11 #[allow(unused_mut)]
12 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
13 .map_err(crate::operation::list_bucket_analytics_configurations::ListBucketAnalyticsConfigurationsError::unhandled)?;
14 generic_builder = crate::s3_request_id::apply_extended_request_id(generic_builder, _response_headers);
15 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
16 let generic = generic_builder.build();
17 Err(crate::operation::list_bucket_analytics_configurations::ListBucketAnalyticsConfigurationsError::generic(generic))
18}
19
20#[allow(clippy::unnecessary_wraps)]
21pub fn de_list_bucket_analytics_configurations_http_response(
22 _response_status: u16,
23 _response_headers: &::aws_smithy_runtime_api::http::Headers,
24 _response_body: &[u8],
25) -> std::result::Result<
26 crate::operation::list_bucket_analytics_configurations::ListBucketAnalyticsConfigurationsOutput,
27 crate::operation::list_bucket_analytics_configurations::ListBucketAnalyticsConfigurationsError,
28> {
29 Ok({
30 #[allow(unused_mut)]
31 let mut output = crate::operation::list_bucket_analytics_configurations::builders::ListBucketAnalyticsConfigurationsOutputBuilder::default();
32 output = crate::protocol_serde::shape_list_bucket_analytics_configurations::de_list_bucket_analytics_configurations(_response_body, output)
33 .map_err(crate::operation::list_bucket_analytics_configurations::ListBucketAnalyticsConfigurationsError::unhandled)?;
34 output._set_extended_request_id(crate::s3_request_id::RequestIdExt::extended_request_id(_response_headers).map(str::to_string));
35 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
36 output.build()
37 })
38}
39
40pub fn ser_list_bucket_analytics_configurations_headers(
41 input: &crate::operation::list_bucket_analytics_configurations::ListBucketAnalyticsConfigurationsInput,
42 mut builder: ::http::request::Builder,
43) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
44 if let ::std::option::Option::Some(inner_1) = &input.expected_bucket_owner {
45 let formatted_2 = inner_1.as_str();
46 let header_value = formatted_2;
47 let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
48 ::aws_smithy_types::error::operation::BuildError::invalid_field(
49 "expected_bucket_owner",
50 format!("`{}` cannot be used as a header value: {}", &header_value, err),
51 )
52 })?;
53 builder = builder.header("x-amz-expected-bucket-owner", header_value);
54 }
55 Ok(builder)
56}
57
58#[allow(unused_mut)]
59pub fn de_list_bucket_analytics_configurations(
60 inp: &[u8],
61 mut builder: crate::operation::list_bucket_analytics_configurations::builders::ListBucketAnalyticsConfigurationsOutputBuilder,
62) -> std::result::Result<
63 crate::operation::list_bucket_analytics_configurations::builders::ListBucketAnalyticsConfigurationsOutputBuilder,
64 ::aws_smithy_xml::decode::XmlDecodeError,
65> {
66 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
67
68 #[allow(unused_mut)]
69 let mut decoder = doc.root_element()?;
70 #[allow(unused_variables)]
71 let start_el = decoder.start_el();
72 if !start_el.matches("ListBucketAnalyticsConfigurationResult") {
73 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
74 "encountered invalid XML root: expected ListBucketAnalyticsConfigurationResult but got {:?}. This is likely a bug in the SDK.",
75 start_el
76 )));
77 }
78 while let Some(mut tag) = decoder.next_tag() {
79 match tag.start_el() {
80 s if s.matches("NextContinuationToken") => {
81 let var_3 =
82 Some(
83 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
84 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
85 .into()
86 )
87 ?
88 )
89 ;
90 builder = builder.set_next_continuation_token(var_3);
91 }
92 ,
93 s if s.matches("ContinuationToken") => {
94 let var_4 =
95 Some(
96 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
97 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
98 .into()
99 )
100 ?
101 )
102 ;
103 builder = builder.set_continuation_token(var_4);
104 }
105 ,
106 s if s.matches("IsTruncated") => {
107 let var_5 =
108 Some(
109 {
110 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
111 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
112 )
113 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.s3#IsTruncated`)"))
114 }
115 ?
116 )
117 ;
118 builder = builder.set_is_truncated(var_5);
119 }
120 ,
121 s if s.matches("AnalyticsConfiguration") => {
122 let var_6 =
123 Some(
124 Result::<::std::vec::Vec::<crate::types::AnalyticsConfiguration>, ::aws_smithy_xml::decode::XmlDecodeError>::Ok({
125 let mut list_7 = builder.analytics_configuration_list.take().unwrap_or_default();
126 list_7.push(
127 crate::protocol_serde::shape_analytics_configuration::de_analytics_configuration(&mut tag)
128 ?
129 );
130 list_7
131 })
132 ?
133 )
134 ;
135 builder = builder.set_analytics_configuration_list(var_6);
136 }
137 ,
138 _ => {}
139 }
140 }
141 Ok(builder)
142}