1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_import_table_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::import_table::ImportTableOutput, crate::operation::import_table::ImportTableError> {
|
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::import_table::ImportTableError::unhandled)?;
|
11 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
12 - | let generic = generic_builder.build();
|
13 - | let error_code = match generic.code() {
|
14 - | Some(code) => code,
|
15 - | None => return Err(crate::operation::import_table::ImportTableError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "ImportConflictException" => crate::operation::import_table::ImportTableError::ImportConflictException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::ImportConflictExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_import_conflict_exception::de_import_conflict_exception_json_err(_response_body, output)
|
26 - | .map_err(crate::operation::import_table::ImportTableError::unhandled)?;
|
27 - | let output = output.meta(generic);
|
28 - | output.build()
|
29 - | };
|
30 - | if tmp.message.is_none() {
|
31 - | tmp.message = _error_message;
|
32 - | }
|
33 - | tmp
|
34 - | }),
|
35 - | "LimitExceededException" => crate::operation::import_table::ImportTableError::LimitExceededException({
|
36 - | #[allow(unused_mut)]
|
37 - | let mut tmp = {
|
38 - | #[allow(unused_mut)]
|
39 - | let mut output = crate::types::error::builders::LimitExceededExceptionBuilder::default();
|
40 - | output = crate::protocol_serde::shape_limit_exceeded_exception::de_limit_exceeded_exception_json_err(_response_body, output)
|
41 - | .map_err(crate::operation::import_table::ImportTableError::unhandled)?;
|
42 - | let output = output.meta(generic);
|
43 - | output.build()
|
44 - | };
|
45 - | if tmp.message.is_none() {
|
46 - | tmp.message = _error_message;
|
47 - | }
|
48 - | tmp
|
49 - | }),
|
50 - | "ResourceInUseException" => crate::operation::import_table::ImportTableError::ResourceInUseException({
|
51 - | #[allow(unused_mut)]
|
52 - | let mut tmp = {
|
53 - | #[allow(unused_mut)]
|
54 - | let mut output = crate::types::error::builders::ResourceInUseExceptionBuilder::default();
|
55 - | output = crate::protocol_serde::shape_resource_in_use_exception::de_resource_in_use_exception_json_err(_response_body, output)
|
56 - | .map_err(crate::operation::import_table::ImportTableError::unhandled)?;
|
57 - | let output = output.meta(generic);
|
58 - | output.build()
|
59 - | };
|
60 - | if tmp.message.is_none() {
|
61 - | tmp.message = _error_message;
|
62 - | }
|
63 - | tmp
|
64 - | }),
|
65 - | _ => crate::operation::import_table::ImportTableError::generic(generic),
|
66 - | })
|
67 - | }
|
68 - |
|
69 - | #[allow(clippy::unnecessary_wraps)]
|
70 - | pub fn de_import_table_http_response(
|
71 - | _response_status: u16,
|
72 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
73 - | _response_body: &[u8],
|
74 - | ) -> std::result::Result<crate::operation::import_table::ImportTableOutput, crate::operation::import_table::ImportTableError> {
|
75 - | Ok({
|
76 - | #[allow(unused_mut)]
|
77 - | let mut output = crate::operation::import_table::builders::ImportTableOutputBuilder::default();
|
78 - | output = crate::protocol_serde::shape_import_table::de_import_table(_response_body, output)
|
79 - | .map_err(crate::operation::import_table::ImportTableError::unhandled)?;
|
80 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
81 - | crate::serde_util::import_table_output_output_correct_errors(output).build()
|
82 - | })
|
83 - | }
|
84 - |
|
85 - | pub fn ser_import_table_input(
|
86 - | input: &crate::operation::import_table::ImportTableInput,
|
87 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
88 - | let mut out = String::new();
|
89 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
90 - | crate::protocol_serde::shape_import_table_input::ser_import_table_input_input(&mut object, input)?;
|
91 - | object.finish();
|
92 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
93 - | }
|
94 - |
|
95 - | pub(crate) fn de_import_table(
|
96 - | _value: &[u8],
|
97 - | mut builder: crate::operation::import_table::builders::ImportTableOutputBuilder,
|
98 - | ) -> ::std::result::Result<crate::operation::import_table::builders::ImportTableOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError>
|
99 - | {
|
100 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
101 - | let tokens = &mut tokens_owned;
|
102 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
103 - | loop {
|
104 - | match tokens.next().transpose()? {
|
105 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
106 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
107 - | "ImportTableDescription" => {
|
108 - | builder = builder.set_import_table_description(
|
109 - | crate::protocol_serde::shape_import_table_description::de_import_table_description(tokens, _value)?,
|
110 - | );
|
111 - | }
|
112 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
113 - | },
|
114 - | other => {
|
115 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
116 - | "expected object key or end object, found: {other:?}"
|
117 - | )))
|
118 - | }
|
119 - | }
|
120 - | }
|
121 - | if tokens.next().is_some() {
|
122 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
123 - | "found more JSON tokens after completing parsing",
|
124 - | ));
|
125 - | }
|
126 - | Ok(builder)
|
127 - | }
|