1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:516 */
|
2 3 | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
3 5 | pub async fn de_streaming_traits_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::StreamingTraitsInput,
|
7 9 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
8 10 | >
|
9 11 | where
|
10 12 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11 13 | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
12 14 | B::Data: Send,
|
13 15 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
14 16 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
15 17 | {
|
18 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
16 19 | Ok({
|
20 + | /* RustType.kt:516 */
|
17 21 | #[allow(unused_mut)]
|
22 + | /* ServerHttpBoundProtocolGenerator.kt:723 */
|
18 23 | let mut input = crate::input::streaming_traits_input_internal::Builder::default();
|
24 + | /* RustType.kt:516 */
|
19 25 | #[allow(unused_variables)]
|
26 + | /* ServerHttpBoundProtocolGenerator.kt:728 */
|
20 27 | let ::aws_smithy_runtime_api::http::RequestParts {
|
21 28 | uri, headers, body, ..
|
22 29 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
30 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
23 31 | if let Some(value) = {
|
24 32 | Some(
|
25 33 | crate::protocol_serde::shape_streaming_traits_input::de_blob_payload(
|
26 34 | &mut body.into().into_inner(),
|
27 35 | )?,
|
28 36 | )
|
29 37 | } {
|
30 38 | input = input.set_blob(value)
|
31 39 | }
|
40 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
32 41 | if let Some(value) =
|
33 42 | crate::protocol_serde::shape_streaming_traits_input::de_foo_header(&headers)?
|
34 43 | {
|
35 44 | input = input.set_foo(Some(value))
|
36 45 | }
|
46 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
37 47 | input.build()
|
48 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
38 49 | })
|
50 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
39 51 | }
|
40 52 |
|
53 + | /* RustType.kt:516 */
|
41 54 | #[allow(clippy::unnecessary_wraps)]
|
55 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
42 56 | pub fn ser_streaming_traits_http_response(
|
43 57 | #[allow(unused_variables)] output: crate::output::StreamingTraitsOutput,
|
44 58 | ) -> std::result::Result<
|
45 59 | ::aws_smithy_http_server::response::Response,
|
46 60 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
47 61 | > {
|
62 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
48 63 | Ok({
|
64 + | /* RustType.kt:516 */
|
49 65 | #[allow(unused_mut)]
|
66 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
50 67 | let mut builder = ::http::Response::builder();
|
68 + | /* ServerHttpBoundProtocolGenerator.kt:629 */
|
51 69 | builder = crate::protocol_serde::shape_streaming_traits::ser_streaming_traits_headers(
|
52 70 | &output, builder,
|
53 71 | )?;
|
72 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
54 73 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
55 74 | builder,
|
56 75 | ::http::header::CONTENT_TYPE,
|
57 76 | "application/octet-stream",
|
58 77 | );
|
78 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
59 79 | let http_status: u16 = 200;
|
60 80 | builder = builder.status(http_status);
|
81 + | /* ServerHttpBoundProtocolGenerator.kt:543 */
|
61 82 | let body = ::aws_smithy_http_server::body::boxed(
|
62 83 | ::aws_smithy_http_server::body::Body::wrap_stream(
|
84 + | /* HttpBoundProtocolPayloadGenerator.kt:350 */
|
63 85 | crate::protocol_serde::shape_streaming_traits_output::ser_blob_http_payload(
|
64 86 | output.blob,
|
65 - | )?,
|
87 + | )?, /* ServerHttpBoundProtocolGenerator.kt:543 */
|
66 88 | ),
|
67 89 | );
|
90 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
68 91 | builder.body(body)?
|
92 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
69 93 | })
|
94 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
70 95 | }
|
71 96 |
|
97 + | /* RustType.kt:516 */
|
72 98 | #[allow(clippy::unnecessary_wraps)]
|
99 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
73 100 | pub fn ser_streaming_traits_http_error(
|
74 101 | error: &crate::error::StreamingTraitsError,
|
75 102 | ) -> std::result::Result<
|
76 103 | ::aws_smithy_http_server::response::Response,
|
77 104 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
78 105 | > {
|
106 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
79 107 | Ok({
|
108 + | /* ServerHttpBoundProtocolGenerator.kt:468 */
|
80 109 | match error {
|
110 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
81 111 | crate::error::StreamingTraitsError::InternalServerError(output) => {
|
112 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
82 113 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
114 + | /* RustType.kt:516 */
|
83 115 | #[allow(unused_mut)]
|
116 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
84 117 | let mut builder = ::http::Response::builder();
|
118 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
85 119 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
86 120 | builder,
|
87 121 | ::http::header::CONTENT_TYPE,
|
88 122 | "application/octet-stream",
|
89 123 | );
|
124 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
90 125 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
91 126 | builder,
|
92 127 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
93 128 | "InternalServerError",
|
94 129 | );
|
130 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
95 131 | let content_length = payload.len();
|
96 132 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
97 133 | builder,
|
98 134 | ::http::header::CONTENT_LENGTH,
|
99 135 | content_length,
|
100 136 | );
|
137 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
101 138 | builder
|
102 139 | .status(500)
|
103 140 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
141 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
142 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
104 143 | }
|
105 - | }
|
144 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
106 145 | })
|
146 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
107 147 | }
|
108 148 |
|
149 + | /* HttpBindingGenerator.kt:542 */
|
109 150 | pub fn ser_streaming_traits_headers(
|
110 151 | input: &crate::output::StreamingTraitsOutput,
|
111 152 | mut builder: ::http::response::Builder,
|
112 153 | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
113 154 | {
|
155 + | /* HttpBindingGenerator.kt:592 */
|
114 156 | if let ::std::option::Option::Some(inner_1) = &input.foo {
|
157 + | /* HttpBindingGenerator.kt:704 */
|
115 158 | let formatted_2 = inner_1.as_str();
|
159 + | /* HttpBindingGenerator.kt:705 */
|
116 160 | if !formatted_2.is_empty() {
|
161 + | /* HttpBindingGenerator.kt:706 */
|
117 162 | let header_value = formatted_2;
|
118 163 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
119 164 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
120 165 | "foo",
|
121 166 | format!(
|
122 167 | "`{}` cannot be used as a header value: {}",
|
123 168 | &header_value, err
|
124 169 | ),
|
125 170 | )
|
126 171 | })?;
|
127 172 | builder = builder.header("X-Foo", header_value);
|
173 + | /* HttpBindingGenerator.kt:705 */
|
128 174 | }
|
175 + | /* HttpBindingGenerator.kt:592 */
|
129 176 | }
|
177 + | /* HttpBindingGenerator.kt:555 */
|
130 178 | Ok(builder)
|
179 + | /* HttpBindingGenerator.kt:542 */
|
131 180 | }
|