aws_sdk_iotthingsgraph/protocol_serde/
shape_deprecate_system_template.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_deprecate_system_template_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::deprecate_system_template::DeprecateSystemTemplateOutput,
9 crate::operation::deprecate_system_template::DeprecateSystemTemplateError,
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::deprecate_system_template::DeprecateSystemTemplateError::unhandled)?;
14 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
15 let generic = generic_builder.build();
16 let error_code = match generic.code() {
17 Some(code) => code,
18 None => {
19 return Err(crate::operation::deprecate_system_template::DeprecateSystemTemplateError::unhandled(
20 generic,
21 ))
22 }
23 };
24
25 let _error_message = generic.message().map(|msg| msg.to_owned());
26 Err(match error_code {
27 "InternalFailureException" => crate::operation::deprecate_system_template::DeprecateSystemTemplateError::InternalFailureException({
28 #[allow(unused_mut)]
29 let mut tmp = {
30 #[allow(unused_mut)]
31 let mut output = crate::types::error::builders::InternalFailureExceptionBuilder::default();
32 output = crate::protocol_serde::shape_internal_failure_exception::de_internal_failure_exception_json_err(_response_body, output)
33 .map_err(crate::operation::deprecate_system_template::DeprecateSystemTemplateError::unhandled)?;
34 let output = output.meta(generic);
35 output.build()
36 };
37 if tmp.message.is_none() {
38 tmp.message = _error_message;
39 }
40 tmp
41 }),
42 "InvalidRequestException" => crate::operation::deprecate_system_template::DeprecateSystemTemplateError::InvalidRequestException({
43 #[allow(unused_mut)]
44 let mut tmp = {
45 #[allow(unused_mut)]
46 let mut output = crate::types::error::builders::InvalidRequestExceptionBuilder::default();
47 output = crate::protocol_serde::shape_invalid_request_exception::de_invalid_request_exception_json_err(_response_body, output)
48 .map_err(crate::operation::deprecate_system_template::DeprecateSystemTemplateError::unhandled)?;
49 let output = output.meta(generic);
50 output.build()
51 };
52 if tmp.message.is_none() {
53 tmp.message = _error_message;
54 }
55 tmp
56 }),
57 "ResourceNotFoundException" => crate::operation::deprecate_system_template::DeprecateSystemTemplateError::ResourceNotFoundException({
58 #[allow(unused_mut)]
59 let mut tmp = {
60 #[allow(unused_mut)]
61 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
62 output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
63 .map_err(crate::operation::deprecate_system_template::DeprecateSystemTemplateError::unhandled)?;
64 let output = output.meta(generic);
65 output.build()
66 };
67 if tmp.message.is_none() {
68 tmp.message = _error_message;
69 }
70 tmp
71 }),
72 "ThrottlingException" => crate::operation::deprecate_system_template::DeprecateSystemTemplateError::ThrottlingException({
73 #[allow(unused_mut)]
74 let mut tmp = {
75 #[allow(unused_mut)]
76 let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
77 output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
78 .map_err(crate::operation::deprecate_system_template::DeprecateSystemTemplateError::unhandled)?;
79 let output = output.meta(generic);
80 output.build()
81 };
82 if tmp.message.is_none() {
83 tmp.message = _error_message;
84 }
85 tmp
86 }),
87 _ => crate::operation::deprecate_system_template::DeprecateSystemTemplateError::generic(generic),
88 })
89}
90
91#[allow(clippy::unnecessary_wraps)]
92pub fn de_deprecate_system_template_http_response(
93 _response_status: u16,
94 _response_headers: &::aws_smithy_runtime_api::http::Headers,
95 _response_body: &[u8],
96) -> std::result::Result<
97 crate::operation::deprecate_system_template::DeprecateSystemTemplateOutput,
98 crate::operation::deprecate_system_template::DeprecateSystemTemplateError,
99> {
100 Ok({
101 #[allow(unused_mut)]
102 let mut output = crate::operation::deprecate_system_template::builders::DeprecateSystemTemplateOutputBuilder::default();
103 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
104 output.build()
105 })
106}
107
108pub fn ser_deprecate_system_template_input(
109 input: &crate::operation::deprecate_system_template::DeprecateSystemTemplateInput,
110) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
111 let mut out = String::new();
112 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
113 crate::protocol_serde::shape_deprecate_system_template_input::ser_deprecate_system_template_input_input(&mut object, input)?;
114 object.finish();
115 Ok(::aws_smithy_types::body::SdkBody::from(out))
116}