1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_operation_with_defaults_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::operation_with_defaults::OperationWithDefaultsOutput,
|
9 - | crate::operation::operation_with_defaults::OperationWithDefaultsError,
|
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::operation_with_defaults::OperationWithDefaultsError::unhandled)?;
|
14 - | let generic = generic_builder.build();
|
15 - | Err(crate::operation::operation_with_defaults::OperationWithDefaultsError::generic(generic))
|
16 - | }
|
17 - |
|
18 - | #[allow(clippy::unnecessary_wraps)]
|
19 - | pub fn de_operation_with_defaults_http_response(
|
20 - | _response_status: u16,
|
21 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
22 - | _response_body: &[u8],
|
23 - | ) -> std::result::Result<
|
24 - | crate::operation::operation_with_defaults::OperationWithDefaultsOutput,
|
25 - | crate::operation::operation_with_defaults::OperationWithDefaultsError,
|
26 - | > {
|
27 - | Ok({
|
28 - | #[allow(unused_mut)]
|
29 - | let mut output = crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder::default();
|
30 - | output = crate::protocol_serde::shape_operation_with_defaults::de_operation_with_defaults(_response_body, output)
|
31 - | .map_err(crate::operation::operation_with_defaults::OperationWithDefaultsError::unhandled)?;
|
32 - | output.build()
|
33 - | })
|
34 - | }
|
35 - |
|
36 - | pub fn ser_operation_with_defaults_input(
|
37 - | input: &crate::operation::operation_with_defaults::OperationWithDefaultsInput,
|
38 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
39 - | let mut out = String::new();
|
40 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
41 - | crate::protocol_serde::shape_operation_with_defaults_input::ser_operation_with_defaults_input_input(&mut object, input)?;
|
42 - | object.finish();
|
43 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
44 - | }
|
45 - |
|
46 - | pub(crate) fn de_operation_with_defaults(
|
47 - | _value: &[u8],
|
48 - | mut builder: crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder,
|
49 - | ) -> ::std::result::Result<
|
50 - | crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder,
|
51 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
52 - | > {
|
53 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
54 - | let tokens = &mut tokens_owned;
|
55 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
56 - | loop {
|
57 - | match tokens.next().transpose()? {
|
58 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
59 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
60 - | "defaultString" => {
|
61 - | builder = builder.set_default_string(
|
62 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
63 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
64 - | .transpose()?,
|
65 - | );
|
66 - | }
|
67 - | "defaultBoolean" => {
|
68 - | builder = builder.set_default_boolean(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
69 - | }
|
70 - | "defaultList" => {
|
71 - | builder = builder.set_default_list(crate::protocol_serde::shape_test_string_list::de_test_string_list(tokens, _value)?);
|
72 - | }
|
73 - | "defaultDocumentMap" => {
|
74 - | builder = builder.set_default_document_map(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
|
75 - | }
|
76 - | "defaultDocumentString" => {
|
77 - | builder = builder.set_default_document_string(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
|
78 - | }
|
79 - | "defaultDocumentBoolean" => {
|
80 - | builder = builder.set_default_document_boolean(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
|
81 - | }
|
82 - | "defaultDocumentList" => {
|
83 - | builder = builder.set_default_document_list(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
|
84 - | }
|
85 - | "defaultNullDocument" => {
|
86 - | builder = builder.set_default_null_document(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
|
87 - | }
|
88 - | "defaultTimestamp" => {
|
89 - | builder = builder.set_default_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
90 - | tokens.next(),
|
91 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
92 - | )?);
|
93 - | }
|
94 - | "defaultBlob" => {
|
95 - | builder = builder.set_default_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
|
96 - | }
|
97 - | "defaultByte" => {
|
98 - | builder = builder.set_default_byte(
|
99 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
100 - | .map(i8::try_from)
|
101 - | .transpose()?,
|
102 - | );
|
103 - | }
|
104 - | "defaultShort" => {
|
105 - | builder = builder.set_default_short(
|
106 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
107 - | .map(i16::try_from)
|
108 - | .transpose()?,
|
109 - | );
|
110 - | }
|
111 - | "defaultInteger" => {
|
112 - | builder = builder.set_default_integer(
|
113 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
114 - | .map(i32::try_from)
|
115 - | .transpose()?,
|
116 - | );
|
117 - | }
|
118 - | "defaultLong" => {
|
119 - | builder = builder.set_default_long(
|
120 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
121 - | .map(i64::try_from)
|
122 - | .transpose()?,
|
123 - | );
|
124 - | }
|
125 - | "defaultFloat" => {
|
126 - | builder = builder
|
127 - | .set_default_float(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
|
128 - | }
|
129 - | "defaultDouble" => {
|
130 - | builder = builder
|
131 - | .set_default_double(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
|
132 - | }
|
133 - | "defaultMap" => {
|
134 - | builder = builder.set_default_map(crate::protocol_serde::shape_test_string_map::de_test_string_map(tokens, _value)?);
|
135 - | }
|
136 - | "defaultEnum" => {
|
137 - | builder = builder.set_default_enum(
|
138 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
139 - | .map(|s| s.to_unescaped().map(|u| crate::types::TestEnum::from(u.as_ref())))
|
140 - | .transpose()?,
|
141 - | );
|
142 - | }
|
143 - | "defaultIntEnum" => {
|
144 - | builder = builder.set_default_int_enum(
|
145 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
146 - | .map(i32::try_from)
|
147 - | .transpose()?,
|
148 - | );
|
149 - | }
|
150 - | "emptyString" => {
|
151 - | builder = builder.set_empty_string(
|
152 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
153 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
154 - | .transpose()?,
|
155 - | );
|
156 - | }
|
157 - | "falseBoolean" => {
|
158 - | builder = builder.set_false_boolean(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
159 - | }
|
160 - | "emptyBlob" => {
|
161 - | builder = builder.set_empty_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
|
162 - | }
|
163 - | "zeroByte" => {
|
164 - | builder = builder.set_zero_byte(
|
165 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
166 - | .map(i8::try_from)
|
167 - | .transpose()?,
|
168 - | );
|
169 - | }
|
170 - | "zeroShort" => {
|
171 - | builder = builder.set_zero_short(
|
172 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
173 - | .map(i16::try_from)
|
174 - | .transpose()?,
|
175 - | );
|
176 - | }
|
177 - | "zeroInteger" => {
|
178 - | builder = builder.set_zero_integer(
|
179 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
180 - | .map(i32::try_from)
|
181 - | .transpose()?,
|
182 - | );
|
183 - | }
|
184 - | "zeroLong" => {
|
185 - | builder = builder.set_zero_long(
|
186 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
187 - | .map(i64::try_from)
|
188 - | .transpose()?,
|
189 - | );
|
190 - | }
|
191 - | "zeroFloat" => {
|
192 - | builder = builder
|
193 - | .set_zero_float(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
|
194 - | }
|
195 - | "zeroDouble" => {
|
196 - | builder = builder
|
197 - | .set_zero_double(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
|
198 - | }
|
199 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
200 - | },
|
201 - | other => {
|
202 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
203 - | "expected object key or end object, found: {other:?}"
|
204 - | )))
|
205 - | }
|
206 - | }
|
207 - | }
|
208 - | if tokens.next().is_some() {
|
209 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
210 - | "found more JSON tokens after completing parsing",
|
211 - | ));
|
212 - | }
|
213 - | Ok(builder)
|
214 - | }
|