1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_filter_log_events_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<crate::operation::filter_log_events::FilterLogEventsOutput, crate::operation::filter_log_events::FilterLogEventsError> {
|
8 - | #[allow(unused_mut)]
|
9 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
10 - | .map_err(crate::operation::filter_log_events::FilterLogEventsError::unhandled)?;
|
11 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
12 - | let generic = generic_builder.build();
|
13 - | let error_code = match generic.code() {
|
14 - | Some(code) => code,
|
15 - | None => return Err(crate::operation::filter_log_events::FilterLogEventsError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "InvalidParameterException" => crate::operation::filter_log_events::FilterLogEventsError::InvalidParameterException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
|
26 - | .map_err(crate::operation::filter_log_events::FilterLogEventsError::unhandled)?;
|
27 - | let output = output.meta(generic);
|
28 - | output.build()
|
29 - | };
|
30 - | if tmp.message.is_none() {
|
31 - | tmp.message = _error_message;
|
32 - | }
|
33 - | tmp
|
34 - | }),
|
35 - | "ResourceNotFoundException" => crate::operation::filter_log_events::FilterLogEventsError::ResourceNotFoundException({
|
36 - | #[allow(unused_mut)]
|
37 - | let mut tmp = {
|
38 - | #[allow(unused_mut)]
|
39 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
40 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
41 - | .map_err(crate::operation::filter_log_events::FilterLogEventsError::unhandled)?;
|
42 - | let output = output.meta(generic);
|
43 - | output.build()
|
44 - | };
|
45 - | if tmp.message.is_none() {
|
46 - | tmp.message = _error_message;
|
47 - | }
|
48 - | tmp
|
49 - | }),
|
50 - | "ServiceUnavailableException" => crate::operation::filter_log_events::FilterLogEventsError::ServiceUnavailableException({
|
51 - | #[allow(unused_mut)]
|
52 - | let mut tmp = {
|
53 - | #[allow(unused_mut)]
|
54 - | let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
|
55 - | output =
|
56 - | crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
|
57 - | .map_err(crate::operation::filter_log_events::FilterLogEventsError::unhandled)?;
|
58 - | let output = output.meta(generic);
|
59 - | output.build()
|
60 - | };
|
61 - | if tmp.message.is_none() {
|
62 - | tmp.message = _error_message;
|
63 - | }
|
64 - | tmp
|
65 - | }),
|
66 - | _ => crate::operation::filter_log_events::FilterLogEventsError::generic(generic),
|
67 - | })
|
68 - | }
|
69 - |
|
70 - | #[allow(clippy::unnecessary_wraps)]
|
71 - | pub fn de_filter_log_events_http_response(
|
72 - | _response_status: u16,
|
73 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
74 - | _response_body: &[u8],
|
75 - | ) -> std::result::Result<crate::operation::filter_log_events::FilterLogEventsOutput, crate::operation::filter_log_events::FilterLogEventsError> {
|
76 - | Ok({
|
77 - | #[allow(unused_mut)]
|
78 - | let mut output = crate::operation::filter_log_events::builders::FilterLogEventsOutputBuilder::default();
|
79 - | output = crate::protocol_serde::shape_filter_log_events::de_filter_log_events(_response_body, output)
|
80 - | .map_err(crate::operation::filter_log_events::FilterLogEventsError::unhandled)?;
|
81 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
82 - | output.build()
|
83 - | })
|
84 - | }
|
85 - |
|
86 - | pub fn ser_filter_log_events_input(
|
87 - | input: &crate::operation::filter_log_events::FilterLogEventsInput,
|
88 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
89 - | let mut out = String::new();
|
90 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
91 - | crate::protocol_serde::shape_filter_log_events_input::ser_filter_log_events_input_input(&mut object, input)?;
|
92 - | object.finish();
|
93 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
94 - | }
|
95 - |
|
96 - | pub(crate) fn de_filter_log_events(
|
97 - | _value: &[u8],
|
98 - | mut builder: crate::operation::filter_log_events::builders::FilterLogEventsOutputBuilder,
|
99 - | ) -> ::std::result::Result<
|
100 - | crate::operation::filter_log_events::builders::FilterLogEventsOutputBuilder,
|
101 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
102 - | > {
|
103 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
104 - | let tokens = &mut tokens_owned;
|
105 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
106 - | loop {
|
107 - | match tokens.next().transpose()? {
|
108 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
109 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
110 - | "events" => {
|
111 - | builder = builder.set_events(crate::protocol_serde::shape_filtered_log_events::de_filtered_log_events(tokens, _value)?);
|
112 - | }
|
113 - | "searchedLogStreams" => {
|
114 - | builder = builder.set_searched_log_streams(crate::protocol_serde::shape_searched_log_streams::de_searched_log_streams(
|
115 - | tokens, _value,
|
116 - | )?);
|
117 - | }
|
118 - | "nextToken" => {
|
119 - | builder = builder.set_next_token(
|
120 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
121 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
122 - | .transpose()?,
|
123 - | );
|
124 - | }
|
125 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
126 - | },
|
127 - | other => {
|
128 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
129 - | "expected object key or end object, found: {other:?}"
|
130 - | )))
|
131 - | }
|
132 - | }
|
133 - | }
|
134 - | if tokens.next().is_some() {
|
135 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
136 - | "found more JSON tokens after completing parsing",
|
137 - | ));
|
138 - | }
|
139 - | Ok(builder)
|
140 - | }
|