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_test_payload_structure_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::TestPayloadStructureInput,
|
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::Data: Send,
|
12 14 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 15 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
14 16 | {
|
17 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
15 18 | Ok({
|
19 + | /* RustType.kt:516 */
|
16 20 | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:723 */
|
17 22 | let mut input = crate::input::test_payload_structure_input::Builder::default();
|
23 + | /* RustType.kt:516 */
|
18 24 | #[allow(unused_variables)]
|
25 + | /* ServerHttpBoundProtocolGenerator.kt:728 */
|
19 26 | let ::aws_smithy_runtime_api::http::RequestParts {
|
20 27 | uri, headers, body, ..
|
21 28 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
29 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
22 30 | if let Some(value) = {
|
23 31 | let bytes = ::hyper::body::to_bytes(body).await?;
|
24 32 | if !bytes.is_empty() {
|
25 33 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
26 34 | &headers,
|
27 35 | Some("application/json"),
|
28 36 | )?;
|
29 37 | }
|
30 38 | crate::protocol_serde::shape_test_payload_structure_input::de_payload_config_payload(
|
31 39 | &bytes,
|
32 40 | )?
|
33 41 | } {
|
34 42 | input = input.set_payload_config(Some(value))
|
35 43 | }
|
44 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
36 45 | if let Some(value) =
|
37 46 | crate::protocol_serde::shape_test_payload_structure_input::de_test_id_header(&headers)?
|
38 47 | {
|
39 48 | input = input.set_test_id(Some(value))
|
40 49 | }
|
50 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
41 51 | input.build()
|
52 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
42 53 | })
|
54 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
43 55 | }
|
44 56 |
|
57 + | /* RustType.kt:516 */
|
45 58 | #[allow(clippy::unnecessary_wraps)]
|
59 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
46 60 | pub fn ser_test_payload_structure_http_response(
|
47 61 | #[allow(unused_variables)] output: crate::output::TestPayloadStructureOutput,
|
48 62 | ) -> std::result::Result<
|
49 63 | ::aws_smithy_http_server::response::Response,
|
50 64 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
51 65 | > {
|
66 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
52 67 | Ok({
|
68 + | /* RustType.kt:516 */
|
53 69 | #[allow(unused_mut)]
|
70 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
54 71 | let mut builder = ::http::Response::builder();
|
72 + | /* ServerHttpBoundProtocolGenerator.kt:629 */
|
55 73 | builder = crate::protocol_serde::shape_test_payload_structure::ser_test_payload_structure_headers(&output, builder)?;
|
74 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
56 75 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
57 76 | builder,
|
58 77 | ::http::header::CONTENT_TYPE,
|
59 78 | "application/json",
|
60 79 | );
|
80 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
61 81 | let http_status: u16 = 200;
|
62 82 | builder = builder.status(http_status);
|
83 + | /* ServerHttpBoundProtocolGenerator.kt:561 */
|
63 84 | let payload =
|
64 - | crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_http_payload(& output.payload_config)?
|
65 - | ;
|
85 + | /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_http_payload(& output.payload_config)?
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:561 */;
|
87 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
66 88 | let content_length = payload.len();
|
67 89 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
68 90 | builder,
|
69 91 | ::http::header::CONTENT_LENGTH,
|
70 92 | content_length,
|
71 93 | );
|
94 + | /* ServerHttpBoundProtocolGenerator.kt:567 */
|
72 95 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
96 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
73 97 | builder.body(body)?
|
98 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
74 99 | })
|
100 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
75 101 | }
|
76 102 |
|
103 + | /* HttpBindingGenerator.kt:542 */
|
77 104 | pub fn ser_test_payload_structure_headers(
|
78 105 | input: &crate::output::TestPayloadStructureOutput,
|
79 106 | mut builder: ::http::response::Builder,
|
80 107 | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
81 108 | {
|
109 + | /* HttpBindingGenerator.kt:592 */
|
82 110 | if let ::std::option::Option::Some(inner_1) = &input.test_id {
|
111 + | /* HttpBindingGenerator.kt:704 */
|
83 112 | let formatted_2 = inner_1.as_str();
|
113 + | /* HttpBindingGenerator.kt:705 */
|
84 114 | if !formatted_2.is_empty() {
|
115 + | /* HttpBindingGenerator.kt:706 */
|
85 116 | let header_value = formatted_2;
|
86 117 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
87 118 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
88 119 | "test_id",
|
89 120 | format!(
|
90 121 | "`{}` cannot be used as a header value: {}",
|
91 122 | &header_value, err
|
92 123 | ),
|
93 124 | )
|
94 125 | })?;
|
95 126 | builder = builder.header("x-amz-test-id", header_value);
|
127 + | /* HttpBindingGenerator.kt:705 */
|
96 128 | }
|
129 + | /* HttpBindingGenerator.kt:592 */
|
97 130 | }
|
131 + | /* HttpBindingGenerator.kt:555 */
|
98 132 | Ok(builder)
|
133 + | /* HttpBindingGenerator.kt:542 */
|
99 134 | }
|