1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | #[allow(clippy::unnecessary_wraps)]
|
3 3 | pub async fn de_malformed_short_http_request<B>(
|
4 4 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 5 | ) -> std::result::Result<
|
6 6 | crate::input::MalformedShortInput,
|
7 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
7 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
8 8 | >
|
9 9 | where
|
10 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
11 11 | B::Data: Send,
|
12 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
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 14 | {
|
15 15 | Ok({
|
16 16 | #[allow(unused_mut)]
|
17 17 | let mut input = crate::input::malformed_short_input_internal::Builder::default();
|
18 18 | #[allow(unused_variables)]
|
19 19 | let ::aws_smithy_runtime_api::http::RequestParts {
|
20 20 | uri, headers, body, ..
|
21 21 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
22 22 | let bytes = ::hyper::body::to_bytes(body).await?;
|
23 23 | if !bytes.is_empty() {
|
24 - | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
24 + | ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
|
25 25 | &headers,
|
26 26 | Some("application/json"),
|
27 27 | )?;
|
28 28 | input = crate::protocol_serde::shape_malformed_short::de_malformed_short(
|
29 29 | bytes.as_ref(),
|
30 30 | input,
|
31 31 | )?;
|
32 32 | }
|
33 33 | if let Some(value) =
|
34 34 | crate::protocol_serde::shape_malformed_short_input::de_short_in_header_header(&headers)?
|
35 35 | {
|
36 36 | input = input.set_short_in_header(Some(value))
|
37 37 | }
|
38 38 | let input_string = uri.path();
|
39 39 | let (input_string, (_, m1)) =
|
40 40 | ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
|
41 41 | ::nom::sequence::preceded(
|
42 42 | ::nom::bytes::complete::tag("/"),
|
43 43 | ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
|
44 44 | "MalformedShort",
|
45 45 | ),
|
46 46 | ),
|
47 47 | ::nom::sequence::preceded(
|
48 48 | ::nom::bytes::complete::tag("/"),
|
49 49 | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
50 50 | ::nom::bytes::complete::take_until("/"),
|
51 51 | ::nom::combinator::rest,
|
52 52 | )),
|
53 53 | ),
|
54 54 | ))(input_string)?;
|
55 55 | debug_assert_eq!("", input_string);
|
56 56 | input = input.set_short_in_path(
|
57 57 | crate::protocol_serde::shape_malformed_short_input::de_short_in_path(m1)?,
|
58 58 | );
|
59 59 | let query_string = uri.query().unwrap_or("");
|
60 60 | let pairs = ::form_urlencoded::parse(query_string.as_bytes());
|
61 61 | let mut short_in_query_seen = false;
|
62 62 | for (k, v) in pairs {
|
63 63 | if !short_in_query_seen && k == "shortInQuery" {
|
64 64 | input = input.set_short_in_query(
|
65 65 | crate::protocol_serde::shape_malformed_short_input::de_short_in_query(&v)?,
|
66 66 | );
|
67 67 | short_in_query_seen = true;
|
68 68 | }
|
69 69 | }
|
70 70 | input.build()?
|
71 71 | })
|
72 72 | }
|
73 73 |
|
74 74 | #[allow(clippy::unnecessary_wraps)]
|
75 75 | pub fn ser_malformed_short_http_response(
|
76 76 | #[allow(unused_variables)] output: crate::output::MalformedShortOutput,
|
77 77 | ) -> std::result::Result<
|
78 - | ::aws_smithy_http_server::response::Response,
|
79 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
78 + | ::aws_smithy_legacy_http_server::response::Response,
|
79 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
80 80 | > {
|
81 81 | Ok({
|
82 82 | #[allow(unused_mut)]
|
83 83 | let mut builder = ::http::Response::builder();
|
84 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
84 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
85 85 | builder,
|
86 86 | ::http::header::CONTENT_TYPE,
|
87 87 | "application/json",
|
88 88 | );
|
89 89 | let http_status: u16 = 200;
|
90 90 | builder = builder.status(http_status);
|
91 91 | let payload = "";
|
92 92 | let content_length = payload.len();
|
93 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
93 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
94 94 | builder,
|
95 95 | ::http::header::CONTENT_LENGTH,
|
96 96 | content_length,
|
97 97 | );
|
98 - | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
98 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
99 99 | builder.body(body)?
|
100 100 | })
|
101 101 | }
|
102 102 |
|
103 103 | #[allow(clippy::unnecessary_wraps)]
|
104 104 | pub fn ser_malformed_short_http_error(
|
105 105 | error: &crate::error::MalformedShortError,
|
106 106 | ) -> std::result::Result<
|
107 - | ::aws_smithy_http_server::response::Response,
|
108 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
107 + | ::aws_smithy_legacy_http_server::response::Response,
|
108 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
109 109 | > {
|
110 110 | Ok({
|
111 111 | match error {
|
112 112 | crate::error::MalformedShortError::ValidationException(output) => {
|
113 113 | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
114 114 | #[allow(unused_mut)]
|
115 115 | let mut builder = ::http::Response::builder();
|
116 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
116 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
117 117 | builder,
|
118 118 | ::http::header::CONTENT_TYPE,
|
119 119 | "application/json",
|
120 120 | );
|
121 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
121 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
122 122 | builder,
|
123 123 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
124 124 | "ValidationException",
|
125 125 | );
|
126 126 | let content_length = payload.len();
|
127 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
127 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
128 128 | builder,
|
129 129 | ::http::header::CONTENT_LENGTH,
|
130 130 | content_length,
|
131 131 | );
|
132 132 | builder
|
133 133 | .status(400)
|
134 - | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
134 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
135 135 | }
|
136 136 | crate::error::MalformedShortError::InternalServerError(output) => {
|
137 137 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
138 138 | #[allow(unused_mut)]
|
139 139 | let mut builder = ::http::Response::builder();
|
140 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
140 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
141 141 | builder,
|
142 142 | ::http::header::CONTENT_TYPE,
|
143 143 | "application/json",
|
144 144 | );
|
145 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
145 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
146 146 | builder,
|
147 147 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
148 148 | "InternalServerError",
|
149 149 | );
|
150 150 | let content_length = payload.len();
|
151 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
151 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
152 152 | builder,
|
153 153 | ::http::header::CONTENT_LENGTH,
|
154 154 | content_length,
|
155 155 | );
|
156 156 | builder
|
157 157 | .status(500)
|
158 - | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
158 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
159 159 | }
|
160 160 | }
|
161 161 | })
|
162 162 | }
|
163 163 |
|
164 164 | pub(crate) fn de_malformed_short(
|
165 165 | value: &[u8],
|
166 166 | mut builder: crate::input::malformed_short_input_internal::Builder,
|
167 167 | ) -> ::std::result::Result<
|
168 168 | crate::input::malformed_short_input_internal::Builder,
|