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