1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_greeting_with_errors_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<
|
8 - | crate::operation::greeting_with_errors::GreetingWithErrorsOutput,
|
9 - | crate::operation::greeting_with_errors::GreetingWithErrorsError,
|
10 - | > {
|
11 - | #[allow(unused_mut)]
|
12 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
13 - | .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
|
14 - | let generic = generic_builder.build();
|
15 - | let error_code = match generic.code() {
|
16 - | Some(code) => code,
|
17 - | None => return Err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled(generic)),
|
18 - | };
|
19 - |
|
20 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
21 - | Err(match error_code {
|
22 - | "InvalidGreeting" => crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting({
|
23 - | #[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 - | };
|
32 - | if tmp.message.is_none() {
|
33 - | tmp.message = _error_message;
|
34 - | }
|
35 - | tmp
|
36 - | }),
|
37 - | "ComplexError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError({
|
38 - | #[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 - | };
|
47 - | if tmp.message.is_none() {
|
48 - | tmp.message = _error_message;
|
49 - | }
|
50 - | tmp
|
51 - | }),
|
52 - | "FooError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError({
|
53 - | #[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 - | };
|
62 - | if tmp.message.is_none() {
|
63 - | tmp.message = _error_message;
|
64 - | }
|
65 - | tmp
|
66 - | }),
|
67 - | _ => crate::operation::greeting_with_errors::GreetingWithErrorsError::generic(generic),
|
68 - | })
|
69 - | }
|
70 - |
|
71 - | #[allow(clippy::unnecessary_wraps)]
|
72 - | pub fn de_greeting_with_errors_http_response(
|
73 - | _response_status: u16,
|
74 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
75 - | _response_body: &[u8],
|
76 - | ) -> std::result::Result<
|
77 - | crate::operation::greeting_with_errors::GreetingWithErrorsOutput,
|
78 - | crate::operation::greeting_with_errors::GreetingWithErrorsError,
|
79 - | > {
|
80 - | Ok({
|
81 - | #[allow(unused_mut)]
|
82 - | let mut output = crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder::default();
|
83 - | output = crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors(_response_body, output)
|
84 - | .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
|
85 - | output.build()
|
86 - | })
|
87 - | }
|
88 - |
|
89 - | pub fn ser_greeting_with_errors_input(
|
90 - | _input: &crate::operation::greeting_with_errors::GreetingWithErrorsInput,
|
91 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
92 - | Ok(::aws_smithy_types::body::SdkBody::from("{}"))
|
93 - | }
|
94 - |
|
95 - | pub(crate) fn de_greeting_with_errors(
|
96 - | _value: &[u8],
|
97 - | mut builder: crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder,
|
98 - | ) -> ::std::result::Result<
|
99 - | crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder,
|
100 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
101 - | > {
|
102 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
103 - | let tokens = &mut tokens_owned;
|
104 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
105 - | loop {
|
106 - | 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 - | );
|
115 - | }
|
116 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
117 - | },
|
118 - | other => {
|
119 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
120 - | "expected object key or end object, found: {other:?}"
|
121 - | )))
|
122 - | }
|
123 - | }
|
124 - | }
|
125 - | if tokens.next().is_some() {
|
126 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
127 - | "found more JSON tokens after completing parsing",
|
128 - | ));
|
129 - | }
|
130 - | Ok(builder)
|
131 - | }
|