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