aws-sdk-globalaccelerator 1.95.0

AWS SDK for AWS Global Accelerator
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_custom_routing_endpoint_group_http_error(
    _response_status: u16,
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    _response_body: &[u8],
) -> std::result::Result<
    crate::operation::delete_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupOutput,
    crate::operation::delete_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupError,
> {
    #[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_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupError::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_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupError::unhandled(generic)),
    };

    let _error_message = generic.message().map(|msg| msg.to_owned());
    Err(match error_code {
        "EndpointGroupNotFoundException" => {
            crate::operation::delete_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupError::EndpointGroupNotFoundException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::EndpointGroupNotFoundExceptionBuilder::default();
                    output = crate::protocol_serde::shape_endpoint_group_not_found_exception::de_endpoint_group_not_found_exception_json_err(
                        _response_body,
                        output,
                    )
                    .map_err(crate::operation::delete_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        "InternalServiceErrorException" => {
            crate::operation::delete_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupError::InternalServiceErrorException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::InternalServiceErrorExceptionBuilder::default();
                    output = crate::protocol_serde::shape_internal_service_error_exception::de_internal_service_error_exception_json_err(
                        _response_body,
                        output,
                    )
                    .map_err(crate::operation::delete_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        "InvalidArgumentException" => {
            crate::operation::delete_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupError::InvalidArgumentException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::InvalidArgumentExceptionBuilder::default();
                    output = crate::protocol_serde::shape_invalid_argument_exception::de_invalid_argument_exception_json_err(_response_body, output)
                        .map_err(crate::operation::delete_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        _ => crate::operation::delete_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupError::generic(generic),
    })
}

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

pub fn ser_delete_custom_routing_endpoint_group_input(
    input: &crate::operation::delete_custom_routing_endpoint_group::DeleteCustomRoutingEndpointGroupInput,
) -> ::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_custom_routing_endpoint_group_input::ser_delete_custom_routing_endpoint_group_input_input(
        &mut object,
        input,
    )?;
    object.finish();
    Ok(::aws_smithy_types::body::SdkBody::from(out))
}