1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_restore_table_to_point_in_time_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<
|
8 - | crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeOutput,
|
9 - | crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError,
|
10 - | > {
|
11 - | #[allow(unused_mut)]
|
12 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
13 - | .map_err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled)?;
|
14 - | let generic = generic_builder.build();
|
15 - | let error_code = match generic.code() {
|
16 - | Some(code) => code,
|
17 - | None => return Err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled(generic)),
|
18 - | };
|
19 - |
|
20 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
21 - | Err(match error_code {
|
22 - | "InternalServerError" => crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::InternalServerError({
|
23 - | #[allow(unused_mut)]
|
24 - | let mut tmp = {
|
25 - | #[allow(unused_mut)]
|
26 - | let mut output = crate::types::error::builders::InternalServerErrorBuilder::default();
|
27 - | output = crate::protocol_serde::shape_internal_server_error::de_internal_server_error_json_err(_response_body, output)
|
28 - | .map_err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled)?;
|
29 - | let output = output.meta(generic);
|
30 - | output.build()
|
31 - | };
|
32 - | if tmp.message.is_none() {
|
33 - | tmp.message = _error_message;
|
34 - | }
|
35 - | tmp
|
36 - | }),
|
37 - | "InvalidEndpointException" => crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::InvalidEndpointError({
|
38 - | #[allow(unused_mut)]
|
39 - | let mut tmp = {
|
40 - | #[allow(unused_mut)]
|
41 - | let mut output = crate::types::error::builders::InvalidEndpointErrorBuilder::default();
|
42 - | output = crate::protocol_serde::shape_invalid_endpoint_exception::de_invalid_endpoint_exception_json_err(_response_body, output)
|
43 - | .map_err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled)?;
|
44 - | let output = output.meta(generic);
|
45 - | output.build()
|
46 - | };
|
47 - | if tmp.message.is_none() {
|
48 - | tmp.message = _error_message;
|
49 - | }
|
50 - | tmp
|
51 - | }),
|
52 - | "InvalidRestoreTimeException" => crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::InvalidRestoreTimeError({
|
53 - | #[allow(unused_mut)]
|
54 - | let mut tmp = {
|
55 - | #[allow(unused_mut)]
|
56 - | let mut output = crate::types::error::builders::InvalidRestoreTimeErrorBuilder::default();
|
57 - | output =
|
58 - | crate::protocol_serde::shape_invalid_restore_time_exception::de_invalid_restore_time_exception_json_err(_response_body, output)
|
59 - | .map_err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled)?;
|
60 - | let output = output.meta(generic);
|
61 - | output.build()
|
62 - | };
|
63 - | if tmp.message.is_none() {
|
64 - | tmp.message = _error_message;
|
65 - | }
|
66 - | tmp
|
67 - | }),
|
68 - | "LimitExceededException" => crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::LimitExceededError({
|
69 - | #[allow(unused_mut)]
|
70 - | let mut tmp = {
|
71 - | #[allow(unused_mut)]
|
72 - | let mut output = crate::types::error::builders::LimitExceededErrorBuilder::default();
|
73 - | output = crate::protocol_serde::shape_limit_exceeded_exception::de_limit_exceeded_exception_json_err(_response_body, output)
|
74 - | .map_err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled)?;
|
75 - | let output = output.meta(generic);
|
76 - | output.build()
|
77 - | };
|
78 - | if tmp.message.is_none() {
|
79 - | tmp.message = _error_message;
|
80 - | }
|
81 - | tmp
|
82 - | }),
|
83 - | "PointInTimeRecoveryUnavailableException" => {
|
84 - | crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::PointInTimeRecoveryUnavailableError({
|
85 - | #[allow(unused_mut)]
|
86 - | let mut tmp = {
|
87 - | #[allow(unused_mut)]
|
88 - | let mut output = crate::types::error::builders::PointInTimeRecoveryUnavailableErrorBuilder::default();
|
89 - | output = crate::protocol_serde::shape_point_in_time_recovery_unavailable_exception::de_point_in_time_recovery_unavailable_exception_json_err(_response_body, output).map_err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled)?;
|
90 - | let output = output.meta(generic);
|
91 - | output.build()
|
92 - | };
|
93 - | if tmp.message.is_none() {
|
94 - | tmp.message = _error_message;
|
95 - | }
|
96 - | tmp
|
97 - | })
|
98 - | }
|
99 - | "TableAlreadyExistsException" => crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::TableAlreadyExistsError({
|
100 - | #[allow(unused_mut)]
|
101 - | let mut tmp = {
|
102 - | #[allow(unused_mut)]
|
103 - | let mut output = crate::types::error::builders::TableAlreadyExistsErrorBuilder::default();
|
104 - | output =
|
105 - | crate::protocol_serde::shape_table_already_exists_exception::de_table_already_exists_exception_json_err(_response_body, output)
|
106 - | .map_err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled)?;
|
107 - | let output = output.meta(generic);
|
108 - | output.build()
|
109 - | };
|
110 - | if tmp.message.is_none() {
|
111 - | tmp.message = _error_message;
|
112 - | }
|
113 - | tmp
|
114 - | }),
|
115 - | "TableInUseException" => crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::TableInUseError({
|
116 - | #[allow(unused_mut)]
|
117 - | let mut tmp = {
|
118 - | #[allow(unused_mut)]
|
119 - | let mut output = crate::types::error::builders::TableInUseErrorBuilder::default();
|
120 - | output = crate::protocol_serde::shape_table_in_use_exception::de_table_in_use_exception_json_err(_response_body, output)
|
121 - | .map_err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled)?;
|
122 - | let output = output.meta(generic);
|
123 - | output.build()
|
124 - | };
|
125 - | if tmp.message.is_none() {
|
126 - | tmp.message = _error_message;
|
127 - | }
|
128 - | tmp
|
129 - | }),
|
130 - | "TableNotFoundException" => crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::TableNotFoundError({
|
131 - | #[allow(unused_mut)]
|
132 - | let mut tmp = {
|
133 - | #[allow(unused_mut)]
|
134 - | let mut output = crate::types::error::builders::TableNotFoundErrorBuilder::default();
|
135 - | output = crate::protocol_serde::shape_table_not_found_exception::de_table_not_found_exception_json_err(_response_body, output)
|
136 - | .map_err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled)?;
|
137 - | let output = output.meta(generic);
|
138 - | output.build()
|
139 - | };
|
140 - | if tmp.message.is_none() {
|
141 - | tmp.message = _error_message;
|
142 - | }
|
143 - | tmp
|
144 - | }),
|
145 - | _ => crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::generic(generic),
|
146 - | })
|
147 - | }
|
148 - |
|
149 - | #[allow(clippy::unnecessary_wraps)]
|
150 - | pub fn de_restore_table_to_point_in_time_http_response(
|
151 - | _response_status: u16,
|
152 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
153 - | _response_body: &[u8],
|
154 - | ) -> std::result::Result<
|
155 - | crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeOutput,
|
156 - | crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError,
|
157 - | > {
|
158 - | Ok({
|
159 - | #[allow(unused_mut)]
|
160 - | let mut output = crate::operation::restore_table_to_point_in_time::builders::RestoreTableToPointInTimeOutputBuilder::default();
|
161 - | output = crate::protocol_serde::shape_restore_table_to_point_in_time::de_restore_table_to_point_in_time(_response_body, output)
|
162 - | .map_err(crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeError::unhandled)?;
|
163 - | output.build()
|
164 - | })
|
165 - | }
|
166 - |
|
167 - | pub fn ser_restore_table_to_point_in_time_input(
|
168 - | input: &crate::operation::restore_table_to_point_in_time::RestoreTableToPointInTimeInput,
|
169 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
170 - | let mut out = String::new();
|
171 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
172 - | crate::protocol_serde::shape_restore_table_to_point_in_time_input::ser_restore_table_to_point_in_time_input_input(&mut object, input)?;
|
173 - | object.finish();
|
174 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
175 - | }
|
176 - |
|
177 - | pub(crate) fn de_restore_table_to_point_in_time(
|
178 - | _value: &[u8],
|
179 - | mut builder: crate::operation::restore_table_to_point_in_time::builders::RestoreTableToPointInTimeOutputBuilder,
|
180 - | ) -> ::std::result::Result<
|
181 - | crate::operation::restore_table_to_point_in_time::builders::RestoreTableToPointInTimeOutputBuilder,
|
182 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
183 - | > {
|
184 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
185 - | let tokens = &mut tokens_owned;
|
186 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
187 - | loop {
|
188 - | match tokens.next().transpose()? {
|
189 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
190 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
191 - | "TableDescription" => {
|
192 - | builder = builder.set_table_description(crate::protocol_serde::shape_table_description::de_table_description(tokens, _value)?);
|
193 - | }
|
194 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
195 - | },
|
196 - | other => {
|
197 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
198 - | "expected object key or end object, found: {other:?}"
|
199 - | )))
|
200 - | }
|
201 - | }
|
202 - | }
|
203 - | if tokens.next().is_some() {
|
204 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
205 - | "found more JSON tokens after completing parsing",
|
206 - | ));
|
207 - | }
|
208 - | Ok(builder)
|
209 - | }
|