1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_escaped_string_values_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::escaped_string_values::EscapedStringValuesOutput,
|
9 - | crate::operation::escaped_string_values::EscapedStringValuesError,
|
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::escaped_string_values::EscapedStringValuesError::unhandled)?;
|
14 - | let generic = generic_builder.build();
|
15 - | let error_code = match generic.code() {
|
16 - | Some(code) => code,
|
17 - | None => return Err(crate::operation::escaped_string_values::EscapedStringValuesError::unhandled(generic)),
|
18 - | };
|
19 - |
|
20 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
21 - | Err(match error_code {
|
22 - | "ValidationException" => crate::operation::escaped_string_values::EscapedStringValuesError::ValidationError({
|
23 - | #[allow(unused_mut)]
|
24 - | let mut tmp = {
|
25 - | #[allow(unused_mut)]
|
26 - | let mut output = crate::types::error::builders::ValidationErrorBuilder::default();
|
27 - | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
28 - | .map_err(crate::operation::escaped_string_values::EscapedStringValuesError::unhandled)?;
|
29 - | let output = output.meta(generic);
|
30 - | crate::serde_util::validation_exception_correct_errors(output)
|
31 - | .build()
|
32 - | .map_err(crate::operation::escaped_string_values::EscapedStringValuesError::unhandled)?
|
33 - | };
|
34 - | tmp
|
35 - | }),
|
36 - | "ExtraError" => crate::operation::escaped_string_values::EscapedStringValuesError::ExtraError({
|
37 - | #[allow(unused_mut)]
|
38 - | let mut tmp = {
|
39 - | #[allow(unused_mut)]
|
40 - | let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
|
41 - | output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
|
42 - | .map_err(crate::operation::escaped_string_values::EscapedStringValuesError::unhandled)?;
|
43 - | let output = output.meta(generic);
|
44 - | output.build()
|
45 - | };
|
46 - | if tmp.message.is_none() {
|
47 - | tmp.message = _error_message;
|
48 - | }
|
49 - | tmp
|
50 - | }),
|
51 - | _ => crate::operation::escaped_string_values::EscapedStringValuesError::generic(generic),
|
52 - | })
|
53 - | }
|
54 - |
|
55 - | #[allow(clippy::unnecessary_wraps)]
|
56 - | pub fn de_escaped_string_values_http_response(
|
57 - | _response_status: u16,
|
58 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
59 - | _response_body: &[u8],
|
60 - | ) -> std::result::Result<
|
61 - | crate::operation::escaped_string_values::EscapedStringValuesOutput,
|
62 - | crate::operation::escaped_string_values::EscapedStringValuesError,
|
63 - | > {
|
64 - | Ok({
|
65 - | #[allow(unused_mut)]
|
66 - | let mut output = crate::operation::escaped_string_values::builders::EscapedStringValuesOutputBuilder::default();
|
67 - | output = crate::protocol_serde::shape_escaped_string_values::de_escaped_string_values(_response_body, output)
|
68 - | .map_err(crate::operation::escaped_string_values::EscapedStringValuesError::unhandled)?;
|
69 - | output.build()
|
70 - | })
|
71 - | }
|
72 - |
|
73 - | pub fn ser_escaped_string_values_input(
|
74 - | input: &crate::operation::escaped_string_values::EscapedStringValuesInput,
|
75 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
76 - | let mut out = String::new();
|
77 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
78 - | crate::protocol_serde::shape_escaped_string_values_input::ser_escaped_string_values_input_input(&mut object, input)?;
|
79 - | object.finish();
|
80 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
81 - | }
|
82 - |
|
83 - | pub(crate) fn de_escaped_string_values(
|
84 - | _value: &[u8],
|
85 - | mut builder: crate::operation::escaped_string_values::builders::EscapedStringValuesOutputBuilder,
|
86 - | ) -> ::std::result::Result<
|
87 - | crate::operation::escaped_string_values::builders::EscapedStringValuesOutputBuilder,
|
88 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
89 - | > {
|
90 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
91 - | let tokens = &mut tokens_owned;
|
92 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
93 - | loop {
|
94 - | match tokens.next().transpose()? {
|
95 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
96 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
97 - | "enum" => {
|
98 - | builder = builder.set_enum(
|
99 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
100 - | .map(|s| s.to_unescaped().map(|u| crate::types::EnumWithEscapedChars::from(u.as_ref())))
|
101 - | .transpose()?,
|
102 - | );
|
103 - | }
|
104 - | "also\"has\"quotes" => {
|
105 - | builder = builder.set_some_string(
|
106 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
107 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
108 - | .transpose()?,
|
109 - | );
|
110 - | }
|
111 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
112 - | },
|
113 - | other => {
|
114 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
115 - | "expected object key or end object, found: {other:?}"
|
116 - | )))
|
117 - | }
|
118 - | }
|
119 - | }
|
120 - | if tokens.next().is_some() {
|
121 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
122 - | "found more JSON tokens after completing parsing",
|
123 - | ));
|
124 - | }
|
125 - | Ok(builder)
|
126 - | }
|