aws-sdk-ec2 1.231.0

AWS SDK for Amazon Elastic Compute Cloud
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::needless_question_mark)]
pub fn de_image_watermark(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
    depth: u32,
) -> ::std::result::Result<crate::types::ImageWatermark, ::aws_smithy_xml::decode::XmlDecodeError> {
    if depth >= 128u32 {
        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom("maximum nesting depth exceeded"));
    }
    #[allow(unused_mut)]
    let mut builder = crate::types::ImageWatermark::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("watermarkKey") /* WatermarkKey com.amazonaws.ec2#ImageWatermark$WatermarkKey */ =>  {
                let var_1 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_watermark_key(var_1);
            }
            ,
            s if s.matches("sourceImageRegion") /* SourceImageRegion com.amazonaws.ec2#ImageWatermark$SourceImageRegion */ =>  {
                let var_2 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_source_image_region(var_2);
            }
            ,
            s if s.matches("sourceImageId") /* SourceImageId com.amazonaws.ec2#ImageWatermark$SourceImageId */ =>  {
                let var_3 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_source_image_id(var_3);
            }
            ,
            s if s.matches("sourceImageCreationTime") /* SourceImageCreationTime com.amazonaws.ec2#ImageWatermark$SourceImageCreationTime */ =>  {
                let var_4 =
                    Some(
                        ::aws_smithy_types::DateTime::from_str(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
                        )
                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
                        ?
                    )
                ;
                builder = builder.set_source_image_creation_time(var_4);
            }
            ,
            s if s.matches("watermarkCreationTime") /* WatermarkCreationTime com.amazonaws.ec2#ImageWatermark$WatermarkCreationTime */ =>  {
                let var_5 =
                    Some(
                        ::aws_smithy_types::DateTime::from_str(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
                        )
                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
                        ?
                    )
                ;
                builder = builder.set_watermark_creation_time(var_5);
            }
            ,
            _ => {}
        }
    }
    Ok(builder.build())
}