1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:534 */
|
3 + | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
5 + | pub async fn de_streaming_traits_http_request<B>(
|
6 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
7 + | ) -> std::result::Result<
|
8 + | crate::input::StreamingTraitsInput,
|
9 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
10 + | >
|
11 + | where
|
12 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
13 + | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
14 + | B::Data: Send,
|
15 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
16 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
17 + | {
|
18 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
19 + | Ok({
|
20 + | /* RustType.kt:534 */
|
21 + | #[allow(unused_mut)]
|
22 + | /* ServerHttpBoundProtocolGenerator.kt:759 */
|
23 + | let mut input = crate::input::streaming_traits_input::Builder::default();
|
24 + | /* RustType.kt:534 */
|
25 + | #[allow(unused_variables)]
|
26 + | /* ServerHttpBoundProtocolGenerator.kt:764 */
|
27 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
28 + | uri, headers, body, ..
|
29 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
30 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
31 + | if let Some(value) = {
|
32 + | Some(
|
33 + | crate::protocol_serde::shape_streaming_traits_input::de_blob_payload(
|
34 + | &mut body.into().into_inner(),
|
35 + | )?,
|
36 + | )
|
37 + | } {
|
38 + | input = input.set_blob(value)
|
39 + | }
|
40 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
41 + | if let Some(value) =
|
42 + | crate::protocol_serde::shape_streaming_traits_input::de_foo_header(&headers)?
|
43 + | {
|
44 + | input = input.set_foo(Some(value))
|
45 + | }
|
46 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
47 + | input.build()
|
48 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
49 + | })
|
50 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
51 + | }
|
52 + |
|
53 + | /* RustType.kt:534 */
|
54 + | #[allow(clippy::unnecessary_wraps)]
|
55 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
56 + | pub fn ser_streaming_traits_http_response(
|
57 + | #[allow(unused_variables)] output: crate::output::StreamingTraitsOutput,
|
58 + | ) -> std::result::Result<
|
59 + | ::aws_smithy_legacy_http_server::response::Response,
|
60 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
61 + | > {
|
62 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
63 + | Ok({
|
64 + | /* RustType.kt:534 */
|
65 + | #[allow(unused_mut)]
|
66 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
67 + | let mut builder = ::http::Response::builder();
|
68 + | /* ServerHttpBoundProtocolGenerator.kt:665 */
|
69 + | builder = crate::protocol_serde::shape_streaming_traits::ser_streaming_traits_headers(
|
70 + | &output, builder,
|
71 + | )?;
|
72 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
73 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
74 + | builder,
|
75 + | ::http::header::CONTENT_TYPE,
|
76 + | "application/octet-stream",
|
77 + | );
|
78 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
79 + | let http_status: u16 = 200;
|
80 + | builder = builder.status(http_status);
|
81 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
82 + | let body = ::aws_smithy_legacy_http_server::body::boxed(::aws_smithy_legacy_http_server::body::Body::wrap_stream(
|
83 + | /* ServerProtocolLoader.kt:42 */::aws_smithy_legacy_http::futures_stream_adapter::FuturesStreamCompatByteStream::new(
|
84 + | /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_streaming_traits_output::ser_blob_http_payload( output.blob)?
|
85 + | /* ServerProtocolLoader.kt:42 */)
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:575 */));
|
87 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
88 + | builder.body(body)?
|
89 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
90 + | })
|
91 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
92 + | }
|
93 + |
|
94 + | /* HttpBindingGenerator.kt:565 */
|
95 + | pub fn ser_streaming_traits_headers(
|
96 + | input: &crate::output::StreamingTraitsOutput,
|
97 + | mut builder: ::http::response::Builder,
|
98 + | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
99 + | {
|
100 + | /* HttpBindingGenerator.kt:615 */
|
101 + | if let ::std::option::Option::Some(inner_1) = &input.foo {
|
102 + | /* HttpBindingGenerator.kt:727 */
|
103 + | let formatted_2 = inner_1.as_str();
|
104 + | /* HttpBindingGenerator.kt:728 */
|
105 + | if !formatted_2.is_empty() {
|
106 + | /* HttpBindingGenerator.kt:729 */
|
107 + | let header_value = formatted_2;
|
108 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
109 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
110 + | "foo",
|
111 + | format!(
|
112 + | "`{}` cannot be used as a header value: {}",
|
113 + | &header_value, err
|
114 + | ),
|
115 + | )
|
116 + | })?;
|
117 + | builder = builder.header("X-Foo", header_value);
|
118 + | /* HttpBindingGenerator.kt:728 */
|
119 + | }
|
120 + | /* HttpBindingGenerator.kt:615 */
|
121 + | }
|
122 + | /* HttpBindingGenerator.kt:578 */
|
123 + | Ok(builder)
|
124 + | /* HttpBindingGenerator.kt:565 */
|
125 + | }
|