1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_batch_write_item_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::batch_write_item::BatchWriteItemOutput, crate::operation::batch_write_item::BatchWriteItemError> {
|
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::batch_write_item::BatchWriteItemError::unhandled)?;
|
11 - | let generic = generic_builder.build();
|
12 - | let error_code = match generic.code() {
|
13 - | Some(code) => code,
|
14 - | None => return Err(crate::operation::batch_write_item::BatchWriteItemError::unhandled(generic)),
|
15 - | };
|
16 - |
|
17 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
18 - | Err(match error_code {
|
19 - | "InternalServerError" => crate::operation::batch_write_item::BatchWriteItemError::InternalServerError({
|
20 - | #[allow(unused_mut)]
|
21 - | let mut tmp = {
|
22 - | #[allow(unused_mut)]
|
23 - | let mut output = crate::types::error::builders::InternalServerErrorBuilder::default();
|
24 - | output = crate::protocol_serde::shape_internal_server_error::de_internal_server_error_json_err(_response_body, output)
|
25 - | .map_err(crate::operation::batch_write_item::BatchWriteItemError::unhandled)?;
|
26 - | let output = output.meta(generic);
|
27 - | output.build()
|
28 - | };
|
29 - | if tmp.message.is_none() {
|
30 - | tmp.message = _error_message;
|
31 - | }
|
32 - | tmp
|
33 - | }),
|
34 - | "InvalidEndpointException" => crate::operation::batch_write_item::BatchWriteItemError::InvalidEndpointError({
|
35 - | #[allow(unused_mut)]
|
36 - | let mut tmp = {
|
37 - | #[allow(unused_mut)]
|
38 - | let mut output = crate::types::error::builders::InvalidEndpointErrorBuilder::default();
|
39 - | output = crate::protocol_serde::shape_invalid_endpoint_exception::de_invalid_endpoint_exception_json_err(_response_body, output)
|
40 - | .map_err(crate::operation::batch_write_item::BatchWriteItemError::unhandled)?;
|
41 - | let output = output.meta(generic);
|
42 - | output.build()
|
43 - | };
|
44 - | if tmp.message.is_none() {
|
45 - | tmp.message = _error_message;
|
46 - | }
|
47 - | tmp
|
48 - | }),
|
49 - | "ItemCollectionSizeLimitExceededException" => {
|
50 - | crate::operation::batch_write_item::BatchWriteItemError::ItemCollectionSizeLimitExceededError({
|
51 - | #[allow(unused_mut)]
|
52 - | let mut tmp = {
|
53 - | #[allow(unused_mut)]
|
54 - | let mut output = crate::types::error::builders::ItemCollectionSizeLimitExceededErrorBuilder::default();
|
55 - | output = crate::protocol_serde::shape_item_collection_size_limit_exceeded_exception::de_item_collection_size_limit_exceeded_exception_json_err(_response_body, output).map_err(crate::operation::batch_write_item::BatchWriteItemError::unhandled)?;
|
56 - | let output = output.meta(generic);
|
57 - | output.build()
|
58 - | };
|
59 - | if tmp.message.is_none() {
|
60 - | tmp.message = _error_message;
|
61 - | }
|
62 - | tmp
|
63 - | })
|
64 - | }
|
65 - | "ProvisionedThroughputExceededException" => {
|
66 - | crate::operation::batch_write_item::BatchWriteItemError::ProvisionedThroughputExceededError({
|
67 - | #[allow(unused_mut)]
|
68 - | let mut tmp = {
|
69 - | #[allow(unused_mut)]
|
70 - | let mut output = crate::types::error::builders::ProvisionedThroughputExceededErrorBuilder::default();
|
71 - | output = crate::protocol_serde::shape_provisioned_throughput_exceeded_exception::de_provisioned_throughput_exceeded_exception_json_err(_response_body, output).map_err(crate::operation::batch_write_item::BatchWriteItemError::unhandled)?;
|
72 - | let output = output.meta(generic);
|
73 - | output.build()
|
74 - | };
|
75 - | if tmp.message.is_none() {
|
76 - | tmp.message = _error_message;
|
77 - | }
|
78 - | tmp
|
79 - | })
|
80 - | }
|
81 - | "RequestLimitExceeded" => crate::operation::batch_write_item::BatchWriteItemError::RequestLimitExceeded({
|
82 - | #[allow(unused_mut)]
|
83 - | let mut tmp = {
|
84 - | #[allow(unused_mut)]
|
85 - | let mut output = crate::types::error::builders::RequestLimitExceededBuilder::default();
|
86 - | output = crate::protocol_serde::shape_request_limit_exceeded::de_request_limit_exceeded_json_err(_response_body, output)
|
87 - | .map_err(crate::operation::batch_write_item::BatchWriteItemError::unhandled)?;
|
88 - | let output = output.meta(generic);
|
89 - | output.build()
|
90 - | };
|
91 - | if tmp.message.is_none() {
|
92 - | tmp.message = _error_message;
|
93 - | }
|
94 - | tmp
|
95 - | }),
|
96 - | "ResourceNotFoundException" => crate::operation::batch_write_item::BatchWriteItemError::ResourceNotFoundError({
|
97 - | #[allow(unused_mut)]
|
98 - | let mut tmp = {
|
99 - | #[allow(unused_mut)]
|
100 - | let mut output = crate::types::error::builders::ResourceNotFoundErrorBuilder::default();
|
101 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
102 - | .map_err(crate::operation::batch_write_item::BatchWriteItemError::unhandled)?;
|
103 - | let output = output.meta(generic);
|
104 - | output.build()
|
105 - | };
|
106 - | if tmp.message.is_none() {
|
107 - | tmp.message = _error_message;
|
108 - | }
|
109 - | tmp
|
110 - | }),
|
111 - | _ => crate::operation::batch_write_item::BatchWriteItemError::generic(generic),
|
112 - | })
|
113 - | }
|
114 - |
|
115 - | #[allow(clippy::unnecessary_wraps)]
|
116 - | pub fn de_batch_write_item_http_response(
|
117 - | _response_status: u16,
|
118 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
119 - | _response_body: &[u8],
|
120 - | ) -> std::result::Result<crate::operation::batch_write_item::BatchWriteItemOutput, crate::operation::batch_write_item::BatchWriteItemError> {
|
121 - | Ok({
|
122 - | #[allow(unused_mut)]
|
123 - | let mut output = crate::operation::batch_write_item::builders::BatchWriteItemOutputBuilder::default();
|
124 - | output = crate::protocol_serde::shape_batch_write_item::de_batch_write_item(_response_body, output)
|
125 - | .map_err(crate::operation::batch_write_item::BatchWriteItemError::unhandled)?;
|
126 - | output.build()
|
127 - | })
|
128 - | }
|
129 - |
|
130 - | pub fn ser_batch_write_item_input(
|
131 - | input: &crate::operation::batch_write_item::BatchWriteItemInput,
|
132 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
133 - | let mut out = String::new();
|
134 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
135 - | crate::protocol_serde::shape_batch_write_item_input::ser_batch_write_item_input_input(&mut object, input)?;
|
136 - | object.finish();
|
137 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
138 - | }
|
139 - |
|
140 - | pub(crate) fn de_batch_write_item(
|
141 - | _value: &[u8],
|
142 - | mut builder: crate::operation::batch_write_item::builders::BatchWriteItemOutputBuilder,
|
143 - | ) -> ::std::result::Result<
|
144 - | crate::operation::batch_write_item::builders::BatchWriteItemOutputBuilder,
|
145 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
146 - | > {
|
147 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
148 - | let tokens = &mut tokens_owned;
|
149 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
150 - | loop {
|
151 - | match tokens.next().transpose()? {
|
152 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
153 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
154 - | "UnprocessedItems" => {
|
155 - | builder = builder.set_unprocessed_items(
|
156 - | crate::protocol_serde::shape_batch_write_item_request_map::de_batch_write_item_request_map(tokens, _value)?,
|
157 - | );
|
158 - | }
|
159 - | "ItemCollectionMetrics" => {
|
160 - | builder = builder.set_item_collection_metrics(
|
161 - | crate::protocol_serde::shape_item_collection_metrics_per_table::de_item_collection_metrics_per_table(tokens, _value)?,
|
162 - | );
|
163 - | }
|
164 - | "ConsumedCapacity" => {
|
165 - | builder = builder.set_consumed_capacity(crate::protocol_serde::shape_consumed_capacity_multiple::de_consumed_capacity_multiple(
|
166 - | tokens, _value,
|
167 - | )?);
|
168 - | }
|
169 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
170 - | },
|
171 - | other => {
|
172 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
173 - | "expected object key or end object, found: {other:?}"
|
174 - | )))
|
175 - | }
|
176 - | }
|
177 - | }
|
178 - | if tokens.next().is_some() {
|
179 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
180 - | "found more JSON tokens after completing parsing",
|
181 - | ));
|
182 - | }
|
183 - | Ok(builder)
|
184 - | }
|