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_stop_event_data_store_ingestion_http_error(
    _response_status: u16,
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    _response_body: &[u8],
) -> std::result::Result<
    crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionOutput,
    crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError,
> {
    #[allow(unused_mut)]
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
        .map_err(crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::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::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled(generic)),
    };

    let _error_message = generic.message().map(|msg| msg.to_owned());
    Err(match error_code {
        "ConflictException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::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::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        "EventDataStoreARNInvalidException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::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::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        "EventDataStoreNotFoundException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::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::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        "InsufficientDependencyServiceAccessPermissionException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::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::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        "InvalidEventDataStoreCategoryException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::InvalidEventDataStoreCategoryException({
            #[allow(unused_mut)]
            let mut tmp =
                 {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::InvalidEventDataStoreCategoryExceptionBuilder::default();
                    output = crate::protocol_serde::shape_invalid_event_data_store_category_exception::de_invalid_event_data_store_category_exception_json_err(_response_body, output).map_err(crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        "InvalidEventDataStoreStatusException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::InvalidEventDataStoreStatusException({
            #[allow(unused_mut)]
            let mut tmp =
                 {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::InvalidEventDataStoreStatusExceptionBuilder::default();
                    output = crate::protocol_serde::shape_invalid_event_data_store_status_exception::de_invalid_event_data_store_status_exception_json_err(_response_body, output).map_err(crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        "InvalidParameterException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::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::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        "NoManagementAccountSLRExistsException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::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::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        "NotOrganizationMasterAccountException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::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::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        "OperationNotPermittedException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::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::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        "UnsupportedOperationException" => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::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::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                }
            ;
            if tmp.message.is_none() {
                                                            tmp.message = _error_message;
                                                        }
            tmp
        }),
        _ => crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionError::generic(generic)
    })
}

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

pub fn ser_stop_event_data_store_ingestion_input(
    input: &crate::operation::stop_event_data_store_ingestion::StopEventDataStoreIngestionInput,
) -> ::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_stop_event_data_store_ingestion_input::ser_stop_event_data_store_ingestion_input_input(&mut object, input)?;
    object.finish();
    Ok(::aws_smithy_types::body::SdkBody::from(out))
}