147 151 | ::std::borrow::Cow::Owned(rcb)
|
148 152 | }
|
149 153 | }
|
150 154 |
|
151 155 | #[derive(Debug)]
|
152 156 | struct AssociateResourceTypesResponseDeserializer;
|
153 157 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for AssociateResourceTypesResponseDeserializer {
|
154 158 | fn deserialize_nonstreaming(
|
155 159 | &self,
|
156 160 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
161 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
157 162 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
158 163 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
159 - | let headers = response.headers();
|
160 - | let body = response.body().bytes().expect("body loaded");
|
161 164 | #[allow(unused_mut)]
|
162 165 | let mut force_error = false;
|
163 166 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
164 - | let parse_result = if !success && status != 200 || force_error {
|
165 - | crate::protocol_serde::shape_associate_resource_types::de_associate_resource_types_http_error(status, headers, body)
|
167 + | if !success && status != 200 || force_error {
|
168 + | let headers = response.headers();
|
169 + | let body = response.body().bytes().expect("body loaded");
|
170 + | #[allow(unused_mut)]
|
171 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
172 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
173 + | })?;
|
174 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
175 + | let generic = generic_builder.build();
|
176 + | let error_code = match generic.code() {
|
177 + | ::std::option::Option::Some(code) => code,
|
178 + | ::std::option::Option::None => {
|
179 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
180 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
181 + | crate::operation::associate_resource_types::AssociateResourceTypesError::unhandled(generic),
|
182 + | ),
|
183 + | ))
|
184 + | }
|
185 + | };
|
186 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
187 + | let protocol = _cfg
|
188 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
189 + | .expect("a SharedClientProtocol is required");
|
190 + | let err = match error_code {
|
191 + | "ConflictException" => crate::operation::associate_resource_types::AssociateResourceTypesError::ConflictException({
|
192 + | let mut tmp = match protocol
|
193 + | .deserialize_response(response, crate::types::error::ConflictException::SCHEMA, _cfg)
|
194 + | .and_then(|mut deser| {
|
195 + | crate::types::error::ConflictException::deserialize_with_response(
|
196 + | &mut *deser,
|
197 + | response.headers(),
|
198 + | response.status().into(),
|
199 + | body,
|
200 + | )
|
201 + | }) {
|
202 + | ::std::result::Result::Ok(val) => val,
|
203 + | ::std::result::Result::Err(e) => {
|
204 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
205 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
206 + | ))
|
207 + | }
|
208 + | };
|
209 + | tmp.meta = generic;
|
210 + | if tmp.message.is_none() {
|
211 + | tmp.message = _error_message;
|
212 + | }
|
213 + | tmp
|
214 + | }),
|
215 + | "NoSuchConfigurationRecorderException" => {
|
216 + | crate::operation::associate_resource_types::AssociateResourceTypesError::NoSuchConfigurationRecorderException({
|
217 + | let mut tmp = match protocol
|
218 + | .deserialize_response(response, crate::types::error::NoSuchConfigurationRecorderException::SCHEMA, _cfg)
|
219 + | .and_then(|mut deser| {
|
220 + | crate::types::error::NoSuchConfigurationRecorderException::deserialize_with_response(
|
221 + | &mut *deser,
|
222 + | response.headers(),
|
223 + | response.status().into(),
|
224 + | body,
|
225 + | )
|
226 + | }) {
|
227 + | ::std::result::Result::Ok(val) => val,
|
228 + | ::std::result::Result::Err(e) => {
|
229 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
230 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
231 + | ))
|
232 + | }
|
233 + | };
|
234 + | tmp.meta = generic;
|
235 + | if tmp.message.is_none() {
|
236 + | tmp.message = _error_message;
|
237 + | }
|
238 + | tmp
|
239 + | })
|
240 + | }
|
241 + | "ValidationException" => crate::operation::associate_resource_types::AssociateResourceTypesError::ValidationException({
|
242 + | let mut tmp = match protocol
|
243 + | .deserialize_response(response, crate::types::error::ValidationException::SCHEMA, _cfg)
|
244 + | .and_then(|mut deser| {
|
245 + | crate::types::error::ValidationException::deserialize_with_response(
|
246 + | &mut *deser,
|
247 + | response.headers(),
|
248 + | response.status().into(),
|
249 + | body,
|
250 + | )
|
251 + | }) {
|
252 + | ::std::result::Result::Ok(val) => val,
|
253 + | ::std::result::Result::Err(e) => {
|
254 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
255 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
256 + | ))
|
257 + | }
|
258 + | };
|
259 + | tmp.meta = generic;
|
260 + | if tmp.message.is_none() {
|
261 + | tmp.message = _error_message;
|
262 + | }
|
263 + | tmp
|
264 + | }),
|
265 + | _ => crate::operation::associate_resource_types::AssociateResourceTypesError::generic(generic),
|
266 + | };
|
267 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
268 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
269 + | ))
|
166 270 | } else {
|
167 - | crate::protocol_serde::shape_associate_resource_types::de_associate_resource_types_http_response(status, headers, body)
|
168 - | };
|
169 - | crate::protocol_serde::type_erase_result(parse_result)
|
271 + | let protocol = _cfg
|
272 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
273 + | .expect("a SharedClientProtocol is required");
|
274 + | let mut deser = protocol
|
275 + | .deserialize_response(response, AssociateResourceTypes::OUTPUT_SCHEMA, _cfg)
|
276 + | .map_err(|e| {
|
277 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
278 + | })?;
|
279 + | let body = response.body().bytes().expect("body loaded");
|
280 + | let output = crate::operation::associate_resource_types::AssociateResourceTypesOutput::deserialize_with_response(
|
281 + | &mut *deser,
|
282 + | response.headers(),
|
283 + | response.status().into(),
|
284 + | body,
|
285 + | )
|
286 + | .map_err(|e| {
|
287 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
288 + | })?;
|
289 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
290 + | }
|
170 291 | }
|
171 292 | }
|
172 293 | #[derive(Debug)]
|
173 294 | struct AssociateResourceTypesRequestSerializer;
|
174 295 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for AssociateResourceTypesRequestSerializer {
|
175 296 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
176 297 | fn serialize_input(
|
177 298 | &self,
|
178 299 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
179 300 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
180 301 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
181 302 | let input = input
|
182 303 | .downcast::<crate::operation::associate_resource_types::AssociateResourceTypesInput>()
|
183 304 | .expect("correct type");
|
184 - | let _header_serialization_settings = _cfg
|
185 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
186 - | .cloned()
|
187 - | .unwrap_or_default();
|
188 - | let mut request_builder = {
|
189 - | #[allow(clippy::uninlined_format_args)]
|
190 - | fn uri_base(
|
191 - | _input: &crate::operation::associate_resource_types::AssociateResourceTypesInput,
|
192 - | output: &mut ::std::string::String,
|
193 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
194 - | use ::std::fmt::Write as _;
|
195 - | ::std::write!(output, "/").expect("formatting should succeed");
|
196 - | ::std::result::Result::Ok(())
|
197 - | }
|
198 - | #[allow(clippy::unnecessary_wraps)]
|
199 - | fn update_http_builder(
|
200 - | input: &crate::operation::associate_resource_types::AssociateResourceTypesInput,
|
201 - | builder: ::http_1x::request::Builder,
|
202 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
203 - | let mut uri = ::std::string::String::new();
|
204 - | uri_base(input, &mut uri)?;
|
205 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
206 - | }
|
207 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
208 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
|
209 - | builder = _header_serialization_settings.set_default_header(
|
210 - | builder,
|
211 - | ::http_1x::header::HeaderName::from_static("x-amz-target"),
|
212 - | "StarlingDoveService.AssociateResourceTypes",
|
213 - | );
|
214 - | builder
|
215 - | };
|
216 - | let body = ::aws_smithy_types::body::SdkBody::from(
|
217 - | crate::protocol_serde::shape_associate_resource_types::ser_associate_resource_types_input(&input)?,
|
218 - | );
|
219 - | if let Some(content_length) = body.content_length() {
|
220 - | let content_length = content_length.to_string();
|
221 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
222 - | }
|
223 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
305 + | let protocol = _cfg
|
306 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
307 + | .expect("a SharedClientProtocol is required");
|
308 + | let mut request = protocol
|
309 + | .serialize_request(&input, AssociateResourceTypes::INPUT_SCHEMA, "", _cfg)
|
310 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
311 + |
|
312 + | return ::std::result::Result::Ok(request);
|
224 313 | }
|
225 314 | }
|
226 315 | #[derive(Debug)]
|
227 316 | struct AssociateResourceTypesEndpointParamsInterceptor;
|
228 317 |
|
229 318 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for AssociateResourceTypesEndpointParamsInterceptor {
|
230 319 | fn name(&self) -> &'static str {
|
231 320 | "AssociateResourceTypesEndpointParamsInterceptor"
|
232 321 | }
|
233 322 |
|