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_byte_http_request<B>(
|
4 4 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 5 | ) -> std::result::Result<
|
6 6 | crate::input::MalformedByteInput,
|
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_byte_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_byte::de_malformed_byte(
|
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_byte_input::de_byte_in_header_header(&headers)?
|
35 35 | {
|
36 36 | input = input.set_byte_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>>("MalformedByte"),
|
44 44 | ),
|
45 45 | ::nom::sequence::preceded(
|
46 46 | ::nom::bytes::complete::tag("/"),
|
47 47 | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
48 48 | ::nom::bytes::complete::take_until("/"),
|
49 49 | ::nom::combinator::rest,
|
50 50 | )),
|
51 51 | ),
|
52 52 | ))(input_string)?;
|
53 53 | debug_assert_eq!("", input_string);
|
54 54 | input = input.set_byte_in_path(
|
55 55 | crate::protocol_serde::shape_malformed_byte_input::de_byte_in_path(m1)?,
|
56 56 | );
|
57 57 | let query_string = uri.query().unwrap_or("");
|
58 58 | let pairs = ::form_urlencoded::parse(query_string.as_bytes());
|
59 59 | let mut byte_in_query_seen = false;
|
60 60 | for (k, v) in pairs {
|
61 61 | if !byte_in_query_seen && k == "byteInQuery" {
|
62 62 | input = input.set_byte_in_query(
|
63 63 | crate::protocol_serde::shape_malformed_byte_input::de_byte_in_query(&v)?,
|
64 64 | );
|
65 65 | byte_in_query_seen = true;
|
66 66 | }
|
67 67 | }
|
68 68 | input.build()?
|
69 69 | })
|
70 70 | }
|
71 71 |
|
72 72 | #[allow(clippy::unnecessary_wraps)]
|
73 73 | pub fn ser_malformed_byte_http_response(
|
74 74 | #[allow(unused_variables)] output: crate::output::MalformedByteOutput,
|
75 75 | ) -> std::result::Result<
|
76 - | ::aws_smithy_http_server::response::Response,
|
77 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
76 + | ::aws_smithy_legacy_http_server::response::Response,
|
77 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
78 78 | > {
|
79 79 | Ok({
|
80 80 | #[allow(unused_mut)]
|
81 81 | let mut builder = ::http::Response::builder();
|
82 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
82 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
83 83 | builder,
|
84 84 | ::http::header::CONTENT_TYPE,
|
85 85 | "application/json",
|
86 86 | );
|
87 87 | let http_status: u16 = 200;
|
88 88 | builder = builder.status(http_status);
|
89 89 | let payload = "";
|
90 90 | let content_length = payload.len();
|
91 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
91 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
92 92 | builder,
|
93 93 | ::http::header::CONTENT_LENGTH,
|
94 94 | content_length,
|
95 95 | );
|
96 - | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
96 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
97 97 | builder.body(body)?
|
98 98 | })
|
99 99 | }
|
100 100 |
|
101 101 | #[allow(clippy::unnecessary_wraps)]
|
102 102 | pub fn ser_malformed_byte_http_error(
|
103 103 | error: &crate::error::MalformedByteError,
|
104 104 | ) -> std::result::Result<
|
105 - | ::aws_smithy_http_server::response::Response,
|
106 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
105 + | ::aws_smithy_legacy_http_server::response::Response,
|
106 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
107 107 | > {
|
108 108 | Ok({
|
109 109 | match error {
|
110 110 | crate::error::MalformedByteError::ValidationException(output) => {
|
111 111 | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
112 112 | #[allow(unused_mut)]
|
113 113 | let mut builder = ::http::Response::builder();
|
114 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
114 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
115 115 | builder,
|
116 116 | ::http::header::CONTENT_TYPE,
|
117 117 | "application/json",
|
118 118 | );
|
119 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
119 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
120 120 | builder,
|
121 121 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
122 122 | "ValidationException",
|
123 123 | );
|
124 124 | let content_length = payload.len();
|
125 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
125 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
126 126 | builder,
|
127 127 | ::http::header::CONTENT_LENGTH,
|
128 128 | content_length,
|
129 129 | );
|
130 130 | builder
|
131 131 | .status(400)
|
132 - | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
132 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
133 133 | }
|
134 134 | crate::error::MalformedByteError::InternalServerError(output) => {
|
135 135 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
136 136 | #[allow(unused_mut)]
|
137 137 | let mut builder = ::http::Response::builder();
|
138 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
138 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
139 139 | builder,
|
140 140 | ::http::header::CONTENT_TYPE,
|
141 141 | "application/json",
|
142 142 | );
|
143 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
143 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
144 144 | builder,
|
145 145 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
146 146 | "InternalServerError",
|
147 147 | );
|
148 148 | let content_length = payload.len();
|
149 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
149 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
150 150 | builder,
|
151 151 | ::http::header::CONTENT_LENGTH,
|
152 152 | content_length,
|
153 153 | );
|
154 154 | builder
|
155 155 | .status(500)
|
156 - | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
156 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
157 157 | }
|
158 158 | }
|
159 159 | })
|
160 160 | }
|
161 161 |
|
162 162 | pub(crate) fn de_malformed_byte(
|
163 163 | value: &[u8],
|
164 164 | mut builder: crate::input::malformed_byte_input_internal::Builder,
|
165 165 | ) -> ::std::result::Result<
|
166 166 | crate::input::malformed_byte_input_internal::Builder,
|