aws-sdk-cloudfront 1.115.0

AWS SDK for Amazon CloudFront
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_cache_policy_headers_config(
    input: &crate::types::CachePolicyHeadersConfig,
    writer: ::aws_smithy_xml::encode::ElWriter,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    {
        let mut inner_writer = scope.start_el("HeaderBehavior").finish();
        inner_writer.data(input.header_behavior.as_str());
    }
    if let Some(var_1) = &input.headers {
        let inner_writer = scope.start_el("Headers");
        crate::protocol_serde::shape_headers::ser_headers(var_1, inner_writer)?
    }
    scope.finish();
    Ok(())
}

#[allow(clippy::needless_question_mark)]
pub fn de_cache_policy_headers_config(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::CachePolicyHeadersConfig, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::CachePolicyHeadersConfig::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("HeaderBehavior") /* HeaderBehavior com.amazonaws.cloudfront#CachePolicyHeadersConfig$HeaderBehavior */ =>  {
                let var_2 =
                    Some(
                        Result::<crate::types::CachePolicyHeaderBehavior, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::CachePolicyHeaderBehavior::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_header_behavior(var_2);
            }
            ,
            s if s.matches("Headers") /* Headers com.amazonaws.cloudfront#CachePolicyHeadersConfig$Headers */ =>  {
                let var_3 =
                    Some(
                        crate::protocol_serde::shape_headers::de_headers(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_headers(var_3);
            }
            ,
            _ => {}
        }
    }
    Ok(crate::serde_util::cache_policy_headers_config_correct_errors(builder)
        .build()
        .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}