1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_list_log_groups_for_query_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::list_log_groups_for_query::ListLogGroupsForQueryOutput,
|
9 - | crate::operation::list_log_groups_for_query::ListLogGroupsForQueryError,
|
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::list_log_groups_for_query::ListLogGroupsForQueryError::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::list_log_groups_for_query::ListLogGroupsForQueryError::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::list_log_groups_for_query::ListLogGroupsForQueryError::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::list_log_groups_for_query::ListLogGroupsForQueryError::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 - | "InvalidParameterException" => crate::operation::list_log_groups_for_query::ListLogGroupsForQueryError::InvalidParameterException({
|
43 - | #[allow(unused_mut)]
|
44 - | let mut tmp = {
|
45 - | #[allow(unused_mut)]
|
46 - | let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
|
47 - | output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
|
48 - | .map_err(crate::operation::list_log_groups_for_query::ListLogGroupsForQueryError::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 - | "ResourceNotFoundException" => crate::operation::list_log_groups_for_query::ListLogGroupsForQueryError::ResourceNotFoundException({
|
58 - | #[allow(unused_mut)]
|
59 - | let mut tmp = {
|
60 - | #[allow(unused_mut)]
|
61 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
62 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
63 - | .map_err(crate::operation::list_log_groups_for_query::ListLogGroupsForQueryError::unhandled)?;
|
64 - | let output = output.meta(generic);
|
65 - | output.build()
|
66 - | };
|
67 - | if tmp.message.is_none() {
|
68 - | tmp.message = _error_message;
|
69 - | }
|
70 - | tmp
|
71 - | }),
|
72 - | "ServiceUnavailableException" => crate::operation::list_log_groups_for_query::ListLogGroupsForQueryError::ServiceUnavailableException({
|
73 - | #[allow(unused_mut)]
|
74 - | let mut tmp = {
|
75 - | #[allow(unused_mut)]
|
76 - | let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
|
77 - | output =
|
78 - | crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
|
79 - | .map_err(crate::operation::list_log_groups_for_query::ListLogGroupsForQueryError::unhandled)?;
|
80 - | let output = output.meta(generic);
|
81 - | output.build()
|
82 - | };
|
83 - | if tmp.message.is_none() {
|
84 - | tmp.message = _error_message;
|
85 - | }
|
86 - | tmp
|
87 - | }),
|
88 - | _ => crate::operation::list_log_groups_for_query::ListLogGroupsForQueryError::generic(generic),
|
89 - | })
|
90 - | }
|
91 - |
|
92 - | #[allow(clippy::unnecessary_wraps)]
|
93 - | pub fn de_list_log_groups_for_query_http_response(
|
94 - | _response_status: u16,
|
95 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
96 - | _response_body: &[u8],
|
97 - | ) -> std::result::Result<
|
98 - | crate::operation::list_log_groups_for_query::ListLogGroupsForQueryOutput,
|
99 - | crate::operation::list_log_groups_for_query::ListLogGroupsForQueryError,
|
100 - | > {
|
101 - | Ok({
|
102 - | #[allow(unused_mut)]
|
103 - | let mut output = crate::operation::list_log_groups_for_query::builders::ListLogGroupsForQueryOutputBuilder::default();
|
104 - | output = crate::protocol_serde::shape_list_log_groups_for_query::de_list_log_groups_for_query(_response_body, output)
|
105 - | .map_err(crate::operation::list_log_groups_for_query::ListLogGroupsForQueryError::unhandled)?;
|
106 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
107 - | output.build()
|
108 - | })
|
109 - | }
|
110 - |
|
111 - | pub fn ser_list_log_groups_for_query_input(
|
112 - | input: &crate::operation::list_log_groups_for_query::ListLogGroupsForQueryInput,
|
113 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
114 - | let mut out = String::new();
|
115 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
116 - | crate::protocol_serde::shape_list_log_groups_for_query_input::ser_list_log_groups_for_query_input_input(&mut object, input)?;
|
117 - | object.finish();
|
118 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
119 - | }
|
120 - |
|
121 - | pub(crate) fn de_list_log_groups_for_query(
|
122 - | _value: &[u8],
|
123 - | mut builder: crate::operation::list_log_groups_for_query::builders::ListLogGroupsForQueryOutputBuilder,
|
124 - | ) -> ::std::result::Result<
|
125 - | crate::operation::list_log_groups_for_query::builders::ListLogGroupsForQueryOutputBuilder,
|
126 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
127 - | > {
|
128 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
129 - | let tokens = &mut tokens_owned;
|
130 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
131 - | loop {
|
132 - | match tokens.next().transpose()? {
|
133 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
134 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
135 - | "logGroupIdentifiers" => {
|
136 - | builder = builder.set_log_group_identifiers(crate::protocol_serde::shape_log_group_identifiers::de_log_group_identifiers(
|
137 - | tokens, _value,
|
138 - | )?);
|
139 - | }
|
140 - | "nextToken" => {
|
141 - | builder = builder.set_next_token(
|
142 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
143 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
144 - | .transpose()?,
|
145 - | );
|
146 - | }
|
147 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
148 - | },
|
149 - | other => {
|
150 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
151 - | "expected object key or end object, found: {other:?}"
|
152 - | )))
|
153 - | }
|
154 - | }
|
155 - | }
|
156 - | if tokens.next().is_some() {
|
157 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
158 - | "found more JSON tokens after completing parsing",
|
159 - | ));
|
160 - | }
|
161 - | Ok(builder)
|
162 - | }
|