133 137 | ::std::borrow::Cow::Owned(rcb)
|
134 138 | }
|
135 139 | }
|
136 140 |
|
137 141 | #[derive(Debug)]
|
138 142 | struct MalformedDoubleResponseDeserializer;
|
139 143 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedDoubleResponseDeserializer {
|
140 144 | fn deserialize_nonstreaming(
|
141 145 | &self,
|
142 146 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
147 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
143 148 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
144 149 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
150 + | #[allow(unused_mut)]
|
151 + | let mut force_error = false;
|
152 + |
|
153 + | if !success && status != 200 || force_error {
|
145 154 | let headers = response.headers();
|
146 155 | let body = response.body().bytes().expect("body loaded");
|
147 156 | #[allow(unused_mut)]
|
148 - | let mut force_error = false;
|
157 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
158 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
159 + | })?;
|
149 160 |
|
150 - | let parse_result = if !success && status != 200 || force_error {
|
151 - | crate::protocol_serde::shape_malformed_double::de_malformed_double_http_error(status, headers, body)
|
161 + | let generic = generic_builder.build();
|
162 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
163 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
|
164 + | crate::operation::malformed_double::MalformedDoubleError::generic(generic),
|
165 + | ),
|
166 + | ))
|
152 167 | } else {
|
153 - | crate::protocol_serde::shape_malformed_double::de_malformed_double_http_response(status, headers, body)
|
154 - | };
|
155 - | crate::protocol_serde::type_erase_result(parse_result)
|
168 + | let protocol = _cfg
|
169 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
170 + | .expect("a SharedClientProtocol is required");
|
171 + | let mut deser = protocol
|
172 + | .deserialize_response(response, MalformedDouble::OUTPUT_SCHEMA, _cfg)
|
173 + | .map_err(|e| {
|
174 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
175 + | })?;
|
176 + | let body = response.body().bytes().expect("body loaded");
|
177 + | let output = crate::operation::malformed_double::MalformedDoubleOutput::deserialize_with_response(
|
178 + | &mut *deser,
|
179 + | response.headers(),
|
180 + | response.status().into(),
|
181 + | body,
|
182 + | )
|
183 + | .map_err(|e| {
|
184 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
185 + | })?;
|
186 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
187 + | }
|
156 188 | }
|
157 189 | }
|
158 190 | #[derive(Debug)]
|
159 191 | struct MalformedDoubleRequestSerializer;
|
160 192 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedDoubleRequestSerializer {
|
161 193 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
162 194 | fn serialize_input(
|
163 195 | &self,
|
164 196 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
165 197 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
166 198 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
167 199 | let input = input
|
168 200 | .downcast::<crate::operation::malformed_double::MalformedDoubleInput>()
|
169 201 | .expect("correct type");
|
170 - | let _header_serialization_settings = _cfg
|
171 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
172 - | .cloned()
|
173 - | .unwrap_or_default();
|
174 - | let mut request_builder = {
|
175 - | #[allow(clippy::uninlined_format_args)]
|
176 - | fn uri_base(
|
177 - | _input: &crate::operation::malformed_double::MalformedDoubleInput,
|
178 - | output: &mut ::std::string::String,
|
179 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
180 - | use ::std::fmt::Write as _;
|
181 - | let input_1 = &_input.double_in_path;
|
182 - | let input_1 = input_1
|
183 - | .as_ref()
|
184 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("double_in_path", "cannot be empty or unset"))?;
|
185 - | let mut double_in_path_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_1);
|
186 - | let double_in_path = double_in_path_encoder.encode();
|
187 - | if double_in_path.is_empty() {
|
188 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
189 - | "double_in_path",
|
190 - | "cannot be empty or unset",
|
191 - | ));
|
192 - | }
|
193 - | ::std::write!(output, "/MalformedDouble/{doubleInPath}", doubleInPath = double_in_path).expect("formatting should succeed");
|
194 - | ::std::result::Result::Ok(())
|
195 - | }
|
196 - | fn uri_query(
|
197 - | _input: &crate::operation::malformed_double::MalformedDoubleInput,
|
198 - | mut output: &mut ::std::string::String,
|
199 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
200 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
201 - | if let ::std::option::Option::Some(inner_2) = &_input.double_in_query {
|
202 + | let protocol = _cfg
|
203 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
204 + | .expect("a SharedClientProtocol is required");
|
205 + | if protocol.supports_http_bindings() {
|
206 + | let mut request = protocol
|
207 + | .serialize_body(&input, MalformedDouble::INPUT_SCHEMA, "", _cfg)
|
208 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
202 209 | {
|
203 - | query.push_kv("doubleInQuery", ::aws_smithy_types::primitive::Encoder::from(*inner_2).encode());
|
204 - | }
|
210 + | let mut uri = "/MalformedDouble/{doubleInPath}".to_string();
|
211 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
212 + | if let Some(ref val) = input.double_in_path {
|
213 + | uri = uri.replace(
|
214 + | "{doubleInPath}",
|
215 + | &::aws_smithy_schema::http_protocol::percent_encode(&{
|
216 + | let s = val.to_string();
|
217 + | match s.as_str() {
|
218 + | "inf" => "Infinity".to_string(),
|
219 + | "-inf" => "-Infinity".to_string(),
|
220 + | _ => s,
|
221 + | }
|
222 + | }),
|
223 + | );
|
224 + | }
|
225 + | if let Some(ref val) = input.double_in_query {
|
226 + | query_params.push(("doubleInQuery".to_string(), {
|
227 + | let s = val.to_string();
|
228 + | match s.as_str() {
|
229 + | "inf" => "Infinity".to_string(),
|
230 + | "-inf" => "-Infinity".to_string(),
|
231 + | _ => s,
|
232 + | }
|
233 + | }));
|
234 + | }
|
235 + | if let Some(ref val) = input.double_in_header {
|
236 + | request.headers_mut().insert("doubleInHeader", {
|
237 + | let s = val.to_string();
|
238 + | match s.as_str() {
|
239 + | "inf" => "Infinity".to_string(),
|
240 + | "-inf" => "-Infinity".to_string(),
|
241 + | _ => s,
|
242 + | }
|
243 + | });
|
244 + | }
|
245 + | if !query_params.is_empty() {
|
246 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
247 + | let pairs: Vec<String> = query_params
|
248 + | .iter()
|
249 + | .map(|(k, v)| {
|
250 + | format!(
|
251 + | "{}={}",
|
252 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
253 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
254 + | )
|
255 + | })
|
256 + | .collect();
|
257 + | uri.push_str(&pairs.join("&"));
|
205 258 | }
|
206 - | ::std::result::Result::Ok(())
|
259 + | request.set_uri(uri.as_str()).expect("valid URI");
|
207 260 | }
|
208 - | #[allow(clippy::unnecessary_wraps)]
|
209 - | fn update_http_builder(
|
210 - | input: &crate::operation::malformed_double::MalformedDoubleInput,
|
211 - | builder: ::http_1x::request::Builder,
|
212 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
213 - | let mut uri = ::std::string::String::new();
|
214 - | uri_base(input, &mut uri)?;
|
215 - | uri_query(input, &mut uri)?;
|
216 - | let builder = crate::protocol_serde::shape_malformed_double::ser_malformed_double_headers(input, builder)?;
|
217 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
218 - | }
|
219 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
220 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
221 - | builder
|
222 - | };
|
223 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_malformed_double::ser_malformed_double_input(&input)?);
|
224 - | if let Some(content_length) = body.content_length() {
|
225 - | let content_length = content_length.to_string();
|
226 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
261 + |
|
262 + | return ::std::result::Result::Ok(request);
|
263 + | } else {
|
264 + | let mut request = protocol
|
265 + | .serialize_request(&input, MalformedDouble::INPUT_SCHEMA, "", _cfg)
|
266 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
267 + |
|
268 + | return ::std::result::Result::Ok(request);
|
227 269 | }
|
228 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
229 270 | }
|
230 271 | }
|
231 272 | #[derive(Debug)]
|
232 273 | struct MalformedDoubleEndpointParamsInterceptor;
|
233 274 |
|
234 275 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedDoubleEndpointParamsInterceptor {
|
235 276 | fn name(&self) -> &'static str {
|
236 277 | "MalformedDoubleEndpointParamsInterceptor"
|
237 278 | }
|
238 279 |
|