1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub async fn de_http_string_payload2_http_request<B>(
|
3 + | pub async fn de_content_type_parameters_http_request<B>(
|
4 4 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 5 | ) -> std::result::Result<
|
6 - | crate::input::HttpStringPayload2Input,
|
6 + | crate::input::ContentTypeParametersInput,
|
7 7 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
8 8 | >
|
9 9 | where
|
10 10 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11 11 | B::Data: Send,
|
12 12 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 13 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
14 14 | {
|
15 15 | Ok({
|
16 16 | #[allow(unused_mut)]
|
17 - | let mut input = crate::input::http_string_payload2_input_internal::Builder::default();
|
17 + | let mut input = crate::input::content_type_parameters_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 - | if let Some(value) = {
|
23 22 | let bytes = ::hyper::body::to_bytes(body).await?;
|
24 23 | if !bytes.is_empty() {
|
25 24 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
26 25 | &headers,
|
27 - | Some("text/plain"),
|
26 + | Some("application/json"),
|
27 + | )?;
|
28 + | input =
|
29 + | crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters(
|
30 + | bytes.as_ref(),
|
31 + | input,
|
28 32 | )?;
|
29 - | }
|
30 - | crate::protocol_serde::shape_http_string_payload2_input::de_payload_payload(&bytes)?
|
31 - | } {
|
32 - | input = input.set_payload(Some(value))
|
33 33 | }
|
34 34 | input.build()
|
35 35 | })
|
36 36 | }
|
37 37 |
|
38 38 | #[allow(clippy::unnecessary_wraps)]
|
39 - | pub fn ser_http_string_payload2_http_response(
|
40 - | #[allow(unused_variables)] output: crate::output::HttpStringPayload2Output,
|
39 + | pub fn ser_content_type_parameters_http_response(
|
40 + | #[allow(unused_variables)] output: crate::output::ContentTypeParametersOutput,
|
41 41 | ) -> std::result::Result<
|
42 42 | ::aws_smithy_http_server::response::Response,
|
43 43 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
44 44 | > {
|
45 45 | Ok({
|
46 46 | #[allow(unused_mut)]
|
47 47 | let mut builder = ::http::Response::builder();
|
48 48 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
49 49 | builder,
|
50 50 | ::http::header::CONTENT_TYPE,
|
51 - | "text/plain",
|
51 + | "application/json",
|
52 52 | );
|
53 53 | let http_status: u16 = 200;
|
54 54 | builder = builder.status(http_status);
|
55 55 | let payload =
|
56 - | crate::protocol_serde::shape_http_string_payload2_output::ser_payload_http_payload(
|
57 - | output.payload,
|
58 - | )?;
|
56 + | crate::protocol_serde::shape_content_type_parameters_output::ser_content_type_parameters_output_output_output(&output)?
|
57 + | ;
|
59 58 | let content_length = payload.len();
|
60 59 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
61 60 | builder,
|
62 61 | ::http::header::CONTENT_LENGTH,
|
63 62 | content_length,
|
64 63 | );
|
65 64 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
66 65 | builder.body(body)?
|
67 66 | })
|
68 67 | }
|
69 68 |
|
70 69 | #[allow(clippy::unnecessary_wraps)]
|
71 - | pub fn ser_http_string_payload2_http_error(
|
72 - | error: &crate::error::HttpStringPayload2Error,
|
70 + | pub fn ser_content_type_parameters_http_error(
|
71 + | error: &crate::error::ContentTypeParametersError,
|
73 72 | ) -> std::result::Result<
|
74 73 | ::aws_smithy_http_server::response::Response,
|
75 74 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
76 75 | > {
|
77 76 | Ok({
|
78 77 | match error {
|
79 - | crate::error::HttpStringPayload2Error::ExtraError(output) => {
|
80 - | let payload =
|
81 - | crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
|
82 - | #[allow(unused_mut)]
|
83 - | let mut builder = ::http::Response::builder();
|
84 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
85 - | builder,
|
86 - | ::http::header::CONTENT_TYPE,
|
87 - | "text/plain",
|
88 - | );
|
89 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
90 - | builder,
|
91 - | http::header::HeaderName::from_static("x-amzn-errortype"),
|
92 - | "ExtraError",
|
93 - | );
|
94 - | let content_length = payload.len();
|
95 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
96 - | builder,
|
97 - | ::http::header::CONTENT_LENGTH,
|
98 - | content_length,
|
99 - | );
|
100 - | builder
|
101 - | .status(500)
|
102 - | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
103 - | }
|
104 - | crate::error::HttpStringPayload2Error::InternalServerError(output) => {
|
78 + | crate::error::ContentTypeParametersError::InternalServerError(output) => {
|
105 79 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
106 80 | #[allow(unused_mut)]
|
107 81 | let mut builder = ::http::Response::builder();
|
108 82 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
109 83 | builder,
|
110 84 | ::http::header::CONTENT_TYPE,
|
111 - | "text/plain",
|
85 + | "application/json",
|
112 86 | );
|
113 87 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
114 88 | builder,
|
115 89 | http::header::HeaderName::from_static("x-amzn-errortype"),
|
116 90 | "InternalServerError",
|
117 91 | );
|
118 92 | let content_length = payload.len();
|
119 93 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
120 94 | builder,
|
121 95 | ::http::header::CONTENT_LENGTH,
|
122 96 | content_length,
|
123 97 | );
|
124 98 | builder
|
125 99 | .status(500)
|
126 100 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
127 101 | }
|
128 102 | }
|
129 103 | })
|
130 104 | }
|
105 + |
|
106 + | pub(crate) fn de_content_type_parameters(
|
107 + | value: &[u8],
|
108 + | mut builder: crate::input::content_type_parameters_input_internal::Builder,
|
109 + | ) -> Result<
|
110 + | crate::input::content_type_parameters_input_internal::Builder,
|
111 + | ::aws_smithy_json::deserialize::error::DeserializeError,
|
112 + | > {
|
113 + | let mut tokens_owned =
|
114 + | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
115 + | .peekable();
|
116 + | let tokens = &mut tokens_owned;
|
117 + | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
118 + | loop {
|
119 + | match tokens.next().transpose()? {
|
120 + | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
121 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
122 + | match key.to_unescaped()?.as_ref() {
|
123 + | "value" => {
|
124 + | builder = builder.set_value(
|
125 + | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
126 + | tokens.next(),
|
127 + | )?
|
128 + | .map(i32::try_from)
|
129 + | .transpose()?,
|
130 + | );
|
131 + | }
|
132 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
133 + | }
|
134 + | }
|
135 + | other => {
|
136 + | return Err(
|
137 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
138 + | "expected object key or end object, found: {:?}",
|
139 + | other
|
140 + | )),
|
141 + | )
|
142 + | }
|
143 + | }
|
144 + | }
|
145 + | if tokens.next().is_some() {
|
146 + | return Err(
|
147 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
148 + | "found more JSON tokens after completing parsing",
|
149 + | ),
|
150 + | );
|
151 + | }
|
152 + | Ok(builder)
|
153 + | }
|