aws-sdk-cloudtrail 1.104.0

AWS SDK for AWS CloudTrail
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_event_data_store_http_error(
    _response_status: u16,
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    _response_body: &[u8],
) -> std::result::Result<
    crate::operation::delete_event_data_store::DeleteEventDataStoreOutput,
    crate::operation::delete_event_data_store::DeleteEventDataStoreError,
> {
    #[allow(unused_mut)]
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
        .map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
    let generic = generic_builder.build();
    let error_code = match generic.code() {
        Some(code) => code,
        None => return Err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled(generic)),
    };

    let _error_message = generic.message().map(|msg| msg.to_owned());
    Err(match error_code {
        "ChannelExistsForEDSException" => crate::operation::delete_event_data_store::DeleteEventDataStoreError::ChannelExistsForEdsException({
            #[allow(unused_mut)]
            let mut tmp = {
                #[allow(unused_mut)]
                let mut output = crate::types::error::builders::ChannelExistsForEdsExceptionBuilder::default();
                output = crate::protocol_serde::shape_channel_exists_for_eds_exception::de_channel_exists_for_eds_exception_json_err(
                    _response_body,
                    output,
                )
                .map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                let output = output.meta(generic);
                output.build()
            };
            if tmp.message.is_none() {
                tmp.message = _error_message;
            }
            tmp
        }),
        "ConflictException" => crate::operation::delete_event_data_store::DeleteEventDataStoreError::ConflictException({
            #[allow(unused_mut)]
            let mut tmp = {
                #[allow(unused_mut)]
                let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
                output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
                    .map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                let output = output.meta(generic);
                output.build()
            };
            if tmp.message.is_none() {
                tmp.message = _error_message;
            }
            tmp
        }),
        "EventDataStoreARNInvalidException" => {
            crate::operation::delete_event_data_store::DeleteEventDataStoreError::EventDataStoreArnInvalidException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::EventDataStoreArnInvalidExceptionBuilder::default();
                    output = crate::protocol_serde::shape_event_data_store_arn_invalid_exception::de_event_data_store_arn_invalid_exception_json_err(
                        _response_body,
                        output,
                    )
                    .map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        "EventDataStoreFederationEnabledException" => {
            crate::operation::delete_event_data_store::DeleteEventDataStoreError::EventDataStoreFederationEnabledException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::EventDataStoreFederationEnabledExceptionBuilder::default();
                    output = crate::protocol_serde::shape_event_data_store_federation_enabled_exception::de_event_data_store_federation_enabled_exception_json_err(_response_body, output).map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        "EventDataStoreHasOngoingImportException" => {
            crate::operation::delete_event_data_store::DeleteEventDataStoreError::EventDataStoreHasOngoingImportException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::EventDataStoreHasOngoingImportExceptionBuilder::default();
                    output = crate::protocol_serde::shape_event_data_store_has_ongoing_import_exception::de_event_data_store_has_ongoing_import_exception_json_err(_response_body, output).map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        "EventDataStoreNotFoundException" => crate::operation::delete_event_data_store::DeleteEventDataStoreError::EventDataStoreNotFoundException({
            #[allow(unused_mut)]
            let mut tmp = {
                #[allow(unused_mut)]
                let mut output = crate::types::error::builders::EventDataStoreNotFoundExceptionBuilder::default();
                output = crate::protocol_serde::shape_event_data_store_not_found_exception::de_event_data_store_not_found_exception_json_err(
                    _response_body,
                    output,
                )
                .map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                let output = output.meta(generic);
                output.build()
            };
            if tmp.message.is_none() {
                tmp.message = _error_message;
            }
            tmp
        }),
        "EventDataStoreTerminationProtectedException" => {
            crate::operation::delete_event_data_store::DeleteEventDataStoreError::EventDataStoreTerminationProtectedException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::EventDataStoreTerminationProtectedExceptionBuilder::default();
                    output = crate::protocol_serde::shape_event_data_store_termination_protected_exception::de_event_data_store_termination_protected_exception_json_err(_response_body, output).map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        "InactiveEventDataStoreException" => crate::operation::delete_event_data_store::DeleteEventDataStoreError::InactiveEventDataStoreException({
            #[allow(unused_mut)]
            let mut tmp = {
                #[allow(unused_mut)]
                let mut output = crate::types::error::builders::InactiveEventDataStoreExceptionBuilder::default();
                output = crate::protocol_serde::shape_inactive_event_data_store_exception::de_inactive_event_data_store_exception_json_err(
                    _response_body,
                    output,
                )
                .map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                let output = output.meta(generic);
                output.build()
            };
            if tmp.message.is_none() {
                tmp.message = _error_message;
            }
            tmp
        }),
        "InsufficientDependencyServiceAccessPermissionException" => {
            crate::operation::delete_event_data_store::DeleteEventDataStoreError::InsufficientDependencyServiceAccessPermissionException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::InsufficientDependencyServiceAccessPermissionExceptionBuilder::default();
                    output = crate::protocol_serde::shape_insufficient_dependency_service_access_permission_exception::de_insufficient_dependency_service_access_permission_exception_json_err(_response_body, output).map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        "InvalidParameterException" => crate::operation::delete_event_data_store::DeleteEventDataStoreError::InvalidParameterException({
            #[allow(unused_mut)]
            let mut tmp = {
                #[allow(unused_mut)]
                let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
                output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
                    .map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                let output = output.meta(generic);
                output.build()
            };
            if tmp.message.is_none() {
                tmp.message = _error_message;
            }
            tmp
        }),
        "NoManagementAccountSLRExistsException" => {
            crate::operation::delete_event_data_store::DeleteEventDataStoreError::NoManagementAccountSlrExistsException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::NoManagementAccountSlrExistsExceptionBuilder::default();
                    output = crate::protocol_serde::shape_no_management_account_slr_exists_exception::de_no_management_account_slr_exists_exception_json_err(_response_body, output).map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        "NotOrganizationMasterAccountException" => {
            crate::operation::delete_event_data_store::DeleteEventDataStoreError::NotOrganizationMasterAccountException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::NotOrganizationMasterAccountExceptionBuilder::default();
                    output = crate::protocol_serde::shape_not_organization_master_account_exception::de_not_organization_master_account_exception_json_err(_response_body, output).map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        "OperationNotPermittedException" => crate::operation::delete_event_data_store::DeleteEventDataStoreError::OperationNotPermittedException({
            #[allow(unused_mut)]
            let mut tmp = {
                #[allow(unused_mut)]
                let mut output = crate::types::error::builders::OperationNotPermittedExceptionBuilder::default();
                output = crate::protocol_serde::shape_operation_not_permitted_exception::de_operation_not_permitted_exception_json_err(
                    _response_body,
                    output,
                )
                .map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                let output = output.meta(generic);
                output.build()
            };
            if tmp.message.is_none() {
                tmp.message = _error_message;
            }
            tmp
        }),
        "UnsupportedOperationException" => crate::operation::delete_event_data_store::DeleteEventDataStoreError::UnsupportedOperationException({
            #[allow(unused_mut)]
            let mut tmp = {
                #[allow(unused_mut)]
                let mut output = crate::types::error::builders::UnsupportedOperationExceptionBuilder::default();
                output =
                    crate::protocol_serde::shape_unsupported_operation_exception::de_unsupported_operation_exception_json_err(_response_body, output)
                        .map_err(crate::operation::delete_event_data_store::DeleteEventDataStoreError::unhandled)?;
                let output = output.meta(generic);
                output.build()
            };
            if tmp.message.is_none() {
                tmp.message = _error_message;
            }
            tmp
        }),
        _ => crate::operation::delete_event_data_store::DeleteEventDataStoreError::generic(generic),
    })
}

#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_event_data_store_http_response(
    _response_status: u16,
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    _response_body: &[u8],
) -> std::result::Result<
    crate::operation::delete_event_data_store::DeleteEventDataStoreOutput,
    crate::operation::delete_event_data_store::DeleteEventDataStoreError,
> {
    Ok({
        #[allow(unused_mut)]
        let mut output = crate::operation::delete_event_data_store::builders::DeleteEventDataStoreOutputBuilder::default();
        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
        output.build()
    })
}

pub fn ser_delete_event_data_store_input(
    input: &crate::operation::delete_event_data_store::DeleteEventDataStoreInput,
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
    let mut out = String::new();
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
    crate::protocol_serde::shape_delete_event_data_store_input::ser_delete_event_data_store_input_input(&mut object, input)?;
    object.finish();
    Ok(::aws_smithy_types::body::SdkBody::from(out))
}