aws_sdk_cognitosync/protocol_serde/
shape_set_identity_pool_configuration.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_set_identity_pool_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::set_identity_pool_configuration::SetIdentityPoolConfigurationOutput,
9 crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError,
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::set_identity_pool_configuration::SetIdentityPoolConfigurationError::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::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "ConcurrentModificationException" => {
24 crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::ConcurrentModificationException({
25 #[allow(unused_mut)]
26 let mut tmp = {
27 #[allow(unused_mut)]
28 let mut output = crate::types::error::builders::ConcurrentModificationExceptionBuilder::default();
29 output = crate::protocol_serde::shape_concurrent_modification_exception::de_concurrent_modification_exception_json_err(
30 _response_body,
31 output,
32 )
33 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?;
34 let output = output.meta(generic);
35 crate::serde_util::concurrent_modification_exception_correct_errors(output)
36 .build()
37 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?
38 };
39 tmp
40 })
41 }
42 "InternalErrorException" => crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::InternalErrorException({
43 #[allow(unused_mut)]
44 let mut tmp = {
45 #[allow(unused_mut)]
46 let mut output = crate::types::error::builders::InternalErrorExceptionBuilder::default();
47 output = crate::protocol_serde::shape_internal_error_exception::de_internal_error_exception_json_err(_response_body, output)
48 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?;
49 let output = output.meta(generic);
50 crate::serde_util::internal_error_exception_correct_errors(output)
51 .build()
52 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?
53 };
54 tmp
55 }),
56 "InvalidParameterException" => {
57 crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::InvalidParameterException({
58 #[allow(unused_mut)]
59 let mut tmp = {
60 #[allow(unused_mut)]
61 let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
62 output =
63 crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
64 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?;
65 let output = output.meta(generic);
66 crate::serde_util::invalid_parameter_exception_correct_errors(output)
67 .build()
68 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?
69 };
70 tmp
71 })
72 }
73 "NotAuthorizedException" => crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::NotAuthorizedException({
74 #[allow(unused_mut)]
75 let mut tmp = {
76 #[allow(unused_mut)]
77 let mut output = crate::types::error::builders::NotAuthorizedExceptionBuilder::default();
78 output = crate::protocol_serde::shape_not_authorized_exception::de_not_authorized_exception_json_err(_response_body, output)
79 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?;
80 let output = output.meta(generic);
81 crate::serde_util::not_authorized_exception_correct_errors(output)
82 .build()
83 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?
84 };
85 tmp
86 }),
87 "ResourceNotFoundException" => {
88 crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::ResourceNotFoundException({
89 #[allow(unused_mut)]
90 let mut tmp = {
91 #[allow(unused_mut)]
92 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
93 output =
94 crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
95 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?;
96 let output = output.meta(generic);
97 crate::serde_util::resource_not_found_exception_correct_errors(output)
98 .build()
99 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?
100 };
101 tmp
102 })
103 }
104 "TooManyRequestsException" => {
105 crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::TooManyRequestsException({
106 #[allow(unused_mut)]
107 let mut tmp = {
108 #[allow(unused_mut)]
109 let mut output = crate::types::error::builders::TooManyRequestsExceptionBuilder::default();
110 output =
111 crate::protocol_serde::shape_too_many_requests_exception::de_too_many_requests_exception_json_err(_response_body, output)
112 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?;
113 let output = output.meta(generic);
114 crate::serde_util::too_many_requests_exception_correct_errors(output)
115 .build()
116 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?
117 };
118 tmp
119 })
120 }
121 _ => crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::generic(generic),
122 })
123}
124
125#[allow(clippy::unnecessary_wraps)]
126pub fn de_set_identity_pool_configuration_http_response(
127 _response_status: u16,
128 _response_headers: &::aws_smithy_runtime_api::http::Headers,
129 _response_body: &[u8],
130) -> std::result::Result<
131 crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationOutput,
132 crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError,
133> {
134 Ok({
135 #[allow(unused_mut)]
136 let mut output = crate::operation::set_identity_pool_configuration::builders::SetIdentityPoolConfigurationOutputBuilder::default();
137 output = crate::protocol_serde::shape_set_identity_pool_configuration::de_set_identity_pool_configuration(_response_body, output)
138 .map_err(crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationError::unhandled)?;
139 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
140 output.build()
141 })
142}
143
144pub fn ser_set_identity_pool_configuration_input(
145 input: &crate::operation::set_identity_pool_configuration::SetIdentityPoolConfigurationInput,
146) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
147 let mut out = String::new();
148 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
149 crate::protocol_serde::shape_set_identity_pool_configuration_input::ser_set_identity_pool_configuration_input_input(&mut object, input)?;
150 object.finish();
151 Ok(::aws_smithy_types::body::SdkBody::from(out))
152}
153
154pub(crate) fn de_set_identity_pool_configuration(
155 _value: &[u8],
156 mut builder: crate::operation::set_identity_pool_configuration::builders::SetIdentityPoolConfigurationOutputBuilder,
157) -> ::std::result::Result<
158 crate::operation::set_identity_pool_configuration::builders::SetIdentityPoolConfigurationOutputBuilder,
159 ::aws_smithy_json::deserialize::error::DeserializeError,
160> {
161 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
162 let tokens = &mut tokens_owned;
163 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
164 loop {
165 match tokens.next().transpose()? {
166 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
167 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
168 "CognitoStreams" => {
169 builder = builder.set_cognito_streams(crate::protocol_serde::shape_cognito_streams::de_cognito_streams(tokens, _value)?);
170 }
171 "IdentityPoolId" => {
172 builder = builder.set_identity_pool_id(
173 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
174 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
175 .transpose()?,
176 );
177 }
178 "PushSync" => {
179 builder = builder.set_push_sync(crate::protocol_serde::shape_push_sync::de_push_sync(tokens, _value)?);
180 }
181 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
182 },
183 other => {
184 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
185 "expected object key or end object, found: {other:?}"
186 )))
187 }
188 }
189 }
190 if tokens.next().is_some() {
191 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
192 "found more JSON tokens after completing parsing",
193 ));
194 }
195 Ok(builder)
196}