aws_sdk_datasync/protocol_serde/
shape_update_location_s3.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_update_location_s3_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::update_location_s3::UpdateLocationS3Output, crate::operation::update_location_s3::UpdateLocationS3Error> {
8 #[allow(unused_mut)]
9 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
10 .map_err(crate::operation::update_location_s3::UpdateLocationS3Error::unhandled)?;
11 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
12 let generic = generic_builder.build();
13 let error_code = match generic.code() {
14 Some(code) => code,
15 None => return Err(crate::operation::update_location_s3::UpdateLocationS3Error::unhandled(generic)),
16 };
17
18 let _error_message = generic.message().map(|msg| msg.to_owned());
19 Err(match error_code {
20 "InternalException" => crate::operation::update_location_s3::UpdateLocationS3Error::InternalException({
21 #[allow(unused_mut)]
22 let mut tmp = {
23 #[allow(unused_mut)]
24 let mut output = crate::types::error::builders::InternalExceptionBuilder::default();
25 output = crate::protocol_serde::shape_internal_exception::de_internal_exception_json_err(_response_body, output)
26 .map_err(crate::operation::update_location_s3::UpdateLocationS3Error::unhandled)?;
27 let output = output.meta(generic);
28 output.build()
29 };
30 if tmp.message.is_none() {
31 tmp.message = _error_message;
32 }
33 tmp
34 }),
35 "InvalidRequestException" => crate::operation::update_location_s3::UpdateLocationS3Error::InvalidRequestException({
36 #[allow(unused_mut)]
37 let mut tmp = {
38 #[allow(unused_mut)]
39 let mut output = crate::types::error::builders::InvalidRequestExceptionBuilder::default();
40 output = crate::protocol_serde::shape_invalid_request_exception::de_invalid_request_exception_json_err(_response_body, output)
41 .map_err(crate::operation::update_location_s3::UpdateLocationS3Error::unhandled)?;
42 let output = output.meta(generic);
43 output.build()
44 };
45 if tmp.message.is_none() {
46 tmp.message = _error_message;
47 }
48 tmp
49 }),
50 _ => crate::operation::update_location_s3::UpdateLocationS3Error::generic(generic),
51 })
52}
53
54#[allow(clippy::unnecessary_wraps)]
55pub fn de_update_location_s3_http_response(
56 _response_status: u16,
57 _response_headers: &::aws_smithy_runtime_api::http::Headers,
58 _response_body: &[u8],
59) -> std::result::Result<crate::operation::update_location_s3::UpdateLocationS3Output, crate::operation::update_location_s3::UpdateLocationS3Error> {
60 Ok({
61 #[allow(unused_mut)]
62 let mut output = crate::operation::update_location_s3::builders::UpdateLocationS3OutputBuilder::default();
63 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
64 output.build()
65 })
66}
67
68pub fn ser_update_location_s3_input(
69 input: &crate::operation::update_location_s3::UpdateLocationS3Input,
70) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
71 let mut out = String::new();
72 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
73 crate::protocol_serde::shape_update_location_s3_input::ser_update_location_s3_input_input(&mut object, input)?;
74 object.finish();
75 Ok(::aws_smithy_types::body::SdkBody::from(out))
76}