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_greeting_with_errors_http_request<B>(
|
4 4 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 5 | ) -> std::result::Result<
|
6 6 | crate::input::GreetingWithErrorsInput,
|
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::greeting_with_errors_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 - | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
|
22 + | ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
|
23 + | &headers, None,
|
24 + | )?;
|
23 25 | input.build()
|
24 26 | })
|
25 27 | }
|
26 28 |
|
27 29 | #[allow(clippy::unnecessary_wraps)]
|
28 30 | pub fn ser_greeting_with_errors_http_response(
|
29 31 | #[allow(unused_variables)] output: crate::output::GreetingWithErrorsOutput,
|
30 32 | ) -> std::result::Result<
|
31 - | ::aws_smithy_http_server::response::Response,
|
32 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
33 + | ::aws_smithy_legacy_http_server::response::Response,
|
34 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
33 35 | > {
|
34 36 | Ok({
|
35 37 | #[allow(unused_mut)]
|
36 38 | let mut builder = ::http::Response::builder();
|
37 39 | builder =
|
38 40 | crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_headers(
|
39 41 | &output, builder,
|
40 42 | )?;
|
41 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
43 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
42 44 | builder,
|
43 45 | ::http::header::CONTENT_TYPE,
|
44 46 | "application/json",
|
45 47 | );
|
46 48 | let http_status: u16 = 200;
|
47 49 | builder = builder.status(http_status);
|
48 50 | let payload =
|
49 51 | crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_output_output_output(&output)?
|
50 52 | ;
|
51 53 | let content_length = payload.len();
|
52 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
54 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
53 55 | builder,
|
54 56 | ::http::header::CONTENT_LENGTH,
|
55 57 | content_length,
|
56 58 | );
|
57 - | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
59 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
58 60 | builder.body(body)?
|
59 61 | })
|
60 62 | }
|
61 63 |
|
62 64 | #[allow(clippy::unnecessary_wraps)]
|
63 65 | pub fn ser_greeting_with_errors_http_error(
|
64 66 | error: &crate::error::GreetingWithErrorsError,
|
65 67 | ) -> std::result::Result<
|
66 - | ::aws_smithy_http_server::response::Response,
|
67 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
68 + | ::aws_smithy_legacy_http_server::response::Response,
|
69 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
68 70 | > {
|
69 71 | Ok({
|
70 72 | match error {
|
71 73 | crate::error::GreetingWithErrorsError::InvalidGreeting(output) => {
|
72 74 | let payload =
|
73 75 | crate::protocol_serde::shape_invalid_greeting::ser_invalid_greeting_error(
|
74 76 | output,
|
75 77 | )?;
|
76 78 | #[allow(unused_mut)]
|
77 79 | let mut builder = ::http::Response::builder();
|
78 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
80 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
79 81 | builder,
|
80 82 | ::http::header::CONTENT_TYPE,
|
81 83 | "application/json",
|
82 84 | );
|
83 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
85 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
84 86 | builder,
|
85 87 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
86 88 | "InvalidGreeting",
|
87 89 | );
|
88 90 | let content_length = payload.len();
|
89 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
91 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
90 92 | builder,
|
91 93 | ::http::header::CONTENT_LENGTH,
|
92 94 | content_length,
|
93 95 | );
|
94 96 | builder
|
95 97 | .status(400)
|
96 - | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
98 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
97 99 | }
|
98 100 | crate::error::GreetingWithErrorsError::ComplexError(output) => {
|
99 101 | let payload =
|
100 102 | crate::protocol_serde::shape_complex_error::ser_complex_error_error(output)?;
|
101 103 | #[allow(unused_mut)]
|
102 104 | let mut builder = ::http::Response::builder();
|
103 105 | builder = crate::protocol_serde::shape_complex_error::ser_complex_error_headers(
|
104 106 | output, builder,
|
105 107 | )?;
|
106 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
108 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
107 109 | builder,
|
108 110 | ::http::header::CONTENT_TYPE,
|
109 111 | "application/json",
|
110 112 | );
|
111 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
113 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
112 114 | builder,
|
113 115 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
114 116 | "ComplexError",
|
115 117 | );
|
116 118 | let content_length = payload.len();
|
117 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
119 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
118 120 | builder,
|
119 121 | ::http::header::CONTENT_LENGTH,
|
120 122 | content_length,
|
121 123 | );
|
122 124 | builder
|
123 125 | .status(403)
|
124 - | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
126 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
125 127 | }
|
126 128 | crate::error::GreetingWithErrorsError::FooError(output) => {
|
127 129 | let payload = crate::protocol_serde::shape_foo_error::ser_foo_error_error(output)?;
|
128 130 | #[allow(unused_mut)]
|
129 131 | let mut builder = ::http::Response::builder();
|
130 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
132 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
131 133 | builder,
|
132 134 | ::http::header::CONTENT_TYPE,
|
133 135 | "application/json",
|
134 136 | );
|
135 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
137 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
136 138 | builder,
|
137 139 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
138 140 | "FooError",
|
139 141 | );
|
140 142 | let content_length = payload.len();
|
141 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
143 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
142 144 | builder,
|
143 145 | ::http::header::CONTENT_LENGTH,
|
144 146 | content_length,
|
145 147 | );
|
146 148 | builder
|
147 149 | .status(500)
|
148 - | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
150 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
149 151 | }
|
150 152 | crate::error::GreetingWithErrorsError::InternalServerError(output) => {
|
151 153 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
152 154 | #[allow(unused_mut)]
|
153 155 | let mut builder = ::http::Response::builder();
|
154 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
156 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
155 157 | builder,
|
156 158 | ::http::header::CONTENT_TYPE,
|
157 159 | "application/json",
|
158 160 | );
|
159 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
161 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
160 162 | builder,
|
161 163 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
162 164 | "InternalServerError",
|
163 165 | );
|
164 166 | let content_length = payload.len();
|
165 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
167 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
166 168 | builder,
|
167 169 | ::http::header::CONTENT_LENGTH,
|
168 170 | content_length,
|
169 171 | );
|
170 172 | builder
|
171 173 | .status(500)
|
172 - | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
174 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
173 175 | }
|
174 176 | }
|
175 177 | })
|
176 178 | }
|
177 179 |
|
178 180 | pub fn ser_greeting_with_errors_headers(
|
179 181 | input: &crate::output::GreetingWithErrorsOutput,
|
180 182 | mut builder: ::http::response::Builder,
|
181 183 | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
182 184 | {
|