aws_sdk_s3/protocol_serde/
shape_get_bucket_location.rs
1#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_bucket_location_http_error(
4 _response_status: u16,
5 _response_headers: &::aws_smithy_runtime_api::http::Headers,
6 _response_body: &[u8],
7) -> std::result::Result<crate::operation::get_bucket_location::GetBucketLocationOutput, crate::operation::get_bucket_location::GetBucketLocationError>
8{
9 #[allow(unused_mut)]
10 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
11 .map_err(crate::operation::get_bucket_location::GetBucketLocationError::unhandled)?;
12 generic_builder = crate::s3_request_id::apply_extended_request_id(generic_builder, _response_headers);
13 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
14 let generic = generic_builder.build();
15 Err(crate::operation::get_bucket_location::GetBucketLocationError::generic(generic))
16}
17
18#[allow(clippy::unnecessary_wraps)]
19pub fn de_get_bucket_location_http_response(
20 _response_status: u16,
21 _response_headers: &::aws_smithy_runtime_api::http::Headers,
22 _response_body: &[u8],
23) -> std::result::Result<crate::operation::get_bucket_location::GetBucketLocationOutput, crate::operation::get_bucket_location::GetBucketLocationError>
24{
25 Ok({
26 #[allow(unused_mut)]
27 let mut output = crate::operation::get_bucket_location::builders::GetBucketLocationOutputBuilder::default();
28 output = crate::protocol_serde::shape_get_bucket_location::de_get_bucket_location(_response_body, output)
29 .map_err(crate::operation::get_bucket_location::GetBucketLocationError::unhandled)?;
30 output._set_extended_request_id(crate::s3_request_id::RequestIdExt::extended_request_id(_response_headers).map(str::to_string));
31 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
32 output.build()
33 })
34}
35
36pub fn ser_get_bucket_location_headers(
37 input: &crate::operation::get_bucket_location::GetBucketLocationInput,
38 mut builder: ::http::request::Builder,
39) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
40 if let ::std::option::Option::Some(inner_1) = &input.expected_bucket_owner {
41 let formatted_2 = inner_1.as_str();
42 let header_value = formatted_2;
43 let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
44 ::aws_smithy_types::error::operation::BuildError::invalid_field(
45 "expected_bucket_owner",
46 format!("`{}` cannot be used as a header value: {}", &header_value, err),
47 )
48 })?;
49 builder = builder.header("x-amz-expected-bucket-owner", header_value);
50 }
51 Ok(builder)
52}
53
54#[allow(unused_mut)]
55pub fn de_get_bucket_location(
56 inp: &[u8],
57 mut builder: crate::operation::get_bucket_location::builders::GetBucketLocationOutputBuilder,
58) -> std::result::Result<crate::operation::get_bucket_location::builders::GetBucketLocationOutputBuilder, ::aws_smithy_xml::decode::XmlDecodeError> {
59 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
60
61 #[allow(unused_mut)]
62 let mut decoder = doc.root_element()?;
63 #[allow(unused_variables)]
64 let start_el = decoder.start_el();
65 match start_el {
66 s if s.matches("LocationConstraint") => {
67 let var_3 =
68 Some(
69 Result::<crate::types::BucketLocationConstraint, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
70 crate::types::BucketLocationConstraint::from(
71 ::aws_smithy_xml::decode::try_data(&mut decoder)?.as_ref()
72 )
73 )
74 ?
75 )
76 ;
77 builder = builder.set_location_constraint(var_3);
78 }
79 ,
80 _ => return Err(::aws_smithy_xml::decode::XmlDecodeError::custom("expected LocationConstraint tag"))
81 }
82 Ok(builder)
83}