138 142 | ::std::borrow::Cow::Owned(rcb)
|
139 143 | }
|
140 144 | }
|
141 145 |
|
142 146 | #[derive(Debug)]
|
143 147 | struct CreateBackupResponseDeserializer;
|
144 148 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateBackupResponseDeserializer {
|
145 149 | fn deserialize_nonstreaming(
|
146 150 | &self,
|
147 151 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
152 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
148 153 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
149 154 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
150 - | let headers = response.headers();
|
151 - | let body = response.body().bytes().expect("body loaded");
|
152 155 | #[allow(unused_mut)]
|
153 156 | let mut force_error = false;
|
154 157 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
155 - | let parse_result = if !success && status != 200 || force_error {
|
156 - | crate::protocol_serde::shape_create_backup::de_create_backup_http_error(status, headers, body)
|
157 - | } else {
|
158 - | crate::protocol_serde::shape_create_backup::de_create_backup_http_response(status, headers, body)
|
158 + | if !success && status != 200 || force_error {
|
159 + | let headers = response.headers();
|
160 + | let body = response.body().bytes().expect("body loaded");
|
161 + | #[allow(unused_mut)]
|
162 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
163 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
164 + | })?;
|
165 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
166 + | let generic = generic_builder.build();
|
167 + | let error_code = match generic.code() {
|
168 + | ::std::option::Option::Some(code) => code,
|
169 + | ::std::option::Option::None => {
|
170 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
171 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::create_backup::CreateBackupError::unhandled(generic)),
|
172 + | ))
|
173 + | }
|
174 + | };
|
175 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
176 + | let protocol = _cfg
|
177 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
178 + | .expect("a SharedClientProtocol is required");
|
179 + | let err = match error_code {
|
180 + | "BackupInUseException" => crate::operation::create_backup::CreateBackupError::BackupInUseException({
|
181 + | let mut tmp = match protocol
|
182 + | .deserialize_response(response, crate::types::error::BackupInUseException::SCHEMA, _cfg)
|
183 + | .and_then(|mut deser| {
|
184 + | crate::types::error::BackupInUseException::deserialize_with_response(
|
185 + | &mut *deser,
|
186 + | response.headers(),
|
187 + | response.status().into(),
|
188 + | body,
|
189 + | )
|
190 + | }) {
|
191 + | ::std::result::Result::Ok(val) => val,
|
192 + | ::std::result::Result::Err(e) => {
|
193 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
194 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
195 + | ))
|
196 + | }
|
197 + | };
|
198 + | tmp.meta = generic;
|
199 + | if tmp.message.is_none() {
|
200 + | tmp.message = _error_message;
|
201 + | }
|
202 + | tmp
|
203 + | }),
|
204 + | "ContinuousBackupsUnavailableException" => {
|
205 + | crate::operation::create_backup::CreateBackupError::ContinuousBackupsUnavailableException({
|
206 + | let mut tmp = match protocol
|
207 + | .deserialize_response(response, crate::types::error::ContinuousBackupsUnavailableException::SCHEMA, _cfg)
|
208 + | .and_then(|mut deser| {
|
209 + | crate::types::error::ContinuousBackupsUnavailableException::deserialize_with_response(
|
210 + | &mut *deser,
|
211 + | response.headers(),
|
212 + | response.status().into(),
|
213 + | body,
|
214 + | )
|
215 + | }) {
|
216 + | ::std::result::Result::Ok(val) => val,
|
217 + | ::std::result::Result::Err(e) => {
|
218 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
219 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
220 + | ))
|
221 + | }
|
222 + | };
|
223 + | tmp.meta = generic;
|
224 + | if tmp.message.is_none() {
|
225 + | tmp.message = _error_message;
|
226 + | }
|
227 + | tmp
|
228 + | })
|
229 + | }
|
230 + | "InternalServerError" => crate::operation::create_backup::CreateBackupError::InternalServerError({
|
231 + | let mut tmp = match protocol
|
232 + | .deserialize_response(response, crate::types::error::InternalServerError::SCHEMA, _cfg)
|
233 + | .and_then(|mut deser| {
|
234 + | crate::types::error::InternalServerError::deserialize_with_response(
|
235 + | &mut *deser,
|
236 + | response.headers(),
|
237 + | response.status().into(),
|
238 + | body,
|
239 + | )
|
240 + | }) {
|
241 + | ::std::result::Result::Ok(val) => val,
|
242 + | ::std::result::Result::Err(e) => {
|
243 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
244 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
245 + | ))
|
246 + | }
|
159 247 | };
|
160 - | crate::protocol_serde::type_erase_result(parse_result)
|
248 + | tmp.meta = generic;
|
249 + | if tmp.message.is_none() {
|
250 + | tmp.message = _error_message;
|
251 + | }
|
252 + | tmp
|
253 + | }),
|
254 + | "InvalidEndpointException" => crate::operation::create_backup::CreateBackupError::InvalidEndpointException({
|
255 + | let mut tmp = match protocol
|
256 + | .deserialize_response(response, crate::types::error::InvalidEndpointException::SCHEMA, _cfg)
|
257 + | .and_then(|mut deser| {
|
258 + | crate::types::error::InvalidEndpointException::deserialize_with_response(
|
259 + | &mut *deser,
|
260 + | response.headers(),
|
261 + | response.status().into(),
|
262 + | body,
|
263 + | )
|
264 + | }) {
|
265 + | ::std::result::Result::Ok(val) => val,
|
266 + | ::std::result::Result::Err(e) => {
|
267 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
268 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
269 + | ))
|
270 + | }
|
271 + | };
|
272 + | tmp.meta = generic;
|
273 + | if tmp.message.is_none() {
|
274 + | tmp.message = _error_message;
|
275 + | }
|
276 + | tmp
|
277 + | }),
|
278 + | "LimitExceededException" => crate::operation::create_backup::CreateBackupError::LimitExceededException({
|
279 + | let mut tmp = match protocol
|
280 + | .deserialize_response(response, crate::types::error::LimitExceededException::SCHEMA, _cfg)
|
281 + | .and_then(|mut deser| {
|
282 + | crate::types::error::LimitExceededException::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 + | "TableInUseException" => crate::operation::create_backup::CreateBackupError::TableInUseException({
|
303 + | let mut tmp = match protocol
|
304 + | .deserialize_response(response, crate::types::error::TableInUseException::SCHEMA, _cfg)
|
305 + | .and_then(|mut deser| {
|
306 + | crate::types::error::TableInUseException::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 + | "TableNotFoundException" => crate::operation::create_backup::CreateBackupError::TableNotFoundException({
|
327 + | let mut tmp = match protocol
|
328 + | .deserialize_response(response, crate::types::error::TableNotFoundException::SCHEMA, _cfg)
|
329 + | .and_then(|mut deser| {
|
330 + | crate::types::error::TableNotFoundException::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 + | _ => crate::operation::create_backup::CreateBackupError::generic(generic),
|
351 + | };
|
352 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
353 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
354 + | ))
|
355 + | } else {
|
356 + | let protocol = _cfg
|
357 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
358 + | .expect("a SharedClientProtocol is required");
|
359 + | let mut deser = protocol.deserialize_response(response, CreateBackup::OUTPUT_SCHEMA, _cfg).map_err(|e| {
|
360 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
361 + | })?;
|
362 + | let body = response.body().bytes().expect("body loaded");
|
363 + | let output = crate::operation::create_backup::CreateBackupOutput::deserialize_with_response(
|
364 + | &mut *deser,
|
365 + | response.headers(),
|
366 + | response.status().into(),
|
367 + | body,
|
368 + | )
|
369 + | .map_err(|e| {
|
370 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
371 + | })?;
|
372 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
373 + | }
|
161 374 | }
|
162 375 | }
|
163 376 | #[derive(Debug)]
|
164 377 | struct CreateBackupRequestSerializer;
|
165 378 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateBackupRequestSerializer {
|
166 379 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
167 380 | fn serialize_input(
|
168 381 | &self,
|
169 382 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
170 383 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
171 384 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
172 385 | let input = input
|
173 386 | .downcast::<crate::operation::create_backup::CreateBackupInput>()
|
174 387 | .expect("correct type");
|
175 - | let _header_serialization_settings = _cfg
|
176 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
177 - | .cloned()
|
178 - | .unwrap_or_default();
|
179 - | let mut request_builder = {
|
180 - | #[allow(clippy::uninlined_format_args)]
|
181 - | fn uri_base(
|
182 - | _input: &crate::operation::create_backup::CreateBackupInput,
|
183 - | output: &mut ::std::string::String,
|
184 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
185 - | use ::std::fmt::Write as _;
|
186 - | ::std::write!(output, "/").expect("formatting should succeed");
|
187 - | ::std::result::Result::Ok(())
|
188 - | }
|
189 - | #[allow(clippy::unnecessary_wraps)]
|
190 - | fn update_http_builder(
|
191 - | input: &crate::operation::create_backup::CreateBackupInput,
|
192 - | builder: ::http_1x::request::Builder,
|
193 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
194 - | let mut uri = ::std::string::String::new();
|
195 - | uri_base(input, &mut uri)?;
|
196 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
197 - | }
|
198 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
199 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
|
200 - | builder = _header_serialization_settings.set_default_header(
|
201 - | builder,
|
202 - | ::http_1x::header::HeaderName::from_static("x-amz-target"),
|
203 - | "DynamoDB_20120810.CreateBackup",
|
204 - | );
|
205 - | builder
|
206 - | };
|
207 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_backup::ser_create_backup_input(&input)?);
|
208 - | if let Some(content_length) = body.content_length() {
|
209 - | let content_length = content_length.to_string();
|
210 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
211 - | }
|
212 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
388 + | let protocol = _cfg
|
389 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
390 + | .expect("a SharedClientProtocol is required");
|
391 + | let mut request = protocol
|
392 + | .serialize_request(&input, CreateBackup::INPUT_SCHEMA, "", _cfg)
|
393 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
394 + |
|
395 + | return ::std::result::Result::Ok(request);
|
213 396 | }
|
214 397 | }
|
215 398 | #[derive(Debug)]
|
216 399 | struct CreateBackupEndpointParamsInterceptor;
|
217 400 |
|
218 401 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateBackupEndpointParamsInterceptor {
|
219 402 | fn name(&self) -> &'static str {
|
220 403 | "CreateBackupEndpointParamsInterceptor"
|
221 404 | }
|
222 405 |
|