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_malformed_content_type_with_body2_http_request<B>(
|
3 + | pub async fn de_operation_with_nested_structure_http_request<B>(
|
4 4 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 5 | ) -> std::result::Result<
|
6 - | crate::input::MalformedContentTypeWithBody2Input,
|
6 + | crate::input::OperationWithNestedStructureInput,
|
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::malformed_content_type_with_body2_input::Builder::default();
|
17 + | let mut input = crate::input::operation_with_nested_structure_input::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 22 | let bytes = ::hyper::body::to_bytes(body).await?;
|
23 23 | if !bytes.is_empty() {
|
24 24 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
25 25 | &headers,
|
26 26 | Some("application/json"),
|
27 27 | )?;
|
28 - | input = crate::protocol_serde::shape_malformed_content_type_with_body2::de_malformed_content_type_with_body2(bytes.as_ref(), input)?;
|
28 + | input = crate::protocol_serde::shape_operation_with_nested_structure::de_operation_with_nested_structure(bytes.as_ref(), input)?;
|
29 29 | }
|
30 - | input.build()
|
30 + | input.build()?
|
31 31 | })
|
32 32 | }
|
33 33 |
|
34 34 | #[allow(clippy::unnecessary_wraps)]
|
35 - | pub fn ser_malformed_content_type_with_body2_http_response(
|
36 - | #[allow(unused_variables)] output: crate::output::MalformedContentTypeWithBody2Output,
|
35 + | pub fn ser_operation_with_nested_structure_http_response(
|
36 + | #[allow(unused_variables)] output: crate::output::OperationWithNestedStructureOutput,
|
37 37 | ) -> std::result::Result<
|
38 38 | ::aws_smithy_http_server::response::Response,
|
39 39 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
40 40 | > {
|
41 41 | Ok({
|
42 42 | #[allow(unused_mut)]
|
43 43 | let mut builder = ::http::Response::builder();
|
44 44 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
45 45 | builder,
|
46 46 | ::http::header::CONTENT_TYPE,
|
47 47 | "application/json",
|
48 48 | );
|
49 49 | let http_status: u16 = 200;
|
50 50 | builder = builder.status(http_status);
|
51 - | let payload = "";
|
51 + | let payload =
|
52 + | crate::protocol_serde::shape_operation_with_nested_structure_output::ser_operation_with_nested_structure_output_output_output(&output)?
|
53 + | ;
|
52 54 | let content_length = payload.len();
|
53 55 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
54 56 | builder,
|
55 57 | ::http::header::CONTENT_LENGTH,
|
56 58 | content_length,
|
57 59 | );
|
58 60 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
59 61 | builder.body(body)?
|
60 62 | })
|
61 63 | }
|
62 64 |
|
63 65 | #[allow(clippy::unnecessary_wraps)]
|
64 - | pub fn ser_malformed_content_type_with_body2_http_error(
|
65 - | error: &crate::error::MalformedContentTypeWithBody2Error,
|
66 + | pub fn ser_operation_with_nested_structure_http_error(
|
67 + | error: &crate::error::OperationWithNestedStructureError,
|
66 68 | ) -> std::result::Result<
|
67 69 | ::aws_smithy_http_server::response::Response,
|
68 70 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
69 71 | > {
|
70 72 | Ok({
|
71 73 | match error {
|
72 - | crate::error::MalformedContentTypeWithBody2Error::ExtraError(output) => {
|
73 - | let payload =
|
74 - | crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
|
74 + | crate::error::OperationWithNestedStructureError::ValidationException(output) => {
|
75 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
75 76 | #[allow(unused_mut)]
|
76 77 | let mut builder = ::http::Response::builder();
|
77 78 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
78 79 | builder,
|
79 80 | ::http::header::CONTENT_TYPE,
|
80 81 | "application/json",
|
81 82 | );
|
82 83 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
83 84 | builder,
|
84 85 | http::header::HeaderName::from_static("x-amzn-errortype"),
|
85 - | "ExtraError",
|
86 + | "ValidationException",
|
86 87 | );
|
87 88 | let content_length = payload.len();
|
88 89 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
89 90 | builder,
|
90 91 | ::http::header::CONTENT_LENGTH,
|
91 92 | content_length,
|
92 93 | );
|
93 94 | builder
|
94 - | .status(500)
|
95 + | .status(400)
|
95 96 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
96 97 | }
|
97 98 | }
|
98 99 | })
|
99 100 | }
|
100 101 |
|
101 - | pub(crate) fn de_malformed_content_type_with_body2(
|
102 + | pub(crate) fn de_operation_with_nested_structure(
|
102 103 | value: &[u8],
|
103 - | mut builder: crate::input::malformed_content_type_with_body2_input::Builder,
|
104 + | mut builder: crate::input::operation_with_nested_structure_input::Builder,
|
104 105 | ) -> Result<
|
105 - | crate::input::malformed_content_type_with_body2_input::Builder,
|
106 + | crate::input::operation_with_nested_structure_input::Builder,
|
106 107 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
107 108 | > {
|
108 109 | let mut tokens_owned =
|
109 110 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
110 111 | .peekable();
|
111 112 | let tokens = &mut tokens_owned;
|
112 113 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
113 114 | loop {
|
114 115 | match tokens.next().transpose()? {
|
115 116 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
116 117 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
117 118 | match key.to_unescaped()?.as_ref() {
|
118 - | "salutation" => {
|
119 - | builder = builder.set_salutation(
|
120 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
121 - | tokens.next(),
|
122 - | )?
|
123 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
124 - | .transpose()?,
|
125 - | );
|
119 + | "topLevel" => {
|
120 + | if let Some(v) =
|
121 + | crate::protocol_serde::shape_top_level::de_top_level(tokens)?
|
122 + | {
|
123 + | builder = builder.set_top_level(v);
|
124 + | }
|
126 125 | }
|
127 126 | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
128 127 | }
|
129 128 | }
|
130 129 | other => {
|
131 130 | return Err(
|
132 131 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
133 132 | "expected object key or end object, found: {:?}",
|
134 133 | other
|
135 134 | )),
|