aws_sdk_chatbot/protocol_serde/
shape_update_chime_webhook_configuration.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_update_chime_webhook_configuration_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_chime_webhook_configuration::UpdateChimeWebhookConfigurationOutput,
9 crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError,
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_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::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_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "InvalidParameterException" => {
24 crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::InvalidParameterException({
25 #[allow(unused_mut)]
26 let mut tmp = {
27 #[allow(unused_mut)]
28 let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
29 output =
30 crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
31 .map_err(crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::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 "InvalidRequestException" => {
42 crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::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::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::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 "ResourceNotFoundException" => {
59 crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::ResourceNotFoundException({
60 #[allow(unused_mut)]
61 let mut tmp = {
62 #[allow(unused_mut)]
63 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
64 output =
65 crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
66 .map_err(crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::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 "UpdateChimeWebhookConfigurationException" => {
77 crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::UpdateChimeWebhookConfigurationException({
78 #[allow(unused_mut)]
79 let mut tmp = {
80 #[allow(unused_mut)]
81 let mut output = crate::types::error::builders::UpdateChimeWebhookConfigurationExceptionBuilder::default();
82 output = crate::protocol_serde::shape_update_chime_webhook_configuration_exception::de_update_chime_webhook_configuration_exception_json_err(_response_body, output).map_err(crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::unhandled)?;
83 let output = output.meta(generic);
84 output.build()
85 };
86 if tmp.message.is_none() {
87 tmp.message = _error_message;
88 }
89 tmp
90 })
91 }
92 _ => crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::generic(generic),
93 })
94}
95
96#[allow(clippy::unnecessary_wraps)]
97pub fn de_update_chime_webhook_configuration_http_response(
98 _response_status: u16,
99 _response_headers: &::aws_smithy_runtime_api::http::Headers,
100 _response_body: &[u8],
101) -> std::result::Result<
102 crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationOutput,
103 crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError,
104> {
105 Ok({
106 #[allow(unused_mut)]
107 let mut output = crate::operation::update_chime_webhook_configuration::builders::UpdateChimeWebhookConfigurationOutputBuilder::default();
108 output = crate::protocol_serde::shape_update_chime_webhook_configuration::de_update_chime_webhook_configuration(_response_body, output)
109 .map_err(crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationError::unhandled)?;
110 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
111 output.build()
112 })
113}
114
115pub fn ser_update_chime_webhook_configuration_input(
116 input: &crate::operation::update_chime_webhook_configuration::UpdateChimeWebhookConfigurationInput,
117) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
118 let mut out = String::new();
119 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
120 crate::protocol_serde::shape_update_chime_webhook_configuration_input::ser_update_chime_webhook_configuration_input_input(&mut object, input)?;
121 object.finish();
122 Ok(::aws_smithy_types::body::SdkBody::from(out))
123}
124
125pub(crate) fn de_update_chime_webhook_configuration(
126 value: &[u8],
127 mut builder: crate::operation::update_chime_webhook_configuration::builders::UpdateChimeWebhookConfigurationOutputBuilder,
128) -> ::std::result::Result<
129 crate::operation::update_chime_webhook_configuration::builders::UpdateChimeWebhookConfigurationOutputBuilder,
130 ::aws_smithy_json::deserialize::error::DeserializeError,
131> {
132 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
133 let tokens = &mut tokens_owned;
134 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
135 loop {
136 match tokens.next().transpose()? {
137 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
138 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
139 "WebhookConfiguration" => {
140 builder = builder.set_webhook_configuration(
141 crate::protocol_serde::shape_chime_webhook_configuration::de_chime_webhook_configuration(tokens)?,
142 );
143 }
144 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
145 },
146 other => {
147 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
148 "expected object key or end object, found: {other:?}"
149 )))
150 }
151 }
152 }
153 if tokens.next().is_some() {
154 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
155 "found more JSON tokens after completing parsing",
156 ));
157 }
158 Ok(builder)
159}