124 128 | crate::operation::enum_query::EnumQueryError,
|
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 EnumQueryResponseDeserializer;
|
133 137 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for EnumQueryResponseDeserializer {
|
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());
|
139 - | let headers = response.headers();
|
140 - | let body = response.body().bytes().expect("body loaded");
|
141 144 | #[allow(unused_mut)]
|
142 145 | let mut force_error = false;
|
143 146 |
|
144 - | let parse_result = if !success && status != 200 || force_error {
|
145 - | crate::protocol_serde::shape_enum_query::de_enum_query_http_error(status, headers, body)
|
147 + | if !success && status != 200 || force_error {
|
148 + | let headers = response.headers();
|
149 + | let body = response.body().bytes().expect("body loaded");
|
150 + | #[allow(unused_mut)]
|
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 + | })?;
|
154 + |
|
155 + | let generic = generic_builder.build();
|
156 + | let error_code = match generic.code() {
|
157 + | ::std::option::Option::Some(code) => code,
|
158 + | ::std::option::Option::None => {
|
159 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
160 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::enum_query::EnumQueryError::unhandled(generic)),
|
161 + | ))
|
162 + | }
|
163 + | };
|
164 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
165 + | let protocol = _cfg
|
166 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
167 + | .expect("a SharedClientProtocol is required");
|
168 + | let err = match error_code {
|
169 + | "ValidationException" => crate::operation::enum_query::EnumQueryError::ValidationError({
|
170 + | let mut tmp = match protocol
|
171 + | .deserialize_response(response, crate::types::error::ValidationError::SCHEMA, _cfg)
|
172 + | .and_then(|mut deser| {
|
173 + | crate::types::error::ValidationError::deserialize_with_response(
|
174 + | &mut *deser,
|
175 + | response.headers(),
|
176 + | response.status().into(),
|
177 + | body,
|
178 + | )
|
179 + | }) {
|
180 + | ::std::result::Result::Ok(val) => val,
|
181 + | ::std::result::Result::Err(e) => {
|
182 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
183 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
184 + | ))
|
185 + | }
|
186 + | };
|
187 + | tmp.meta = generic;
|
188 + | tmp
|
189 + | }),
|
190 + | "ExtraError" => crate::operation::enum_query::EnumQueryError::ExtraError({
|
191 + | let mut tmp = match protocol
|
192 + | .deserialize_response(response, crate::types::error::ExtraError::SCHEMA, _cfg)
|
193 + | .and_then(|mut deser| {
|
194 + | crate::types::error::ExtraError::deserialize_with_response(
|
195 + | &mut *deser,
|
196 + | response.headers(),
|
197 + | response.status().into(),
|
198 + | body,
|
199 + | )
|
200 + | }) {
|
201 + | ::std::result::Result::Ok(val) => val,
|
202 + | ::std::result::Result::Err(e) => {
|
203 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
204 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
205 + | ))
|
206 + | }
|
207 + | };
|
208 + | tmp.meta = generic;
|
209 + | if tmp.message.is_none() {
|
210 + | tmp.message = _error_message;
|
211 + | }
|
212 + | tmp
|
213 + | }),
|
214 + | _ => crate::operation::enum_query::EnumQueryError::generic(generic),
|
215 + | };
|
216 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
217 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
218 + | ))
|
146 219 | } else {
|
147 - | crate::protocol_serde::shape_enum_query::de_enum_query_http_response(status, headers, body)
|
148 - | };
|
149 - | crate::protocol_serde::type_erase_result(parse_result)
|
220 + | let protocol = _cfg
|
221 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
222 + | .expect("a SharedClientProtocol is required");
|
223 + | let mut deser = protocol.deserialize_response(response, EnumQuery::OUTPUT_SCHEMA, _cfg).map_err(|e| {
|
224 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
225 + | })?;
|
226 + | let body = response.body().bytes().expect("body loaded");
|
227 + | let output = crate::operation::enum_query::EnumQueryOutput::deserialize_with_response(
|
228 + | &mut *deser,
|
229 + | response.headers(),
|
230 + | response.status().into(),
|
231 + | body,
|
232 + | )
|
233 + | .map_err(|e| {
|
234 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
235 + | })?;
|
236 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
237 + | }
|
150 238 | }
|
151 239 | }
|
152 240 | #[derive(Debug)]
|
153 241 | struct EnumQueryRequestSerializer;
|
154 242 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for EnumQueryRequestSerializer {
|
155 243 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
156 244 | fn serialize_input(
|
157 245 | &self,
|
158 246 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
159 247 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
160 248 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
161 249 | let input = input.downcast::<crate::operation::enum_query::EnumQueryInput>().expect("correct type");
|
162 - | let _header_serialization_settings = _cfg
|
163 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
164 - | .cloned()
|
165 - | .unwrap_or_default();
|
166 - | let mut request_builder = {
|
167 - | #[allow(clippy::uninlined_format_args)]
|
168 - | fn uri_base(
|
169 - | _input: &crate::operation::enum_query::EnumQueryInput,
|
170 - | output: &mut ::std::string::String,
|
171 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
172 - | use ::std::fmt::Write as _;
|
173 - | let input_1 = &_input.r#enum;
|
174 - | let input_1 = input_1
|
175 - | .as_ref()
|
176 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("r#enum", "cannot be empty or unset"))?;
|
177 - | let r#enum = ::aws_smithy_http::label::fmt_string(input_1.as_str(), ::aws_smithy_http::label::EncodingStrategy::Default);
|
178 - | if r#enum.is_empty() {
|
179 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
180 - | "r#enum",
|
181 - | "cannot be empty or unset",
|
182 - | ));
|
250 + | let protocol = _cfg
|
251 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
252 + | .expect("a SharedClientProtocol is required");
|
253 + | if protocol.supports_http_bindings() {
|
254 + | let mut request = protocol
|
255 + | .serialize_body(&input, EnumQuery::INPUT_SCHEMA, "", _cfg)
|
256 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
257 + | {
|
258 + | let mut uri = "/foo/{enum}".to_string();
|
259 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
260 + | if let Some(ref val) = input.r#enum {
|
261 + | uri = uri.replace("{enum}", &::aws_smithy_schema::http_protocol::percent_encode(&val.as_str()));
|
183 262 | }
|
184 - | ::std::write!(output, "/foo/{enum}", enum = r#enum).expect("formatting should succeed");
|
185 - | ::std::result::Result::Ok(())
|
186 - | }
|
187 - | #[allow(clippy::unnecessary_wraps)]
|
188 - | fn update_http_builder(
|
189 - | input: &crate::operation::enum_query::EnumQueryInput,
|
190 - | builder: ::http_1x::request::Builder,
|
191 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
192 - | let mut uri = ::std::string::String::new();
|
193 - | uri_base(input, &mut uri)?;
|
194 - | ::std::result::Result::Ok(builder.method("GET").uri(uri))
|
263 + | if !query_params.is_empty() {
|
264 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
265 + | let pairs: Vec<String> = query_params
|
266 + | .iter()
|
267 + | .map(|(k, v)| {
|
268 + | format!(
|
269 + | "{}={}",
|
270 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
271 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
272 + | )
|
273 + | })
|
274 + | .collect();
|
275 + | uri.push_str(&pairs.join("&"));
|
276 + | }
|
277 + | request.set_uri(uri.as_str()).expect("valid URI");
|
195 278 | }
|
196 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
197 - | builder
|
198 - | };
|
199 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
200 279 |
|
201 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
280 + | return ::std::result::Result::Ok(request);
|
281 + | } else {
|
282 + | let mut request = protocol
|
283 + | .serialize_request(&input, EnumQuery::INPUT_SCHEMA, "", _cfg)
|
284 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
285 + |
|
286 + | return ::std::result::Result::Ok(request);
|
287 + | }
|
202 288 | }
|
203 289 | }
|
204 290 | #[derive(Debug)]
|
205 291 | struct EnumQueryEndpointParamsInterceptor;
|
206 292 |
|
207 293 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for EnumQueryEndpointParamsInterceptor {
|
208 294 | fn name(&self) -> &'static str {
|
209 295 | "EnumQueryEndpointParamsInterceptor"
|
210 296 | }
|
211 297 |
|