141 147 | ::std::borrow::Cow::Owned(rcb)
|
142 148 | }
|
143 149 | }
|
144 150 |
|
145 151 | #[derive(Debug)]
|
146 152 | struct DeleteEventSourceMappingResponseDeserializer;
|
147 153 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DeleteEventSourceMappingResponseDeserializer {
|
148 154 | fn deserialize_nonstreaming(
|
149 155 | &self,
|
150 156 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
157 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
151 158 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
152 159 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
153 - | let headers = response.headers();
|
154 - | let body = response.body().bytes().expect("body loaded");
|
155 160 | #[allow(unused_mut)]
|
156 161 | let mut force_error = false;
|
157 162 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
158 - | let parse_result = if !success && status != 202 || force_error {
|
159 - | crate::protocol_serde::shape_delete_event_source_mapping::de_delete_event_source_mapping_http_error(status, headers, body)
|
163 + | if !success && status != 202 || force_error {
|
164 + | let headers = response.headers();
|
165 + | let body = response.body().bytes().expect("body loaded");
|
166 + | #[allow(unused_mut)]
|
167 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
168 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
169 + | })?;
|
170 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
171 + | let generic = generic_builder.build();
|
172 + | let error_code = match generic.code() {
|
173 + | ::std::option::Option::Some(code) => code,
|
174 + | ::std::option::Option::None => {
|
175 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
176 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
177 + | crate::operation::delete_event_source_mapping::DeleteEventSourceMappingError::unhandled(generic),
|
178 + | ),
|
179 + | ))
|
180 + | }
|
181 + | };
|
182 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
183 + | let protocol = _cfg
|
184 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
185 + | .expect("a SharedClientProtocol is required");
|
186 + | let err = match error_code {
|
187 + | "InvalidParameterValueException" => {
|
188 + | crate::operation::delete_event_source_mapping::DeleteEventSourceMappingError::InvalidParameterValueException({
|
189 + | let mut tmp = match protocol
|
190 + | .deserialize_response(response, crate::types::error::InvalidParameterValueException::SCHEMA, _cfg)
|
191 + | .and_then(|mut deser| {
|
192 + | crate::types::error::InvalidParameterValueException::deserialize_with_response(
|
193 + | &mut *deser,
|
194 + | response.headers(),
|
195 + | response.status().into(),
|
196 + | body,
|
197 + | )
|
198 + | }) {
|
199 + | ::std::result::Result::Ok(val) => val,
|
200 + | ::std::result::Result::Err(e) => {
|
201 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
202 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
203 + | ))
|
204 + | }
|
205 + | };
|
206 + | tmp.meta = generic;
|
207 + | if tmp.message.is_none() {
|
208 + | tmp.message = _error_message;
|
209 + | }
|
210 + | tmp
|
211 + | })
|
212 + | }
|
213 + | "ResourceConflictException" => {
|
214 + | crate::operation::delete_event_source_mapping::DeleteEventSourceMappingError::ResourceConflictException({
|
215 + | let mut tmp = match protocol
|
216 + | .deserialize_response(response, crate::types::error::ResourceConflictException::SCHEMA, _cfg)
|
217 + | .and_then(|mut deser| {
|
218 + | crate::types::error::ResourceConflictException::deserialize_with_response(
|
219 + | &mut *deser,
|
220 + | response.headers(),
|
221 + | response.status().into(),
|
222 + | body,
|
223 + | )
|
224 + | }) {
|
225 + | ::std::result::Result::Ok(val) => val,
|
226 + | ::std::result::Result::Err(e) => {
|
227 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
228 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
229 + | ))
|
230 + | }
|
231 + | };
|
232 + | tmp.meta = generic;
|
233 + | if tmp.message.is_none() {
|
234 + | tmp.message = _error_message;
|
235 + | }
|
236 + | tmp
|
237 + | })
|
238 + | }
|
239 + | "ResourceInUseException" => crate::operation::delete_event_source_mapping::DeleteEventSourceMappingError::ResourceInUseException({
|
240 + | let mut tmp = match protocol
|
241 + | .deserialize_response(response, crate::types::error::ResourceInUseException::SCHEMA, _cfg)
|
242 + | .and_then(|mut deser| {
|
243 + | crate::types::error::ResourceInUseException::deserialize_with_response(
|
244 + | &mut *deser,
|
245 + | response.headers(),
|
246 + | response.status().into(),
|
247 + | body,
|
248 + | )
|
249 + | }) {
|
250 + | ::std::result::Result::Ok(val) => val,
|
251 + | ::std::result::Result::Err(e) => {
|
252 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
253 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
254 + | ))
|
255 + | }
|
256 + | };
|
257 + | tmp.meta = generic;
|
258 + | if tmp.message.is_none() {
|
259 + | tmp.message = _error_message;
|
260 + | }
|
261 + | tmp
|
262 + | }),
|
263 + | "ResourceNotFoundException" => {
|
264 + | crate::operation::delete_event_source_mapping::DeleteEventSourceMappingError::ResourceNotFoundException({
|
265 + | let mut tmp = match protocol
|
266 + | .deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
|
267 + | .and_then(|mut deser| {
|
268 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
269 + | &mut *deser,
|
270 + | response.headers(),
|
271 + | response.status().into(),
|
272 + | body,
|
273 + | )
|
274 + | }) {
|
275 + | ::std::result::Result::Ok(val) => val,
|
276 + | ::std::result::Result::Err(e) => {
|
277 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
278 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
279 + | ))
|
280 + | }
|
281 + | };
|
282 + | tmp.meta = generic;
|
283 + | if tmp.message.is_none() {
|
284 + | tmp.message = _error_message;
|
285 + | }
|
286 + | tmp
|
287 + | })
|
288 + | }
|
289 + | "ServiceException" => crate::operation::delete_event_source_mapping::DeleteEventSourceMappingError::ServiceException({
|
290 + | let mut tmp = match protocol
|
291 + | .deserialize_response(response, crate::types::error::ServiceException::SCHEMA, _cfg)
|
292 + | .and_then(|mut deser| {
|
293 + | crate::types::error::ServiceException::deserialize_with_response(
|
294 + | &mut *deser,
|
295 + | response.headers(),
|
296 + | response.status().into(),
|
297 + | body,
|
298 + | )
|
299 + | }) {
|
300 + | ::std::result::Result::Ok(val) => val,
|
301 + | ::std::result::Result::Err(e) => {
|
302 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
303 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
304 + | ))
|
305 + | }
|
306 + | };
|
307 + | tmp.meta = generic;
|
308 + | if tmp.message.is_none() {
|
309 + | tmp.message = _error_message;
|
310 + | }
|
311 + | tmp
|
312 + | }),
|
313 + | "TooManyRequestsException" => {
|
314 + | crate::operation::delete_event_source_mapping::DeleteEventSourceMappingError::TooManyRequestsException({
|
315 + | let mut tmp = match protocol
|
316 + | .deserialize_response(response, crate::types::error::TooManyRequestsException::SCHEMA, _cfg)
|
317 + | .and_then(|mut deser| {
|
318 + | crate::types::error::TooManyRequestsException::deserialize_with_response(
|
319 + | &mut *deser,
|
320 + | response.headers(),
|
321 + | response.status().into(),
|
322 + | body,
|
323 + | )
|
324 + | }) {
|
325 + | ::std::result::Result::Ok(val) => val,
|
326 + | ::std::result::Result::Err(e) => {
|
327 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
328 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
329 + | ))
|
330 + | }
|
331 + | };
|
332 + | tmp.meta = generic;
|
333 + | if tmp.message.is_none() {
|
334 + | tmp.message = _error_message;
|
335 + | }
|
336 + | tmp
|
337 + | })
|
338 + | }
|
339 + | _ => crate::operation::delete_event_source_mapping::DeleteEventSourceMappingError::generic(generic),
|
340 + | };
|
341 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
342 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
343 + | ))
|
160 344 | } else {
|
161 - | crate::protocol_serde::shape_delete_event_source_mapping::de_delete_event_source_mapping_http_response(status, headers, body)
|
162 - | };
|
163 - | crate::protocol_serde::type_erase_result(parse_result)
|
345 + | let protocol = _cfg
|
346 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
347 + | .expect("a SharedClientProtocol is required");
|
348 + | let mut deser = protocol
|
349 + | .deserialize_response(response, DeleteEventSourceMapping::OUTPUT_SCHEMA, _cfg)
|
350 + | .map_err(|e| {
|
351 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
352 + | })?;
|
353 + | let body = response.body().bytes().expect("body loaded");
|
354 + | let output = crate::operation::delete_event_source_mapping::DeleteEventSourceMappingOutput::deserialize_with_response(
|
355 + | &mut *deser,
|
356 + | response.headers(),
|
357 + | response.status().into(),
|
358 + | body,
|
359 + | )
|
360 + | .map_err(|e| {
|
361 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
362 + | })?;
|
363 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
364 + | }
|
164 365 | }
|
165 366 | }
|
166 367 | #[derive(Debug)]
|
167 368 | struct DeleteEventSourceMappingRequestSerializer;
|
168 369 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DeleteEventSourceMappingRequestSerializer {
|
169 370 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
170 371 | fn serialize_input(
|
171 372 | &self,
|
172 373 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
173 374 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
174 375 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
175 376 | let input = input
|
176 377 | .downcast::<crate::operation::delete_event_source_mapping::DeleteEventSourceMappingInput>()
|
177 378 | .expect("correct type");
|
178 - | let _header_serialization_settings = _cfg
|
179 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
180 - | .cloned()
|
181 - | .unwrap_or_default();
|
182 - | let mut request_builder = {
|
183 - | #[allow(clippy::uninlined_format_args)]
|
184 - | fn uri_base(
|
185 - | _input: &crate::operation::delete_event_source_mapping::DeleteEventSourceMappingInput,
|
186 - | output: &mut ::std::string::String,
|
187 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
188 - | use ::std::fmt::Write as _;
|
189 - | let input_1 = &_input.uuid;
|
190 - | let input_1 = input_1
|
191 - | .as_ref()
|
192 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("uuid", "cannot be empty or unset"))?;
|
193 - | let uuid = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
|
194 - | if uuid.is_empty() {
|
195 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
196 - | "uuid",
|
197 - | "cannot be empty or unset",
|
198 - | ));
|
379 + | let protocol = _cfg
|
380 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
381 + | .expect("a SharedClientProtocol is required");
|
382 + | if protocol.supports_http_bindings() {
|
383 + | let mut request = protocol
|
384 + | .serialize_body(&input, DeleteEventSourceMapping::INPUT_SCHEMA, "", _cfg)
|
385 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
386 + | {
|
387 + | let mut uri = "/2015-03-31/event-source-mappings/{UUID}".to_string();
|
388 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
389 + | if let Some(ref val) = input.uuid {
|
390 + | uri = uri.replace("{UUID}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
|
199 391 | }
|
200 - | ::std::write!(output, "/2015-03-31/event-source-mappings/{UUID}", UUID = uuid).expect("formatting should succeed");
|
201 - | ::std::result::Result::Ok(())
|
202 - | }
|
203 - | #[allow(clippy::unnecessary_wraps)]
|
204 - | fn update_http_builder(
|
205 - | input: &crate::operation::delete_event_source_mapping::DeleteEventSourceMappingInput,
|
206 - | builder: ::http_1x::request::Builder,
|
207 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
208 - | let mut uri = ::std::string::String::new();
|
209 - | uri_base(input, &mut uri)?;
|
210 - | ::std::result::Result::Ok(builder.method("DELETE").uri(uri))
|
392 + | if !query_params.is_empty() {
|
393 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
394 + | let pairs: Vec<String> = query_params
|
395 + | .iter()
|
396 + | .map(|(k, v)| {
|
397 + | format!(
|
398 + | "{}={}",
|
399 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
400 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
401 + | )
|
402 + | })
|
403 + | .collect();
|
404 + | uri.push_str(&pairs.join("&"));
|
405 + | }
|
406 + | request.set_uri(uri.as_str()).expect("valid URI");
|
211 407 | }
|
212 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
213 - | builder
|
214 - | };
|
215 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
216 408 |
|
217 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
409 + | return ::std::result::Result::Ok(request);
|
410 + | } else {
|
411 + | let mut request = protocol
|
412 + | .serialize_request(&input, DeleteEventSourceMapping::INPUT_SCHEMA, "", _cfg)
|
413 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
414 + |
|
415 + | return ::std::result::Result::Ok(request);
|
416 + | }
|
218 417 | }
|
219 418 | }
|
220 419 | #[derive(Debug)]
|
221 420 | struct DeleteEventSourceMappingEndpointParamsInterceptor;
|
222 421 |
|
223 422 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DeleteEventSourceMappingEndpointParamsInterceptor {
|
224 423 | fn name(&self) -> &'static str {
|
225 424 | "DeleteEventSourceMappingEndpointParamsInterceptor"
|
226 425 | }
|
227 426 |
|