1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[allow(clippy::unnecessary_wraps)]
|
3 + | pub async fn de_start_snapshot_http_request<B>(
|
4 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 + | ) -> std::result::Result<
|
6 + | crate::input::StartSnapshotInput,
|
7 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
8 + | >
|
9 + | where
|
10 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
11 + | B::Data: Send,
|
12 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
14 + | {
|
15 + | Ok({
|
16 + | #[allow(unused_mut)]
|
17 + | let mut input = crate::input::start_snapshot_input::Builder::default();
|
18 + | #[allow(unused_variables)]
|
19 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
20 + | uri, headers, body, ..
|
21 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
22 + | let bytes = ::hyper::body::to_bytes(body).await?;
|
23 + | if !bytes.is_empty() {
|
24 + | ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
|
25 + | &headers,
|
26 + | Some("application/json"),
|
27 + | )?;
|
28 + | input = crate::protocol_serde::shape_start_snapshot::de_start_snapshot(
|
29 + | bytes.as_ref(),
|
30 + | input,
|
31 + | )?;
|
32 + | }
|
33 + | input.build()?
|
34 + | })
|
35 + | }
|
36 + |
|
37 + | #[allow(clippy::unnecessary_wraps)]
|
38 + | pub fn ser_start_snapshot_http_response(
|
39 + | #[allow(unused_variables)] output: crate::output::StartSnapshotOutput,
|
40 + | ) -> std::result::Result<
|
41 + | ::aws_smithy_legacy_http_server::response::Response,
|
42 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
43 + | > {
|
44 + | Ok({
|
45 + | #[allow(unused_mut)]
|
46 + | let mut builder = ::http::Response::builder();
|
47 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
48 + | builder,
|
49 + | ::http::header::CONTENT_TYPE,
|
50 + | "application/json",
|
51 + | );
|
52 + | let http_status: u16 = 201;
|
53 + | builder = builder.status(http_status);
|
54 + | let payload =
|
55 + | crate::protocol_serde::shape_start_snapshot_output::ser_start_snapshot_output_output_output(&output)?
|
56 + | ;
|
57 + | let content_length = payload.len();
|
58 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
59 + | builder,
|
60 + | ::http::header::CONTENT_LENGTH,
|
61 + | content_length,
|
62 + | );
|
63 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
64 + | builder.body(body)?
|
65 + | })
|
66 + | }
|
67 + |
|
68 + | #[allow(clippy::unnecessary_wraps)]
|
69 + | pub fn ser_start_snapshot_http_error(
|
70 + | error: &crate::error::StartSnapshotError,
|
71 + | ) -> std::result::Result<
|
72 + | ::aws_smithy_legacy_http_server::response::Response,
|
73 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
74 + | > {
|
75 + | Ok({
|
76 + | match error {
|
77 + | crate::error::StartSnapshotError::InternalServerException(output) => {
|
78 + | let payload = crate::protocol_serde::shape_internal_server_exception::ser_internal_server_exception_error(output)?;
|
79 + | #[allow(unused_mut)]
|
80 + | let mut builder = ::http::Response::builder();
|
81 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
82 + | builder,
|
83 + | ::http::header::CONTENT_TYPE,
|
84 + | "application/json",
|
85 + | );
|
86 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
87 + | builder,
|
88 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
89 + | "InternalServerException",
|
90 + | );
|
91 + | let content_length = payload.len();
|
92 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
93 + | builder,
|
94 + | ::http::header::CONTENT_LENGTH,
|
95 + | content_length,
|
96 + | );
|
97 + | builder
|
98 + | .status(500)
|
99 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
100 + | }
|
101 + | crate::error::StartSnapshotError::ResourceNotFoundException(output) => {
|
102 + | let payload = crate::protocol_serde::shape_resource_not_found_exception::ser_resource_not_found_exception_error(output)?;
|
103 + | #[allow(unused_mut)]
|
104 + | let mut builder = ::http::Response::builder();
|
105 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
106 + | builder,
|
107 + | ::http::header::CONTENT_TYPE,
|
108 + | "application/json",
|
109 + | );
|
110 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
111 + | builder,
|
112 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
113 + | "ResourceNotFoundException",
|
114 + | );
|
115 + | let content_length = payload.len();
|
116 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
117 + | builder,
|
118 + | ::http::header::CONTENT_LENGTH,
|
119 + | content_length,
|
120 + | );
|
121 + | builder
|
122 + | .status(404)
|
123 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
124 + | }
|
125 + | crate::error::StartSnapshotError::AccessDeniedException(output) => {
|
126 + | let payload = crate::protocol_serde::shape_access_denied_exception::ser_access_denied_exception_error(output)?;
|
127 + | #[allow(unused_mut)]
|
128 + | let mut builder = ::http::Response::builder();
|
129 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
130 + | builder,
|
131 + | ::http::header::CONTENT_TYPE,
|
132 + | "application/json",
|
133 + | );
|
134 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
135 + | builder,
|
136 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
137 + | "AccessDeniedException",
|
138 + | );
|
139 + | let content_length = payload.len();
|
140 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
141 + | builder,
|
142 + | ::http::header::CONTENT_LENGTH,
|
143 + | content_length,
|
144 + | );
|
145 + | builder
|
146 + | .status(403)
|
147 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
148 + | }
|
149 + | crate::error::StartSnapshotError::ConflictException(output) => {
|
150 + | let payload =
|
151 + | crate::protocol_serde::shape_conflict_exception::ser_conflict_exception_error(
|
152 + | output,
|
153 + | )?;
|
154 + | #[allow(unused_mut)]
|
155 + | let mut builder = ::http::Response::builder();
|
156 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
157 + | builder,
|
158 + | ::http::header::CONTENT_TYPE,
|
159 + | "application/json",
|
160 + | );
|
161 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
162 + | builder,
|
163 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
164 + | "ConflictException",
|
165 + | );
|
166 + | let content_length = payload.len();
|
167 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
168 + | builder,
|
169 + | ::http::header::CONTENT_LENGTH,
|
170 + | content_length,
|
171 + | );
|
172 + | builder
|
173 + | .status(503)
|
174 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
175 + | }
|
176 + | crate::error::StartSnapshotError::RequestThrottledException(output) => {
|
177 + | let payload = crate::protocol_serde::shape_request_throttled_exception::ser_request_throttled_exception_error(output)?;
|
178 + | #[allow(unused_mut)]
|
179 + | let mut builder = ::http::Response::builder();
|
180 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
181 + | builder,
|
182 + | ::http::header::CONTENT_TYPE,
|
183 + | "application/json",
|
184 + | );
|
185 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
186 + | builder,
|
187 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
188 + | "RequestThrottledException",
|
189 + | );
|
190 + | let content_length = payload.len();
|
191 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
192 + | builder,
|
193 + | ::http::header::CONTENT_LENGTH,
|
194 + | content_length,
|
195 + | );
|
196 + | builder
|
197 + | .status(400)
|
198 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
199 + | }
|
200 + | crate::error::StartSnapshotError::ServiceQuotaExceededException(output) => {
|
201 + | let payload = crate::protocol_serde::shape_service_quota_exceeded_exception::ser_service_quota_exceeded_exception_error(output)?;
|
202 + | #[allow(unused_mut)]
|
203 + | let mut builder = ::http::Response::builder();
|
204 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
205 + | builder,
|
206 + | ::http::header::CONTENT_TYPE,
|
207 + | "application/json",
|
208 + | );
|
209 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
210 + | builder,
|
211 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
212 + | "ServiceQuotaExceededException",
|
213 + | );
|
214 + | let content_length = payload.len();
|
215 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
216 + | builder,
|
217 + | ::http::header::CONTENT_LENGTH,
|
218 + | content_length,
|
219 + | );
|
220 + | builder
|
221 + | .status(402)
|
222 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
223 + | }
|
224 + | crate::error::StartSnapshotError::ConcurrentLimitExceededException(output) => {
|
225 + | let payload = crate::protocol_serde::shape_concurrent_limit_exceeded_exception::ser_concurrent_limit_exceeded_exception_error(output)?;
|
226 + | #[allow(unused_mut)]
|
227 + | let mut builder = ::http::Response::builder();
|
228 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
229 + | builder,
|
230 + | ::http::header::CONTENT_TYPE,
|
231 + | "application/json",
|
232 + | );
|
233 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
234 + | builder,
|
235 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
236 + | "ConcurrentLimitExceededException",
|
237 + | );
|
238 + | let content_length = payload.len();
|
239 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
240 + | builder,
|
241 + | ::http::header::CONTENT_LENGTH,
|
242 + | content_length,
|
243 + | );
|
244 + | builder
|
245 + | .status(400)
|
246 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
247 + | }
|
248 + | crate::error::StartSnapshotError::ValidationException(output) => {
|
249 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
250 + | #[allow(unused_mut)]
|
251 + | let mut builder = ::http::Response::builder();
|
252 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
253 + | builder,
|
254 + | ::http::header::CONTENT_TYPE,
|
255 + | "application/json",
|
256 + | );
|
257 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
258 + | builder,
|
259 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
260 + | "ValidationException",
|
261 + | );
|
262 + | let content_length = payload.len();
|
263 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
264 + | builder,
|
265 + | ::http::header::CONTENT_LENGTH,
|
266 + | content_length,
|
267 + | );
|
268 + | builder
|
269 + | .status(400)
|
270 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
271 + | }
|
272 + | }
|
273 + | })
|
274 + | }
|
275 + |
|
276 + | pub(crate) fn de_start_snapshot(
|
277 + | value: &[u8],
|
278 + | mut builder: crate::input::start_snapshot_input::Builder,
|
279 + | ) -> ::std::result::Result<
|
280 + | crate::input::start_snapshot_input::Builder,
|
281 + | ::aws_smithy_json::deserialize::error::DeserializeError,
|
282 + | > {
|
283 + | let mut tokens_owned =
|
284 + | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
285 + | .peekable();
|
286 + | let tokens = &mut tokens_owned;
|
287 + | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
288 + | loop {
|
289 + | match tokens.next().transpose()? {
|
290 + | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
291 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
292 + | match key.to_unescaped()?.as_ref() {
|
293 + | "ClientToken" => {
|
294 + | builder = builder.set_client_token(
|
295 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
296 + | tokens.next(),
|
297 + | )?
|
298 + | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
299 + | .transpose()?,
|
300 + | );
|
301 + | }
|
302 + | "Description" => {
|
303 + | builder = builder.set_description(
|
304 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
305 + | tokens.next(),
|
306 + | )?
|
307 + | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
308 + | .transpose()?,
|
309 + | );
|
310 + | }
|
311 + | "Encrypted" => {
|
312 + | builder = builder.set_encrypted(
|
313 + | ::aws_smithy_json::deserialize::token::expect_bool_or_null(
|
314 + | tokens.next(),
|
315 + | )?,
|
316 + | );
|
317 + | }
|
318 + | "KmsKeyArn" => {
|
319 + | builder = builder.set_kms_key_arn(
|
320 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
321 + | tokens.next(),
|
322 + | )?
|
323 + | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
324 + | .transpose()?,
|
325 + | );
|
326 + | }
|
327 + | "ParentSnapshotId" => {
|
328 + | builder = builder.set_parent_snapshot_id(
|
329 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
330 + | tokens.next(),
|
331 + | )?
|
332 + | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
333 + | .transpose()?,
|
334 + | );
|
335 + | }
|
336 + | "Tags" => {
|
337 + | builder =
|
338 + | builder.set_tags(crate::protocol_serde::shape_tags::de_tags(tokens)?);
|
339 + | }
|
340 + | "Timeout" => {
|
341 + | builder = builder.set_timeout(
|
342 + | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
343 + | tokens.next(),
|
344 + | )?
|
345 + | .map(i32::try_from)
|
346 + | .transpose()?,
|
347 + | );
|
348 + | }
|
349 + | "VolumeSize" => {
|
350 + | if let Some(v) =
|
351 + | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
352 + | tokens.next(),
|
353 + | )?
|
354 + | .map(i64::try_from)
|
355 + | .transpose()?
|
356 + | {
|
357 + | builder = builder.set_volume_size(v);
|
358 + | }
|
359 + | }
|
360 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
361 + | }
|
362 + | }
|
363 + | other => {
|
364 + | return Err(
|
365 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
366 + | "expected object key or end object, found: {other:?}"
|
367 + | )),
|
368 + | )
|
369 + | }
|
370 + | }
|
371 + | }
|
372 + | if tokens.next().is_some() {
|
373 + | return Err(
|
374 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
375 + | "found more JSON tokens after completing parsing",
|
376 + | ),
|
377 + | );
|
378 + | }
|
379 + | Ok(builder)
|
380 + | }
|