124 128 | crate::operation::malformed_short::MalformedShortError,
|
125 129 | >::new());
|
126 130 |
|
127 131 | ::std::borrow::Cow::Owned(rcb)
|
128 132 | }
|
129 133 | }
|
130 134 |
|
131 135 | #[derive(Debug)]
|
132 136 | struct MalformedShortResponseDeserializer;
|
133 137 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedShortResponseDeserializer {
|
134 - | fn deserialize_nonstreaming(
|
138 + | fn deserialize_nonstreaming_with_config(
|
135 139 | &self,
|
136 140 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
141 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
137 142 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
138 143 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
144 + | #[allow(unused_mut)]
|
145 + | let mut force_error = false;
|
146 + |
|
147 + | if !success && status != 200 || force_error {
|
139 148 | let headers = response.headers();
|
140 149 | let body = response.body().bytes().expect("body loaded");
|
141 150 | #[allow(unused_mut)]
|
142 - | let mut force_error = false;
|
151 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
152 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
153 + | })?;
|
143 154 |
|
144 - | let parse_result = if !success && status != 200 || force_error {
|
145 - | crate::protocol_serde::shape_malformed_short::de_malformed_short_http_error(status, headers, body)
|
155 + | let generic = generic_builder.build();
|
156 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
157 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
|
158 + | crate::operation::malformed_short::MalformedShortError::generic(generic),
|
159 + | ),
|
160 + | ))
|
146 161 | } else {
|
147 - | crate::protocol_serde::shape_malformed_short::de_malformed_short_http_response(status, headers, body)
|
148 - | };
|
149 - | crate::protocol_serde::type_erase_result(parse_result)
|
162 + | let protocol = _cfg
|
163 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
164 + | .expect("a SharedClientProtocol is required");
|
165 + | let mut deser = protocol
|
166 + | .deserialize_response(response, MalformedShort::OUTPUT_SCHEMA, _cfg)
|
167 + | .map_err(|e| {
|
168 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
169 + | })?;
|
170 + | let body = response.body().bytes().expect("body loaded");
|
171 + | let output = crate::operation::malformed_short::MalformedShortOutput::deserialize_with_response(
|
172 + | &mut *deser,
|
173 + | response.headers(),
|
174 + | response.status().into(),
|
175 + | body,
|
176 + | )
|
177 + | .map_err(|e| {
|
178 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
179 + | })?;
|
180 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
181 + | }
|
150 182 | }
|
151 183 | }
|
152 184 | #[derive(Debug)]
|
153 185 | struct MalformedShortRequestSerializer;
|
154 186 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedShortRequestSerializer {
|
155 187 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
156 188 | fn serialize_input(
|
157 189 | &self,
|
158 190 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
159 191 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
160 192 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
161 193 | let input = input
|
162 194 | .downcast::<crate::operation::malformed_short::MalformedShortInput>()
|
163 195 | .expect("correct type");
|
164 - | let _header_serialization_settings = _cfg
|
165 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
166 - | .cloned()
|
167 - | .unwrap_or_default();
|
168 - | let mut request_builder = {
|
169 - | #[allow(clippy::uninlined_format_args)]
|
170 - | fn uri_base(
|
171 - | _input: &crate::operation::malformed_short::MalformedShortInput,
|
172 - | output: &mut ::std::string::String,
|
173 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
174 - | use ::std::fmt::Write as _;
|
175 - | let input_1 = &_input.short_in_path;
|
176 - | let input_1 = input_1
|
177 - | .as_ref()
|
178 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("short_in_path", "cannot be empty or unset"))?;
|
179 - | let mut short_in_path_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_1);
|
180 - | let short_in_path = short_in_path_encoder.encode();
|
181 - | if short_in_path.is_empty() {
|
182 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
183 - | "short_in_path",
|
184 - | "cannot be empty or unset",
|
185 - | ));
|
186 - | }
|
187 - | ::std::write!(output, "/MalformedShort/{shortInPath}", shortInPath = short_in_path).expect("formatting should succeed");
|
188 - | ::std::result::Result::Ok(())
|
189 - | }
|
190 - | fn uri_query(
|
191 - | _input: &crate::operation::malformed_short::MalformedShortInput,
|
192 - | mut output: &mut ::std::string::String,
|
193 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
194 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
195 - | if let ::std::option::Option::Some(inner_2) = &_input.short_in_query {
|
196 - | {
|
197 - | query.push_kv("shortInQuery", ::aws_smithy_types::primitive::Encoder::from(*inner_2).encode());
|
198 - | }
|
199 - | }
|
200 - | ::std::result::Result::Ok(())
|
201 - | }
|
202 - | #[allow(clippy::unnecessary_wraps)]
|
203 - | fn update_http_builder(
|
204 - | input: &crate::operation::malformed_short::MalformedShortInput,
|
205 - | builder: ::http_1x::request::Builder,
|
206 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
207 - | let mut uri = ::std::string::String::new();
|
208 - | uri_base(input, &mut uri)?;
|
209 - | uri_query(input, &mut uri)?;
|
210 - | let builder = crate::protocol_serde::shape_malformed_short::ser_malformed_short_headers(input, builder)?;
|
211 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
212 - | }
|
213 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
214 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
215 - | builder
|
216 - | };
|
217 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_malformed_short::ser_malformed_short_input(&input)?);
|
218 - | if let Some(content_length) = body.content_length() {
|
219 - | let content_length = content_length.to_string();
|
220 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
221 - | }
|
222 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
196 + | let protocol = _cfg
|
197 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
198 + | .expect("a SharedClientProtocol is required");
|
199 + | let mut request = protocol
|
200 + | .serialize_request(&input, MalformedShort::INPUT_SCHEMA, "", _cfg)
|
201 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
202 + |
|
203 + | return ::std::result::Result::Ok(request);
|
223 204 | }
|
224 205 | }
|
225 206 | #[derive(Debug)]
|
226 207 | struct MalformedShortEndpointParamsInterceptor;
|
227 208 |
|
228 209 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedShortEndpointParamsInterceptor {
|
229 210 | fn name(&self) -> &'static str {
|
230 211 | "MalformedShortEndpointParamsInterceptor"
|
231 212 | }
|
232 213 |
|