138 142 | crate::operation::write_records::WriteRecordsError,
|
139 143 | >::new());
|
140 144 |
|
141 145 | ::std::borrow::Cow::Owned(rcb)
|
142 146 | }
|
143 147 | }
|
144 148 |
|
145 149 | #[derive(Debug)]
|
146 150 | struct WriteRecordsResponseDeserializer;
|
147 151 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for WriteRecordsResponseDeserializer {
|
148 - | fn deserialize_nonstreaming(
|
152 + | fn deserialize_nonstreaming_with_config(
|
149 153 | &self,
|
150 154 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
155 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
151 156 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
152 157 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
153 - | let headers = response.headers();
|
154 - | let body = response.body().bytes().expect("body loaded");
|
155 158 | #[allow(unused_mut)]
|
156 159 | let mut force_error = false;
|
157 160 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
158 - | let parse_result = if !success && status != 200 || force_error {
|
159 - | crate::protocol_serde::shape_write_records::de_write_records_http_error(status, headers, body)
|
161 + | if !success && status != 200 || force_error {
|
162 + | let headers = response.headers();
|
163 + | let body = response.body().bytes().expect("body loaded");
|
164 + | #[allow(unused_mut)]
|
165 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
166 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
167 + | })?;
|
168 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
169 + | let generic = generic_builder.build();
|
170 + | let error_code = match generic.code() {
|
171 + | ::std::option::Option::Some(code) => code,
|
172 + | ::std::option::Option::None => {
|
173 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
174 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::write_records::WriteRecordsError::unhandled(generic)),
|
175 + | ))
|
176 + | }
|
177 + | };
|
178 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
179 + | let protocol = _cfg
|
180 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
181 + | .expect("a SharedClientProtocol is required");
|
182 + | let err = match error_code {
|
183 + | "AccessDeniedException" => crate::operation::write_records::WriteRecordsError::AccessDeniedException({
|
184 + | let mut tmp = match protocol
|
185 + | .deserialize_response(response, crate::types::error::AccessDeniedException::SCHEMA, _cfg)
|
186 + | .and_then(|mut deser| {
|
187 + | crate::types::error::AccessDeniedException::deserialize_with_response(
|
188 + | &mut *deser,
|
189 + | response.headers(),
|
190 + | response.status().into(),
|
191 + | body,
|
192 + | )
|
193 + | }) {
|
194 + | ::std::result::Result::Ok(val) => val,
|
195 + | ::std::result::Result::Err(e) => {
|
196 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
197 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
198 + | ))
|
199 + | }
|
200 + | };
|
201 + | tmp.meta = generic;
|
202 + | tmp
|
203 + | }),
|
204 + | "InternalServerException" => crate::operation::write_records::WriteRecordsError::InternalServerException({
|
205 + | let mut tmp = match protocol
|
206 + | .deserialize_response(response, crate::types::error::InternalServerException::SCHEMA, _cfg)
|
207 + | .and_then(|mut deser| {
|
208 + | crate::types::error::InternalServerException::deserialize_with_response(
|
209 + | &mut *deser,
|
210 + | response.headers(),
|
211 + | response.status().into(),
|
212 + | body,
|
213 + | )
|
214 + | }) {
|
215 + | ::std::result::Result::Ok(val) => val,
|
216 + | ::std::result::Result::Err(e) => {
|
217 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
218 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
219 + | ))
|
220 + | }
|
221 + | };
|
222 + | tmp.meta = generic;
|
223 + | tmp
|
224 + | }),
|
225 + | "InvalidEndpointException" => crate::operation::write_records::WriteRecordsError::InvalidEndpointException({
|
226 + | let mut tmp = match protocol
|
227 + | .deserialize_response(response, crate::types::error::InvalidEndpointException::SCHEMA, _cfg)
|
228 + | .and_then(|mut deser| {
|
229 + | crate::types::error::InvalidEndpointException::deserialize_with_response(
|
230 + | &mut *deser,
|
231 + | response.headers(),
|
232 + | response.status().into(),
|
233 + | body,
|
234 + | )
|
235 + | }) {
|
236 + | ::std::result::Result::Ok(val) => val,
|
237 + | ::std::result::Result::Err(e) => {
|
238 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
239 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
240 + | ))
|
241 + | }
|
242 + | };
|
243 + | tmp.meta = generic;
|
244 + | if tmp.message.is_none() {
|
245 + | tmp.message = _error_message;
|
246 + | }
|
247 + | tmp
|
248 + | }),
|
249 + | "RejectedRecordsException" => crate::operation::write_records::WriteRecordsError::RejectedRecordsException({
|
250 + | let mut tmp = match protocol
|
251 + | .deserialize_response(response, crate::types::error::RejectedRecordsException::SCHEMA, _cfg)
|
252 + | .and_then(|mut deser| {
|
253 + | crate::types::error::RejectedRecordsException::deserialize_with_response(
|
254 + | &mut *deser,
|
255 + | response.headers(),
|
256 + | response.status().into(),
|
257 + | body,
|
258 + | )
|
259 + | }) {
|
260 + | ::std::result::Result::Ok(val) => val,
|
261 + | ::std::result::Result::Err(e) => {
|
262 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
263 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
264 + | ))
|
265 + | }
|
266 + | };
|
267 + | tmp.meta = generic;
|
268 + | if tmp.message.is_none() {
|
269 + | tmp.message = _error_message;
|
270 + | }
|
271 + | tmp
|
272 + | }),
|
273 + | "ResourceNotFoundException" => crate::operation::write_records::WriteRecordsError::ResourceNotFoundException({
|
274 + | let mut tmp = match protocol
|
275 + | .deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
|
276 + | .and_then(|mut deser| {
|
277 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
278 + | &mut *deser,
|
279 + | response.headers(),
|
280 + | response.status().into(),
|
281 + | body,
|
282 + | )
|
283 + | }) {
|
284 + | ::std::result::Result::Ok(val) => val,
|
285 + | ::std::result::Result::Err(e) => {
|
286 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
287 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
288 + | ))
|
289 + | }
|
290 + | };
|
291 + | tmp.meta = generic;
|
292 + | if tmp.message.is_none() {
|
293 + | tmp.message = _error_message;
|
294 + | }
|
295 + | tmp
|
296 + | }),
|
297 + | "ThrottlingException" => crate::operation::write_records::WriteRecordsError::ThrottlingException({
|
298 + | let mut tmp = match protocol
|
299 + | .deserialize_response(response, crate::types::error::ThrottlingException::SCHEMA, _cfg)
|
300 + | .and_then(|mut deser| {
|
301 + | crate::types::error::ThrottlingException::deserialize_with_response(
|
302 + | &mut *deser,
|
303 + | response.headers(),
|
304 + | response.status().into(),
|
305 + | body,
|
306 + | )
|
307 + | }) {
|
308 + | ::std::result::Result::Ok(val) => val,
|
309 + | ::std::result::Result::Err(e) => {
|
310 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
311 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
312 + | ))
|
313 + | }
|
314 + | };
|
315 + | tmp.meta = generic;
|
316 + | tmp
|
317 + | }),
|
318 + | "ValidationException" => crate::operation::write_records::WriteRecordsError::ValidationException({
|
319 + | let mut tmp = match protocol
|
320 + | .deserialize_response(response, crate::types::error::ValidationException::SCHEMA, _cfg)
|
321 + | .and_then(|mut deser| {
|
322 + | crate::types::error::ValidationException::deserialize_with_response(
|
323 + | &mut *deser,
|
324 + | response.headers(),
|
325 + | response.status().into(),
|
326 + | body,
|
327 + | )
|
328 + | }) {
|
329 + | ::std::result::Result::Ok(val) => val,
|
330 + | ::std::result::Result::Err(e) => {
|
331 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
332 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
333 + | ))
|
334 + | }
|
335 + | };
|
336 + | tmp.meta = generic;
|
337 + | tmp
|
338 + | }),
|
339 + | _ => crate::operation::write_records::WriteRecordsError::generic(generic),
|
340 + | };
|
341 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
342 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
343 + | ))
|
160 344 | } else {
|
161 - | crate::protocol_serde::shape_write_records::de_write_records_http_response(status, headers, body)
|
162 - | };
|
163 - | crate::protocol_serde::type_erase_result(parse_result)
|
345 + | let protocol = _cfg
|
346 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
347 + | .expect("a SharedClientProtocol is required");
|
348 + | let mut deser = protocol.deserialize_response(response, WriteRecords::OUTPUT_SCHEMA, _cfg).map_err(|e| {
|
349 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
350 + | })?;
|
351 + | let body = response.body().bytes().expect("body loaded");
|
352 + | let output = crate::operation::write_records::WriteRecordsOutput::deserialize_with_response(
|
353 + | &mut *deser,
|
354 + | response.headers(),
|
355 + | response.status().into(),
|
356 + | body,
|
357 + | )
|
358 + | .map_err(|e| {
|
359 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
360 + | })?;
|
361 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
362 + | }
|
164 363 | }
|
165 364 | }
|
166 365 | #[derive(Debug)]
|
167 366 | struct WriteRecordsRequestSerializer;
|
168 367 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for WriteRecordsRequestSerializer {
|
169 368 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
170 369 | fn serialize_input(
|
171 370 | &self,
|
172 371 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
173 372 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
174 373 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
175 374 | let input = input
|
176 375 | .downcast::<crate::operation::write_records::WriteRecordsInput>()
|
177 376 | .expect("correct type");
|
178 - | let _header_serialization_settings = _cfg
|
179 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
180 - | .cloned()
|
181 - | .unwrap_or_default();
|
182 - | let mut request_builder = {
|
183 - | #[allow(clippy::uninlined_format_args)]
|
184 - | fn uri_base(
|
185 - | _input: &crate::operation::write_records::WriteRecordsInput,
|
186 - | output: &mut ::std::string::String,
|
187 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
188 - | use ::std::fmt::Write as _;
|
189 - | ::std::write!(output, "/").expect("formatting should succeed");
|
190 - | ::std::result::Result::Ok(())
|
191 - | }
|
192 - | #[allow(clippy::unnecessary_wraps)]
|
193 - | fn update_http_builder(
|
194 - | input: &crate::operation::write_records::WriteRecordsInput,
|
195 - | builder: ::http_1x::request::Builder,
|
196 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
197 - | let mut uri = ::std::string::String::new();
|
198 - | uri_base(input, &mut uri)?;
|
199 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
200 - | }
|
201 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
202 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
|
203 - | builder = _header_serialization_settings.set_default_header(
|
204 - | builder,
|
205 - | ::http_1x::header::HeaderName::from_static("x-amz-target"),
|
206 - | "Timestream_20181101.WriteRecords",
|
207 - | );
|
208 - | builder
|
209 - | };
|
210 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_write_records::ser_write_records_input(&input)?);
|
211 - | if let Some(content_length) = body.content_length() {
|
212 - | let content_length = content_length.to_string();
|
213 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
214 - | }
|
215 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
377 + | let protocol = _cfg
|
378 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
379 + | .expect("a SharedClientProtocol is required");
|
380 + | let mut request = protocol
|
381 + | .serialize_request(&input, WriteRecords::INPUT_SCHEMA, "", _cfg)
|
382 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
383 + |
|
384 + | return ::std::result::Result::Ok(request);
|
216 385 | }
|
217 386 | }
|
218 387 | #[derive(Debug)]
|
219 388 | struct WriteRecordsEndpointParamsInterceptor;
|
220 389 |
|
221 390 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for WriteRecordsEndpointParamsInterceptor {
|
222 391 | fn name(&self) -> &'static str {
|
223 392 | "WriteRecordsEndpointParamsInterceptor"
|
224 393 | }
|
225 394 |
|