1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_put_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::put_log_events::PutLogEventsOutput, crate::operation::put_log_events::PutLogEventsError> {
|
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::put_log_events::PutLogEventsError::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::put_log_events::PutLogEventsError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "DataAlreadyAcceptedException" => crate::operation::put_log_events::PutLogEventsError::DataAlreadyAcceptedException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::DataAlreadyAcceptedExceptionBuilder::default();
|
25 - | output =
|
26 - | crate::protocol_serde::shape_data_already_accepted_exception::de_data_already_accepted_exception_json_err(_response_body, output)
|
27 - | .map_err(crate::operation::put_log_events::PutLogEventsError::unhandled)?;
|
28 - | let output = output.meta(generic);
|
29 - | output.build()
|
30 - | };
|
31 - | if tmp.message.is_none() {
|
32 - | tmp.message = _error_message;
|
33 - | }
|
34 - | tmp
|
35 - | }),
|
36 - | "InvalidParameterException" => crate::operation::put_log_events::PutLogEventsError::InvalidParameterException({
|
37 - | #[allow(unused_mut)]
|
38 - | let mut tmp = {
|
39 - | #[allow(unused_mut)]
|
40 - | let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
|
41 - | output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
|
42 - | .map_err(crate::operation::put_log_events::PutLogEventsError::unhandled)?;
|
43 - | let output = output.meta(generic);
|
44 - | output.build()
|
45 - | };
|
46 - | if tmp.message.is_none() {
|
47 - | tmp.message = _error_message;
|
48 - | }
|
49 - | tmp
|
50 - | }),
|
51 - | "InvalidSequenceTokenException" => crate::operation::put_log_events::PutLogEventsError::InvalidSequenceTokenException({
|
52 - | #[allow(unused_mut)]
|
53 - | let mut tmp = {
|
54 - | #[allow(unused_mut)]
|
55 - | let mut output = crate::types::error::builders::InvalidSequenceTokenExceptionBuilder::default();
|
56 - | output = crate::protocol_serde::shape_invalid_sequence_token_exception::de_invalid_sequence_token_exception_json_err(
|
57 - | _response_body,
|
58 - | output,
|
59 - | )
|
60 - | .map_err(crate::operation::put_log_events::PutLogEventsError::unhandled)?;
|
61 - | let output = output.meta(generic);
|
62 - | output.build()
|
63 - | };
|
64 - | if tmp.message.is_none() {
|
65 - | tmp.message = _error_message;
|
66 - | }
|
67 - | tmp
|
68 - | }),
|
69 - | "ResourceNotFoundException" => crate::operation::put_log_events::PutLogEventsError::ResourceNotFoundException({
|
70 - | #[allow(unused_mut)]
|
71 - | let mut tmp = {
|
72 - | #[allow(unused_mut)]
|
73 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
74 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
75 - | .map_err(crate::operation::put_log_events::PutLogEventsError::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 - | "ServiceUnavailableException" => crate::operation::put_log_events::PutLogEventsError::ServiceUnavailableException({
|
85 - | #[allow(unused_mut)]
|
86 - | let mut tmp = {
|
87 - | #[allow(unused_mut)]
|
88 - | let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
|
89 - | output =
|
90 - | crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
|
91 - | .map_err(crate::operation::put_log_events::PutLogEventsError::unhandled)?;
|
92 - | let output = output.meta(generic);
|
93 - | output.build()
|
94 - | };
|
95 - | if tmp.message.is_none() {
|
96 - | tmp.message = _error_message;
|
97 - | }
|
98 - | tmp
|
99 - | }),
|
100 - | "UnrecognizedClientException" => crate::operation::put_log_events::PutLogEventsError::UnrecognizedClientException({
|
101 - | #[allow(unused_mut)]
|
102 - | let mut tmp = {
|
103 - | #[allow(unused_mut)]
|
104 - | let mut output = crate::types::error::builders::UnrecognizedClientExceptionBuilder::default();
|
105 - | output =
|
106 - | crate::protocol_serde::shape_unrecognized_client_exception::de_unrecognized_client_exception_json_err(_response_body, output)
|
107 - | .map_err(crate::operation::put_log_events::PutLogEventsError::unhandled)?;
|
108 - | let output = output.meta(generic);
|
109 - | output.build()
|
110 - | };
|
111 - | if tmp.message.is_none() {
|
112 - | tmp.message = _error_message;
|
113 - | }
|
114 - | tmp
|
115 - | }),
|
116 - | _ => crate::operation::put_log_events::PutLogEventsError::generic(generic),
|
117 - | })
|
118 - | }
|
119 - |
|
120 - | #[allow(clippy::unnecessary_wraps)]
|
121 - | pub fn de_put_log_events_http_response(
|
122 - | _response_status: u16,
|
123 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
124 - | _response_body: &[u8],
|
125 - | ) -> std::result::Result<crate::operation::put_log_events::PutLogEventsOutput, crate::operation::put_log_events::PutLogEventsError> {
|
126 - | Ok({
|
127 - | #[allow(unused_mut)]
|
128 - | let mut output = crate::operation::put_log_events::builders::PutLogEventsOutputBuilder::default();
|
129 - | output = crate::protocol_serde::shape_put_log_events::de_put_log_events(_response_body, output)
|
130 - | .map_err(crate::operation::put_log_events::PutLogEventsError::unhandled)?;
|
131 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
132 - | output.build()
|
133 - | })
|
134 - | }
|
135 - |
|
136 - | pub fn ser_put_log_events_input(
|
137 - | input: &crate::operation::put_log_events::PutLogEventsInput,
|
138 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
139 - | let mut out = String::new();
|
140 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
141 - | crate::protocol_serde::shape_put_log_events_input::ser_put_log_events_input_input(&mut object, input)?;
|
142 - | object.finish();
|
143 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
144 - | }
|
145 - |
|
146 - | pub(crate) fn de_put_log_events(
|
147 - | _value: &[u8],
|
148 - | mut builder: crate::operation::put_log_events::builders::PutLogEventsOutputBuilder,
|
149 - | ) -> ::std::result::Result<
|
150 - | crate::operation::put_log_events::builders::PutLogEventsOutputBuilder,
|
151 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
152 - | > {
|
153 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
154 - | let tokens = &mut tokens_owned;
|
155 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
156 - | loop {
|
157 - | match tokens.next().transpose()? {
|
158 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
159 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
160 - | "nextSequenceToken" => {
|
161 - | builder = builder.set_next_sequence_token(
|
162 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
163 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
164 - | .transpose()?,
|
165 - | );
|
166 - | }
|
167 - | "rejectedLogEventsInfo" => {
|
168 - | builder = builder.set_rejected_log_events_info(
|
169 - | crate::protocol_serde::shape_rejected_log_events_info::de_rejected_log_events_info(tokens, _value)?,
|
170 - | );
|
171 - | }
|
172 - | "rejectedEntityInfo" => {
|
173 - | builder = builder.set_rejected_entity_info(crate::protocol_serde::shape_rejected_entity_info::de_rejected_entity_info(
|
174 - | tokens, _value,
|
175 - | )?);
|
176 - | }
|
177 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
178 - | },
|
179 - | other => {
|
180 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
181 - | "expected object key or end object, found: {other:?}"
|
182 - | )))
|
183 - | }
|
184 - | }
|
185 - | }
|
186 - | if tokens.next().is_some() {
|
187 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
188 - | "found more JSON tokens after completing parsing",
|
189 - | ));
|
190 - | }
|
191 - | Ok(builder)
|
192 - | }
|