aws_sdk_workdocs/protocol_serde/
shape_delete_notification_subscription.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_delete_notification_subscription_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::delete_notification_subscription::DeleteNotificationSubscriptionOutput,
9 crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError,
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::delete_notification_subscription::DeleteNotificationSubscriptionError::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 => return Err(crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "EntityNotExistsException" => {
24 crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError::EntityNotExistsException({
25 #[allow(unused_mut)]
26 let mut tmp = {
27 #[allow(unused_mut)]
28 let mut output = crate::types::error::builders::EntityNotExistsExceptionBuilder::default();
29 output =
30 crate::protocol_serde::shape_entity_not_exists_exception::de_entity_not_exists_exception_json_err(_response_body, output)
31 .map_err(crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError::unhandled)?;
32 let output = output.meta(generic);
33 output.build()
34 };
35 if tmp.message.is_none() {
36 tmp.message = _error_message;
37 }
38 tmp
39 })
40 }
41 "ProhibitedStateException" => {
42 crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError::ProhibitedStateException({
43 #[allow(unused_mut)]
44 let mut tmp = {
45 #[allow(unused_mut)]
46 let mut output = crate::types::error::builders::ProhibitedStateExceptionBuilder::default();
47 output = crate::protocol_serde::shape_prohibited_state_exception::de_prohibited_state_exception_json_err(_response_body, output)
48 .map_err(crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError::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 }
58 "ServiceUnavailableException" => {
59 crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError::ServiceUnavailableException({
60 #[allow(unused_mut)]
61 let mut tmp = {
62 #[allow(unused_mut)]
63 let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
64 output =
65 crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
66 .map_err(crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError::unhandled)?;
67 let output = output.meta(generic);
68 output.build()
69 };
70 if tmp.message.is_none() {
71 tmp.message = _error_message;
72 }
73 tmp
74 })
75 }
76 "UnauthorizedResourceAccessException" => {
77 crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError::UnauthorizedResourceAccessException({
78 #[allow(unused_mut)]
79 let mut tmp = {
80 #[allow(unused_mut)]
81 let mut output = crate::types::error::builders::UnauthorizedResourceAccessExceptionBuilder::default();
82 output = crate::protocol_serde::shape_unauthorized_resource_access_exception::de_unauthorized_resource_access_exception_json_err(
83 _response_body,
84 output,
85 )
86 .map_err(crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError::unhandled)?;
87 let output = output.meta(generic);
88 output.build()
89 };
90 if tmp.message.is_none() {
91 tmp.message = _error_message;
92 }
93 tmp
94 })
95 }
96 _ => crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError::generic(generic),
97 })
98}
99
100#[allow(clippy::unnecessary_wraps)]
101pub fn de_delete_notification_subscription_http_response(
102 _response_status: u16,
103 _response_headers: &::aws_smithy_runtime_api::http::Headers,
104 _response_body: &[u8],
105) -> std::result::Result<
106 crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionOutput,
107 crate::operation::delete_notification_subscription::DeleteNotificationSubscriptionError,
108> {
109 Ok({
110 #[allow(unused_mut)]
111 let mut output = crate::operation::delete_notification_subscription::builders::DeleteNotificationSubscriptionOutputBuilder::default();
112 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
113 output.build()
114 })
115}