1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_get_log_anomaly_detector_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_log_anomaly_detector::GetLogAnomalyDetectorOutput,
|
9 - | crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorError,
|
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_log_anomaly_detector::GetLogAnomalyDetectorError::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_log_anomaly_detector::GetLogAnomalyDetectorError::unhandled(generic)),
|
19 - | };
|
20 - |
|
21 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
22 - | Err(match error_code {
|
23 - | "InvalidParameterException" => crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorError::InvalidParameterException({
|
24 - | #[allow(unused_mut)]
|
25 - | let mut tmp = {
|
26 - | #[allow(unused_mut)]
|
27 - | let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
|
28 - | output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
|
29 - | .map_err(crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorError::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 - | "OperationAbortedException" => crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorError::OperationAbortedException({
|
39 - | #[allow(unused_mut)]
|
40 - | let mut tmp = {
|
41 - | #[allow(unused_mut)]
|
42 - | let mut output = crate::types::error::builders::OperationAbortedExceptionBuilder::default();
|
43 - | output = crate::protocol_serde::shape_operation_aborted_exception::de_operation_aborted_exception_json_err(_response_body, output)
|
44 - | .map_err(crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorError::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_log_anomaly_detector::GetLogAnomalyDetectorError::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_log_anomaly_detector::GetLogAnomalyDetectorError::unhandled)?;
|
60 - | let output = output.meta(generic);
|
61 - | output.build()
|
62 - | };
|
63 - | if tmp.message.is_none() {
|
64 - | tmp.message = _error_message;
|
65 - | }
|
66 - | tmp
|
67 - | }),
|
68 - | "ServiceUnavailableException" => crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorError::ServiceUnavailableException({
|
69 - | #[allow(unused_mut)]
|
70 - | let mut tmp = {
|
71 - | #[allow(unused_mut)]
|
72 - | let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
|
73 - | output =
|
74 - | crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
|
75 - | .map_err(crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorError::unhandled)?;
|
76 - | let output = output.meta(generic);
|
77 - | output.build()
|
78 - | };
|
79 - | if tmp.message.is_none() {
|
80 - | tmp.message = _error_message;
|
81 - | }
|
82 - | tmp
|
83 - | }),
|
84 - | _ => crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorError::generic(generic),
|
85 - | })
|
86 - | }
|
87 - |
|
88 - | #[allow(clippy::unnecessary_wraps)]
|
89 - | pub fn de_get_log_anomaly_detector_http_response(
|
90 - | _response_status: u16,
|
91 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
92 - | _response_body: &[u8],
|
93 - | ) -> std::result::Result<
|
94 - | crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorOutput,
|
95 - | crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorError,
|
96 - | > {
|
97 - | Ok({
|
98 - | #[allow(unused_mut)]
|
99 - | let mut output = crate::operation::get_log_anomaly_detector::builders::GetLogAnomalyDetectorOutputBuilder::default();
|
100 - | output = crate::protocol_serde::shape_get_log_anomaly_detector::de_get_log_anomaly_detector(_response_body, output)
|
101 - | .map_err(crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorError::unhandled)?;
|
102 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
103 - | output.build()
|
104 - | })
|
105 - | }
|
106 - |
|
107 - | pub fn ser_get_log_anomaly_detector_input(
|
108 - | input: &crate::operation::get_log_anomaly_detector::GetLogAnomalyDetectorInput,
|
109 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
110 - | let mut out = String::new();
|
111 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
112 - | crate::protocol_serde::shape_get_log_anomaly_detector_input::ser_get_log_anomaly_detector_input_input(&mut object, input)?;
|
113 - | object.finish();
|
114 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
115 - | }
|
116 - |
|
117 - | pub(crate) fn de_get_log_anomaly_detector(
|
118 - | _value: &[u8],
|
119 - | mut builder: crate::operation::get_log_anomaly_detector::builders::GetLogAnomalyDetectorOutputBuilder,
|
120 - | ) -> ::std::result::Result<
|
121 - | crate::operation::get_log_anomaly_detector::builders::GetLogAnomalyDetectorOutputBuilder,
|
122 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
123 - | > {
|
124 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
125 - | let tokens = &mut tokens_owned;
|
126 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
127 - | loop {
|
128 - | match tokens.next().transpose()? {
|
129 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
130 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
131 - | "detectorName" => {
|
132 - | builder = builder.set_detector_name(
|
133 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
134 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
135 - | .transpose()?,
|
136 - | );
|
137 - | }
|
138 - | "logGroupArnList" => {
|
139 - | builder = builder.set_log_group_arn_list(crate::protocol_serde::shape_log_group_arn_list::de_log_group_arn_list(tokens, _value)?);
|
140 - | }
|
141 - | "evaluationFrequency" => {
|
142 - | builder = builder.set_evaluation_frequency(
|
143 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
144 - | .map(|s| s.to_unescaped().map(|u| crate::types::EvaluationFrequency::from(u.as_ref())))
|
145 - | .transpose()?,
|
146 - | );
|
147 - | }
|
148 - | "filterPattern" => {
|
149 - | builder = builder.set_filter_pattern(
|
150 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
151 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
152 - | .transpose()?,
|
153 - | );
|
154 - | }
|
155 - | "anomalyDetectorStatus" => {
|
156 - | builder = builder.set_anomaly_detector_status(
|
157 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
158 - | .map(|s| s.to_unescaped().map(|u| crate::types::AnomalyDetectorStatus::from(u.as_ref())))
|
159 - | .transpose()?,
|
160 - | );
|
161 - | }
|
162 - | "kmsKeyId" => {
|
163 - | builder = builder.set_kms_key_id(
|
164 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
165 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
166 - | .transpose()?,
|
167 - | );
|
168 - | }
|
169 - | "creationTimeStamp" => {
|
170 - | builder = builder.set_creation_time_stamp(
|
171 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
172 - | .map(i64::try_from)
|
173 - | .transpose()?,
|
174 - | );
|
175 - | }
|
176 - | "lastModifiedTimeStamp" => {
|
177 - | builder = builder.set_last_modified_time_stamp(
|
178 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
179 - | .map(i64::try_from)
|
180 - | .transpose()?,
|
181 - | );
|
182 - | }
|
183 - | "anomalyVisibilityTime" => {
|
184 - | builder = builder.set_anomaly_visibility_time(
|
185 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
186 - | .map(i64::try_from)
|
187 - | .transpose()?,
|
188 - | );
|
189 - | }
|
190 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
191 - | },
|
192 - | other => {
|
193 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
194 - | "expected object key or end object, found: {other:?}"
|
195 - | )))
|
196 - | }
|
197 - | }
|
198 - | }
|
199 - | if tokens.next().is_some() {
|
200 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
201 - | "found more JSON tokens after completing parsing",
|
202 - | ));
|
203 - | }
|
204 - | Ok(builder)
|
205 - | }
|