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