aws_sdk_signer/protocol_serde/
shape_remove_profile_permission.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_remove_profile_permission_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::remove_profile_permission::RemoveProfilePermissionOutput,
9 crate::operation::remove_profile_permission::RemoveProfilePermissionError,
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::remove_profile_permission::RemoveProfilePermissionError::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 => {
19 return Err(crate::operation::remove_profile_permission::RemoveProfilePermissionError::unhandled(
20 generic,
21 ))
22 }
23 };
24
25 let _error_message = generic.message().map(|msg| msg.to_owned());
26 Err(match error_code {
27 "AccessDeniedException" => crate::operation::remove_profile_permission::RemoveProfilePermissionError::AccessDeniedException({
28 #[allow(unused_mut)]
29 let mut tmp = {
30 #[allow(unused_mut)]
31 let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
32 output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
33 .map_err(crate::operation::remove_profile_permission::RemoveProfilePermissionError::unhandled)?;
34 let output = output.meta(generic);
35 output.build()
36 };
37 if tmp.message.is_none() {
38 tmp.message = _error_message;
39 }
40 tmp
41 }),
42 "ConflictException" => crate::operation::remove_profile_permission::RemoveProfilePermissionError::ConflictException({
43 #[allow(unused_mut)]
44 let mut tmp = {
45 #[allow(unused_mut)]
46 let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
47 output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
48 .map_err(crate::operation::remove_profile_permission::RemoveProfilePermissionError::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 "InternalServiceErrorException" => {
58 crate::operation::remove_profile_permission::RemoveProfilePermissionError::InternalServiceErrorException({
59 #[allow(unused_mut)]
60 let mut tmp = {
61 #[allow(unused_mut)]
62 let mut output = crate::types::error::builders::InternalServiceErrorExceptionBuilder::default();
63 output = crate::protocol_serde::shape_internal_service_error_exception::de_internal_service_error_exception_json_err(
64 _response_body,
65 output,
66 )
67 .map_err(crate::operation::remove_profile_permission::RemoveProfilePermissionError::unhandled)?;
68 let output = output.meta(generic);
69 output.build()
70 };
71 if tmp.message.is_none() {
72 tmp.message = _error_message;
73 }
74 tmp
75 })
76 }
77 "ResourceNotFoundException" => crate::operation::remove_profile_permission::RemoveProfilePermissionError::ResourceNotFoundException({
78 #[allow(unused_mut)]
79 let mut tmp = {
80 #[allow(unused_mut)]
81 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
82 output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
83 .map_err(crate::operation::remove_profile_permission::RemoveProfilePermissionError::unhandled)?;
84 let output = output.meta(generic);
85 output.build()
86 };
87 if tmp.message.is_none() {
88 tmp.message = _error_message;
89 }
90 tmp
91 }),
92 "TooManyRequestsException" => crate::operation::remove_profile_permission::RemoveProfilePermissionError::TooManyRequestsException({
93 #[allow(unused_mut)]
94 let mut tmp = {
95 #[allow(unused_mut)]
96 let mut output = crate::types::error::builders::TooManyRequestsExceptionBuilder::default();
97 output = crate::protocol_serde::shape_too_many_requests_exception::de_too_many_requests_exception_json_err(_response_body, output)
98 .map_err(crate::operation::remove_profile_permission::RemoveProfilePermissionError::unhandled)?;
99 let output = output.meta(generic);
100 output.build()
101 };
102 if tmp.message.is_none() {
103 tmp.message = _error_message;
104 }
105 tmp
106 }),
107 "ValidationException" => crate::operation::remove_profile_permission::RemoveProfilePermissionError::ValidationException({
108 #[allow(unused_mut)]
109 let mut tmp = {
110 #[allow(unused_mut)]
111 let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
112 output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
113 .map_err(crate::operation::remove_profile_permission::RemoveProfilePermissionError::unhandled)?;
114 let output = output.meta(generic);
115 output.build()
116 };
117 if tmp.message.is_none() {
118 tmp.message = _error_message;
119 }
120 tmp
121 }),
122 _ => crate::operation::remove_profile_permission::RemoveProfilePermissionError::generic(generic),
123 })
124}
125
126#[allow(clippy::unnecessary_wraps)]
127pub fn de_remove_profile_permission_http_response(
128 _response_status: u16,
129 _response_headers: &::aws_smithy_runtime_api::http::Headers,
130 _response_body: &[u8],
131) -> std::result::Result<
132 crate::operation::remove_profile_permission::RemoveProfilePermissionOutput,
133 crate::operation::remove_profile_permission::RemoveProfilePermissionError,
134> {
135 Ok({
136 #[allow(unused_mut)]
137 let mut output = crate::operation::remove_profile_permission::builders::RemoveProfilePermissionOutputBuilder::default();
138 output = crate::protocol_serde::shape_remove_profile_permission::de_remove_profile_permission(_response_body, output)
139 .map_err(crate::operation::remove_profile_permission::RemoveProfilePermissionError::unhandled)?;
140 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
141 output.build()
142 })
143}
144
145pub(crate) fn de_remove_profile_permission(
146 value: &[u8],
147 mut builder: crate::operation::remove_profile_permission::builders::RemoveProfilePermissionOutputBuilder,
148) -> ::std::result::Result<
149 crate::operation::remove_profile_permission::builders::RemoveProfilePermissionOutputBuilder,
150 ::aws_smithy_json::deserialize::error::DeserializeError,
151> {
152 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
153 let tokens = &mut tokens_owned;
154 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
155 loop {
156 match tokens.next().transpose()? {
157 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
158 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
159 "revisionId" => {
160 builder = builder.set_revision_id(
161 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
162 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
163 .transpose()?,
164 );
165 }
166 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
167 },
168 other => {
169 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
170 "expected object key or end object, found: {other:?}"
171 )))
172 }
173 }
174 }
175 if tokens.next().is_some() {
176 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
177 "found more JSON tokens after completing parsing",
178 ));
179 }
180 Ok(builder)
181}