aws_sdk_cleanrooms/protocol_serde/
shape_get_schema_analysis_rule.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_schema_analysis_rule_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::get_schema_analysis_rule::GetSchemaAnalysisRuleOutput,
9 crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError,
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::get_schema_analysis_rule::GetSchemaAnalysisRuleError::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::get_schema_analysis_rule::GetSchemaAnalysisRuleError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "AccessDeniedException" => crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::AccessDeniedException({
24 #[allow(unused_mut)]
25 let mut tmp = {
26 #[allow(unused_mut)]
27 let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
28 output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
29 .map_err(crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::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 "InternalServerException" => crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::InternalServerException({
39 #[allow(unused_mut)]
40 let mut tmp = {
41 #[allow(unused_mut)]
42 let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
43 output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
44 .map_err(crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::unhandled)?;
45 let output = output.meta(generic);
46 output.build()
47 };
48 if tmp.message.is_none() {
49 tmp.message = _error_message;
50 }
51 tmp
52 }),
53 "ResourceNotFoundException" => crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::ResourceNotFoundException({
54 #[allow(unused_mut)]
55 let mut tmp = {
56 #[allow(unused_mut)]
57 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
58 output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
59 .map_err(crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::unhandled)?;
60 let output = output.meta(generic);
61 crate::serde_util::resource_not_found_exception_correct_errors(output)
62 .build()
63 .map_err(crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::unhandled)?
64 };
65 tmp
66 }),
67 "ThrottlingException" => crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::ThrottlingException({
68 #[allow(unused_mut)]
69 let mut tmp = {
70 #[allow(unused_mut)]
71 let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
72 output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
73 .map_err(crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::unhandled)?;
74 let output = output.meta(generic);
75 output.build()
76 };
77 if tmp.message.is_none() {
78 tmp.message = _error_message;
79 }
80 tmp
81 }),
82 "ValidationException" => crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::ValidationException({
83 #[allow(unused_mut)]
84 let mut tmp = {
85 #[allow(unused_mut)]
86 let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
87 output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
88 .map_err(crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::unhandled)?;
89 let output = output.meta(generic);
90 output.build()
91 };
92 if tmp.message.is_none() {
93 tmp.message = _error_message;
94 }
95 tmp
96 }),
97 _ => crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::generic(generic),
98 })
99}
100
101#[allow(clippy::unnecessary_wraps)]
102pub fn de_get_schema_analysis_rule_http_response(
103 _response_status: u16,
104 _response_headers: &::aws_smithy_runtime_api::http::Headers,
105 _response_body: &[u8],
106) -> std::result::Result<
107 crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleOutput,
108 crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError,
109> {
110 Ok({
111 #[allow(unused_mut)]
112 let mut output = crate::operation::get_schema_analysis_rule::builders::GetSchemaAnalysisRuleOutputBuilder::default();
113 output = crate::protocol_serde::shape_get_schema_analysis_rule::de_get_schema_analysis_rule(_response_body, output)
114 .map_err(crate::operation::get_schema_analysis_rule::GetSchemaAnalysisRuleError::unhandled)?;
115 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
116 crate::serde_util::get_schema_analysis_rule_output_output_correct_errors(output).build()
117 })
118}
119
120pub(crate) fn de_get_schema_analysis_rule(
121 _value: &[u8],
122 mut builder: crate::operation::get_schema_analysis_rule::builders::GetSchemaAnalysisRuleOutputBuilder,
123) -> ::std::result::Result<
124 crate::operation::get_schema_analysis_rule::builders::GetSchemaAnalysisRuleOutputBuilder,
125 ::aws_smithy_json::deserialize::error::DeserializeError,
126> {
127 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
128 let tokens = &mut tokens_owned;
129 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
130 loop {
131 match tokens.next().transpose()? {
132 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
133 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
134 "analysisRule" => {
135 builder = builder.set_analysis_rule(crate::protocol_serde::shape_analysis_rule::de_analysis_rule(tokens, _value)?);
136 }
137 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
138 },
139 other => {
140 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
141 "expected object key or end object, found: {other:?}"
142 )))
143 }
144 }
145 }
146 if tokens.next().is_some() {
147 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
148 "found more JSON tokens after completing parsing",
149 ));
150 }
151 Ok(builder)
152}