aws_sdk_applicationinsights/protocol_serde/
shape_delete_component.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_delete_component_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::delete_component::DeleteComponentOutput, crate::operation::delete_component::DeleteComponentError> {
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::delete_component::DeleteComponentError::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::delete_component::DeleteComponentError::unhandled(generic)),
16 };
17
18 let _error_message = generic.message().map(|msg| msg.to_owned());
19 Err(match error_code {
20 "InternalServerException" => crate::operation::delete_component::DeleteComponentError::InternalServerException({
21 #[allow(unused_mut)]
22 let mut tmp = {
23 #[allow(unused_mut)]
24 let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
25 output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
26 .map_err(crate::operation::delete_component::DeleteComponentError::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 "ResourceNotFoundException" => crate::operation::delete_component::DeleteComponentError::ResourceNotFoundException({
36 #[allow(unused_mut)]
37 let mut tmp = {
38 #[allow(unused_mut)]
39 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
40 output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
41 .map_err(crate::operation::delete_component::DeleteComponentError::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 "ValidationException" => crate::operation::delete_component::DeleteComponentError::ValidationException({
51 #[allow(unused_mut)]
52 let mut tmp = {
53 #[allow(unused_mut)]
54 let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
55 output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
56 .map_err(crate::operation::delete_component::DeleteComponentError::unhandled)?;
57 let output = output.meta(generic);
58 output.build()
59 };
60 if tmp.message.is_none() {
61 tmp.message = _error_message;
62 }
63 tmp
64 }),
65 _ => crate::operation::delete_component::DeleteComponentError::generic(generic),
66 })
67}
68
69#[allow(clippy::unnecessary_wraps)]
70pub fn de_delete_component_http_response(
71 _response_status: u16,
72 _response_headers: &::aws_smithy_runtime_api::http::Headers,
73 _response_body: &[u8],
74) -> std::result::Result<crate::operation::delete_component::DeleteComponentOutput, crate::operation::delete_component::DeleteComponentError> {
75 Ok({
76 #[allow(unused_mut)]
77 let mut output = crate::operation::delete_component::builders::DeleteComponentOutputBuilder::default();
78 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
79 output.build()
80 })
81}
82
83pub fn ser_delete_component_input(
84 input: &crate::operation::delete_component::DeleteComponentInput,
85) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
86 let mut out = String::new();
87 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
88 crate::protocol_serde::shape_delete_component_input::ser_delete_component_input_input(&mut object, input)?;
89 object.finish();
90 Ok(::aws_smithy_types::body::SdkBody::from(out))
91}