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 + | /* ProtocolParserGenerator.kt:99 */
|
3 5 | pub fn de_greeting_with_errors_http_error(
|
4 6 | _response_status: u16,
|
5 7 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 8 | _response_body: &[u8],
|
7 9 | ) -> std::result::Result<
|
8 10 | crate::operation::greeting_with_errors::GreetingWithErrorsOutput,
|
9 11 | crate::operation::greeting_with_errors::GreetingWithErrorsError,
|
10 12 | > {
|
13 + | /* RustType.kt:516 */
|
11 14 | #[allow(unused_mut)]
|
15 + | /* ProtocolParserGenerator.kt:106 */
|
12 16 | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
13 17 | .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
|
18 + | /* ProtocolParserGenerator.kt:120 */
|
14 19 | let generic = generic_builder.build();
|
20 + | /* ProtocolParserGenerator.kt:122 */
|
15 21 | let error_code = match generic.code() {
|
16 22 | Some(code) => code,
|
17 23 | None => return Err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled(generic)),
|
18 24 | };
|
19 25 |
|
20 26 | let _error_message = generic.message().map(|msg| msg.to_owned());
|
27 + | /* ProtocolParserGenerator.kt:133 */
|
21 28 | Err(match error_code {
|
29 + | /* ProtocolParserGenerator.kt:139 */
|
22 30 | "InvalidGreeting" => crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting({
|
31 + | /* RustType.kt:516 */
|
23 32 | #[allow(unused_mut)]
|
24 - | let mut tmp = {
|
25 - | #[allow(unused_mut)]
|
26 - | let mut output = crate::types::error::builders::InvalidGreetingBuilder::default();
|
27 - | output = crate::protocol_serde::shape_invalid_greeting::de_invalid_greeting_json_err(_response_body, output)
|
28 - | .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
|
29 - | let output = output.meta(generic);
|
30 - | output.build()
|
31 - | };
|
33 + | /* ProtocolParserGenerator.kt:145 */let mut tmp =
|
34 + | /* ProtocolParserGenerator.kt:146 */ {
|
35 + | /* RustType.kt:516 */#[allow(unused_mut)]
|
36 + | /* ProtocolParserGenerator.kt:240 */let mut output = crate::types::error::builders::InvalidGreetingBuilder::default();
|
37 + | /* ProtocolParserGenerator.kt:257 */output = crate::protocol_serde::shape_invalid_greeting::de_invalid_greeting_json_err(_response_body, output).map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
|
38 + | /* ProtocolParserGenerator.kt:157 */let output = output.meta(generic);
|
39 + | /* ClientBuilderInstantiator.kt:56 */output.build()
|
40 + | /* ProtocolParserGenerator.kt:146 */}
|
41 + | /* ProtocolParserGenerator.kt:145 */;
|
42 + | /* ProtocolParserGenerator.kt:170 */
|
32 43 | if tmp.message.is_none() {
|
33 44 | tmp.message = _error_message;
|
34 45 | }
|
46 + | /* ProtocolParserGenerator.kt:179 */
|
35 47 | tmp
|
48 + | /* ProtocolParserGenerator.kt:139 */
|
36 49 | }),
|
50 + | /* ProtocolParserGenerator.kt:139 */
|
37 51 | "ComplexError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError({
|
52 + | /* RustType.kt:516 */
|
38 53 | #[allow(unused_mut)]
|
39 - | let mut tmp = {
|
40 - | #[allow(unused_mut)]
|
41 - | let mut output = crate::types::error::builders::ComplexErrorBuilder::default();
|
42 - | output = crate::protocol_serde::shape_complex_error::de_complex_error_json_err(_response_body, output)
|
43 - | .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
|
44 - | let output = output.meta(generic);
|
45 - | output.build()
|
46 - | };
|
54 + | /* ProtocolParserGenerator.kt:145 */let mut tmp =
|
55 + | /* ProtocolParserGenerator.kt:146 */ {
|
56 + | /* RustType.kt:516 */#[allow(unused_mut)]
|
57 + | /* ProtocolParserGenerator.kt:240 */let mut output = crate::types::error::builders::ComplexErrorBuilder::default();
|
58 + | /* ProtocolParserGenerator.kt:257 */output = crate::protocol_serde::shape_complex_error::de_complex_error_json_err(_response_body, output).map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
|
59 + | /* ProtocolParserGenerator.kt:157 */let output = output.meta(generic);
|
60 + | /* ClientBuilderInstantiator.kt:56 */output.build()
|
61 + | /* ProtocolParserGenerator.kt:146 */}
|
62 + | /* ProtocolParserGenerator.kt:145 */;
|
63 + | /* ProtocolParserGenerator.kt:170 */
|
47 64 | if tmp.message.is_none() {
|
48 65 | tmp.message = _error_message;
|
49 66 | }
|
67 + | /* ProtocolParserGenerator.kt:179 */
|
50 68 | tmp
|
69 + | /* ProtocolParserGenerator.kt:139 */
|
51 70 | }),
|
71 + | /* ProtocolParserGenerator.kt:139 */
|
52 72 | "FooError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError({
|
73 + | /* RustType.kt:516 */
|
53 74 | #[allow(unused_mut)]
|
54 - | let mut tmp = {
|
55 - | #[allow(unused_mut)]
|
56 - | let mut output = crate::types::error::builders::FooErrorBuilder::default();
|
57 - | output = crate::protocol_serde::shape_foo_error::de_foo_error_json_err(_response_body, output)
|
58 - | .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
|
59 - | let output = output.meta(generic);
|
60 - | output.build()
|
61 - | };
|
75 + | /* ProtocolParserGenerator.kt:145 */let mut tmp =
|
76 + | /* ProtocolParserGenerator.kt:146 */ {
|
77 + | /* RustType.kt:516 */#[allow(unused_mut)]
|
78 + | /* ProtocolParserGenerator.kt:240 */let mut output = crate::types::error::builders::FooErrorBuilder::default();
|
79 + | /* ProtocolParserGenerator.kt:257 */output = crate::protocol_serde::shape_foo_error::de_foo_error_json_err(_response_body, output).map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
|
80 + | /* ProtocolParserGenerator.kt:157 */let output = output.meta(generic);
|
81 + | /* ClientBuilderInstantiator.kt:56 */output.build()
|
82 + | /* ProtocolParserGenerator.kt:146 */}
|
83 + | /* ProtocolParserGenerator.kt:145 */;
|
84 + | /* ProtocolParserGenerator.kt:170 */
|
62 85 | if tmp.message.is_none() {
|
63 86 | tmp.message = _error_message;
|
64 87 | }
|
88 + | /* ProtocolParserGenerator.kt:179 */
|
65 89 | tmp
|
90 + | /* ProtocolParserGenerator.kt:139 */
|
66 91 | }),
|
67 - | _ => crate::operation::greeting_with_errors::GreetingWithErrorsError::generic(generic),
|
92 + | /* ProtocolParserGenerator.kt:182 */
|
93 + | _ => crate::operation::greeting_with_errors::GreetingWithErrorsError::generic(generic), /* ProtocolParserGenerator.kt:133 */
|
68 94 | })
|
95 + | /* ProtocolParserGenerator.kt:99 */
|
69 96 | }
|
70 97 |
|
98 + | /* RustType.kt:516 */
|
71 99 | #[allow(clippy::unnecessary_wraps)]
|
100 + | /* ProtocolParserGenerator.kt:71 */
|
72 101 | pub fn de_greeting_with_errors_http_response(
|
73 102 | _response_status: u16,
|
74 103 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
75 104 | _response_body: &[u8],
|
76 105 | ) -> std::result::Result<
|
77 106 | crate::operation::greeting_with_errors::GreetingWithErrorsOutput,
|
78 107 | crate::operation::greeting_with_errors::GreetingWithErrorsError,
|
79 108 | > {
|
109 + | /* ProtocolParserGenerator.kt:77 */
|
80 110 | Ok({
|
111 + | /* RustType.kt:516 */
|
81 112 | #[allow(unused_mut)]
|
113 + | /* ProtocolParserGenerator.kt:240 */
|
82 114 | let mut output = crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder::default();
|
115 + | /* ProtocolParserGenerator.kt:247 */
|
83 116 | output = crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors(_response_body, output)
|
84 117 | .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
|
118 + | /* ClientBuilderInstantiator.kt:56 */
|
85 119 | output.build()
|
120 + | /* ProtocolParserGenerator.kt:77 */
|
86 121 | })
|
122 + | /* ProtocolParserGenerator.kt:71 */
|
87 123 | }
|
88 124 |
|
125 + | /* AwsJson.kt:152 */
|
89 126 | pub fn ser_greeting_with_errors_input(
|
90 127 | _input: &crate::operation::greeting_with_errors::GreetingWithErrorsInput,
|
91 128 | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
129 + | /* AwsJson.kt:156 */
|
92 130 | Ok(::aws_smithy_types::body::SdkBody::from("{}"))
|
131 + | /* AwsJson.kt:152 */
|
93 132 | }
|
94 133 |
|
134 + | /* JsonParserGenerator.kt:148 */
|
95 135 | pub(crate) fn de_greeting_with_errors(
|
96 136 | value: &[u8],
|
97 137 | mut builder: crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder,
|
98 138 | ) -> ::std::result::Result<
|
99 139 | crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder,
|
100 140 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
101 141 | > {
|
142 + | /* JsonParserGenerator.kt:153 */
|
102 143 | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
|
103 144 | let tokens = &mut tokens_owned;
|
104 145 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
146 + | /* JsonParserGenerator.kt:684 */
|
105 147 | loop {
|
148 + | /* JsonParserGenerator.kt:685 */
|
106 149 | match tokens.next().transpose()? {
|
107 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
108 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
109 - | "greeting" => {
|
110 - | builder = builder.set_greeting(
|
111 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
112 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
113 - | .transpose()?,
|
114 - | );
|
150 + | /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
151 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
152 + | /* JsonParserGenerator.kt:260 */
|
153 + | match key.to_unescaped()?.as_ref() {
|
154 + | /* JsonParserGenerator.kt:262 */
|
155 + | "greeting" => {
|
156 + | /* JsonParserGenerator.kt:265 */
|
157 + | builder = builder.set_greeting(
|
158 + | /* JsonParserGenerator.kt:354 */
|
159 + | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
160 + | .map(|s|
|
161 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
162 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
163 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
164 + | .transpose()?, /* JsonParserGenerator.kt:265 */
|
165 + | );
|
166 + | /* JsonParserGenerator.kt:262 */
|
167 + | }
|
168 + | /* JsonParserGenerator.kt:290 */
|
169 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
115 170 | }
|
116 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
117 - | },
|
171 + | /* JsonParserGenerator.kt:686 */
|
172 + | }
|
173 + | /* JsonParserGenerator.kt:695 */
|
118 174 | other => {
|
119 175 | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
120 176 | "expected object key or end object, found: {:?}",
|
121 177 | other
|
122 178 | )))
|
123 - | }
|
179 + | } /* JsonParserGenerator.kt:685 */
|
124 180 | }
|
181 + | /* JsonParserGenerator.kt:684 */
|
125 182 | }
|
183 + | /* JsonParserGenerator.kt:250 */
|
126 184 | if tokens.next().is_some() {
|
185 + | /* JsonParserGenerator.kt:251 */
|
127 186 | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
128 187 | "found more JSON tokens after completing parsing",
|
129 188 | ));
|
189 + | /* JsonParserGenerator.kt:250 */
|
130 190 | }
|
191 + | /* JsonParserGenerator.kt:163 */
|
131 192 | Ok(builder)
|
193 + | /* JsonParserGenerator.kt:148 */
|
132 194 | }
|