aws_sdk_databasemigration/protocol_serde/
shape_update_subscriptions_to_event_bridge.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_update_subscriptions_to_event_bridge_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::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeOutput,
9 crate::operation::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeError,
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::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeError::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::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "AccessDeniedFault" => crate::operation::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeError::AccessDeniedFault({
24 #[allow(unused_mut)]
25 let mut tmp = {
26 #[allow(unused_mut)]
27 let mut output = crate::types::error::builders::AccessDeniedFaultBuilder::default();
28 output = crate::protocol_serde::shape_access_denied_fault::de_access_denied_fault_json_err(_response_body, output)
29 .map_err(crate::operation::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeError::unhandled)?;
30 let output = output.meta(generic);
31 output.build()
32 };
33 if tmp.message.is_none() {
34 tmp.message = _error_message;
35 }
36 tmp
37 }),
38 "InvalidResourceStateFault" => {
39 crate::operation::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeError::InvalidResourceStateFault({
40 #[allow(unused_mut)]
41 let mut tmp = {
42 #[allow(unused_mut)]
43 let mut output = crate::types::error::builders::InvalidResourceStateFaultBuilder::default();
44 output =
45 crate::protocol_serde::shape_invalid_resource_state_fault::de_invalid_resource_state_fault_json_err(_response_body, output)
46 .map_err(crate::operation::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeError::unhandled)?;
47 let output = output.meta(generic);
48 output.build()
49 };
50 if tmp.message.is_none() {
51 tmp.message = _error_message;
52 }
53 tmp
54 })
55 }
56 _ => crate::operation::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeError::generic(generic),
57 })
58}
59
60#[allow(clippy::unnecessary_wraps)]
61pub fn de_update_subscriptions_to_event_bridge_http_response(
62 _response_status: u16,
63 _response_headers: &::aws_smithy_runtime_api::http::Headers,
64 _response_body: &[u8],
65) -> std::result::Result<
66 crate::operation::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeOutput,
67 crate::operation::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeError,
68> {
69 Ok({
70 #[allow(unused_mut)]
71 let mut output = crate::operation::update_subscriptions_to_event_bridge::builders::UpdateSubscriptionsToEventBridgeOutputBuilder::default();
72 output = crate::protocol_serde::shape_update_subscriptions_to_event_bridge::de_update_subscriptions_to_event_bridge(_response_body, output)
73 .map_err(crate::operation::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeError::unhandled)?;
74 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
75 output.build()
76 })
77}
78
79pub fn ser_update_subscriptions_to_event_bridge_input(
80 input: &crate::operation::update_subscriptions_to_event_bridge::UpdateSubscriptionsToEventBridgeInput,
81) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
82 let mut out = String::new();
83 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
84 crate::protocol_serde::shape_update_subscriptions_to_event_bridge_input::ser_update_subscriptions_to_event_bridge_input_input(
85 &mut object,
86 input,
87 )?;
88 object.finish();
89 Ok(::aws_smithy_types::body::SdkBody::from(out))
90}
91
92pub(crate) fn de_update_subscriptions_to_event_bridge(
93 value: &[u8],
94 mut builder: crate::operation::update_subscriptions_to_event_bridge::builders::UpdateSubscriptionsToEventBridgeOutputBuilder,
95) -> ::std::result::Result<
96 crate::operation::update_subscriptions_to_event_bridge::builders::UpdateSubscriptionsToEventBridgeOutputBuilder,
97 ::aws_smithy_json::deserialize::error::DeserializeError,
98> {
99 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
100 let tokens = &mut tokens_owned;
101 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
102 loop {
103 match tokens.next().transpose()? {
104 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
105 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
106 "Result" => {
107 builder = builder.set_result(
108 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
109 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
110 .transpose()?,
111 );
112 }
113 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
114 },
115 other => {
116 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
117 "expected object key or end object, found: {:?}",
118 other
119 )))
120 }
121 }
122 }
123 if tokens.next().is_some() {
124 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
125 "found more JSON tokens after completing parsing",
126 ));
127 }
128 Ok(builder)
129}