145 149 | ::std::borrow::Cow::Owned(rcb)
|
146 150 | }
|
147 151 | }
|
148 152 |
|
149 153 | #[derive(Debug)]
|
150 154 | struct ImportTableResponseDeserializer;
|
151 155 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ImportTableResponseDeserializer {
|
152 156 | fn deserialize_nonstreaming(
|
153 157 | &self,
|
154 158 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
159 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
155 160 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
156 161 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
157 - | let headers = response.headers();
|
158 - | let body = response.body().bytes().expect("body loaded");
|
159 162 | #[allow(unused_mut)]
|
160 163 | let mut force_error = false;
|
161 164 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
162 - | let parse_result = if !success && status != 200 || force_error {
|
163 - | crate::protocol_serde::shape_import_table::de_import_table_http_error(status, headers, body)
|
165 + | if !success && status != 200 || force_error {
|
166 + | let headers = response.headers();
|
167 + | let body = response.body().bytes().expect("body loaded");
|
168 + | #[allow(unused_mut)]
|
169 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
170 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
171 + | })?;
|
172 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
173 + | let generic = generic_builder.build();
|
174 + | let error_code = match generic.code() {
|
175 + | ::std::option::Option::Some(code) => code,
|
176 + | ::std::option::Option::None => {
|
177 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
178 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::import_table::ImportTableError::unhandled(generic)),
|
179 + | ))
|
180 + | }
|
181 + | };
|
182 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
183 + | let protocol = _cfg
|
184 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
185 + | .expect("a SharedClientProtocol is required");
|
186 + | let err = match error_code {
|
187 + | "ImportConflictException" => crate::operation::import_table::ImportTableError::ImportConflictException({
|
188 + | let mut tmp = match protocol
|
189 + | .deserialize_response(response, crate::types::error::ImportConflictException::SCHEMA, _cfg)
|
190 + | .and_then(|mut deser| {
|
191 + | crate::types::error::ImportConflictException::deserialize_with_response(
|
192 + | &mut *deser,
|
193 + | response.headers(),
|
194 + | response.status().into(),
|
195 + | body,
|
196 + | )
|
197 + | }) {
|
198 + | ::std::result::Result::Ok(val) => val,
|
199 + | ::std::result::Result::Err(e) => {
|
200 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
201 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
202 + | ))
|
203 + | }
|
204 + | };
|
205 + | tmp.meta = generic;
|
206 + | if tmp.message.is_none() {
|
207 + | tmp.message = _error_message;
|
208 + | }
|
209 + | tmp
|
210 + | }),
|
211 + | "LimitExceededException" => crate::operation::import_table::ImportTableError::LimitExceededException({
|
212 + | let mut tmp = match protocol
|
213 + | .deserialize_response(response, crate::types::error::LimitExceededException::SCHEMA, _cfg)
|
214 + | .and_then(|mut deser| {
|
215 + | crate::types::error::LimitExceededException::deserialize_with_response(
|
216 + | &mut *deser,
|
217 + | response.headers(),
|
218 + | response.status().into(),
|
219 + | body,
|
220 + | )
|
221 + | }) {
|
222 + | ::std::result::Result::Ok(val) => val,
|
223 + | ::std::result::Result::Err(e) => {
|
224 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
225 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
226 + | ))
|
227 + | }
|
228 + | };
|
229 + | tmp.meta = generic;
|
230 + | if tmp.message.is_none() {
|
231 + | tmp.message = _error_message;
|
232 + | }
|
233 + | tmp
|
234 + | }),
|
235 + | "ResourceInUseException" => crate::operation::import_table::ImportTableError::ResourceInUseException({
|
236 + | let mut tmp = match protocol
|
237 + | .deserialize_response(response, crate::types::error::ResourceInUseException::SCHEMA, _cfg)
|
238 + | .and_then(|mut deser| {
|
239 + | crate::types::error::ResourceInUseException::deserialize_with_response(
|
240 + | &mut *deser,
|
241 + | response.headers(),
|
242 + | response.status().into(),
|
243 + | body,
|
244 + | )
|
245 + | }) {
|
246 + | ::std::result::Result::Ok(val) => val,
|
247 + | ::std::result::Result::Err(e) => {
|
248 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
249 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
250 + | ))
|
251 + | }
|
252 + | };
|
253 + | tmp.meta = generic;
|
254 + | if tmp.message.is_none() {
|
255 + | tmp.message = _error_message;
|
256 + | }
|
257 + | tmp
|
258 + | }),
|
259 + | _ => crate::operation::import_table::ImportTableError::generic(generic),
|
260 + | };
|
261 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
262 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
263 + | ))
|
164 264 | } else {
|
165 - | crate::protocol_serde::shape_import_table::de_import_table_http_response(status, headers, body)
|
166 - | };
|
167 - | crate::protocol_serde::type_erase_result(parse_result)
|
265 + | let protocol = _cfg
|
266 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
267 + | .expect("a SharedClientProtocol is required");
|
268 + | let mut deser = protocol.deserialize_response(response, ImportTable::OUTPUT_SCHEMA, _cfg).map_err(|e| {
|
269 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
270 + | })?;
|
271 + | let body = response.body().bytes().expect("body loaded");
|
272 + | let output = crate::operation::import_table::ImportTableOutput::deserialize_with_response(
|
273 + | &mut *deser,
|
274 + | response.headers(),
|
275 + | response.status().into(),
|
276 + | body,
|
277 + | )
|
278 + | .map_err(|e| {
|
279 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
280 + | })?;
|
281 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
282 + | }
|
168 283 | }
|
169 284 | }
|
170 285 | #[derive(Debug)]
|
171 286 | struct ImportTableRequestSerializer;
|
172 287 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ImportTableRequestSerializer {
|
173 288 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
174 289 | fn serialize_input(
|
175 290 | &self,
|
176 291 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
177 292 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
178 293 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
179 294 | let input = input
|
180 295 | .downcast::<crate::operation::import_table::ImportTableInput>()
|
181 296 | .expect("correct type");
|
182 - | let _header_serialization_settings = _cfg
|
183 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
184 - | .cloned()
|
185 - | .unwrap_or_default();
|
186 - | let mut request_builder = {
|
187 - | #[allow(clippy::uninlined_format_args)]
|
188 - | fn uri_base(
|
189 - | _input: &crate::operation::import_table::ImportTableInput,
|
190 - | output: &mut ::std::string::String,
|
191 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
192 - | use ::std::fmt::Write as _;
|
193 - | ::std::write!(output, "/").expect("formatting should succeed");
|
194 - | ::std::result::Result::Ok(())
|
195 - | }
|
196 - | #[allow(clippy::unnecessary_wraps)]
|
197 - | fn update_http_builder(
|
198 - | input: &crate::operation::import_table::ImportTableInput,
|
199 - | builder: ::http_1x::request::Builder,
|
200 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
201 - | let mut uri = ::std::string::String::new();
|
202 - | uri_base(input, &mut uri)?;
|
203 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
204 - | }
|
205 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
206 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
|
207 - | builder = _header_serialization_settings.set_default_header(
|
208 - | builder,
|
209 - | ::http_1x::header::HeaderName::from_static("x-amz-target"),
|
210 - | "DynamoDB_20120810.ImportTable",
|
211 - | );
|
212 - | builder
|
213 - | };
|
214 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_import_table::ser_import_table_input(&input)?);
|
215 - | if let Some(content_length) = body.content_length() {
|
216 - | let content_length = content_length.to_string();
|
217 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
218 - | }
|
219 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
297 + | let protocol = _cfg
|
298 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
299 + | .expect("a SharedClientProtocol is required");
|
300 + | let mut request = protocol
|
301 + | .serialize_request(&input, ImportTable::INPUT_SCHEMA, "", _cfg)
|
302 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
303 + |
|
304 + | return ::std::result::Result::Ok(request);
|
220 305 | }
|
221 306 | }
|
222 307 | #[derive(Debug)]
|
223 308 | struct ImportTableEndpointParamsInterceptor;
|
224 309 |
|
225 310 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ImportTableEndpointParamsInterceptor {
|
226 311 | fn name(&self) -> &'static str {
|
227 312 | "ImportTableEndpointParamsInterceptor"
|
228 313 | }
|
229 314 |
|