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