aws_sdk_ec2/protocol_serde/
shape_spot_placement.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(unused_mut)]
3pub fn ser_spot_placement(
4    mut writer: ::aws_smithy_query::QueryValueWriter,
5    input: &crate::types::SpotPlacement,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7    #[allow(unused_mut)]
8    let mut scope_1 = writer.prefix("AvailabilityZone");
9    if let Some(var_2) = &input.availability_zone {
10        scope_1.string(var_2);
11    }
12    #[allow(unused_mut)]
13    let mut scope_3 = writer.prefix("GroupName");
14    if let Some(var_4) = &input.group_name {
15        scope_3.string(var_4);
16    }
17    #[allow(unused_mut)]
18    let mut scope_5 = writer.prefix("Tenancy");
19    if let Some(var_6) = &input.tenancy {
20        scope_5.string(var_6.as_str());
21    }
22    Ok(())
23}
24
25#[allow(clippy::needless_question_mark)]
26pub fn de_spot_placement(
27    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
28) -> ::std::result::Result<crate::types::SpotPlacement, ::aws_smithy_xml::decode::XmlDecodeError> {
29    #[allow(unused_mut)]
30    let mut builder = crate::types::SpotPlacement::builder();
31    while let Some(mut tag) = decoder.next_tag() {
32        match tag.start_el() {
33            s if s.matches("availabilityZone") /* AvailabilityZone com.amazonaws.ec2#SpotPlacement$AvailabilityZone */ =>  {
34                let var_7 =
35                    Some(
36                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
37                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
38                            .into()
39                        )
40                        ?
41                    )
42                ;
43                builder = builder.set_availability_zone(var_7);
44            }
45            ,
46            s if s.matches("groupName") /* GroupName com.amazonaws.ec2#SpotPlacement$GroupName */ =>  {
47                let var_8 =
48                    Some(
49                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
50                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
51                            .into()
52                        )
53                        ?
54                    )
55                ;
56                builder = builder.set_group_name(var_8);
57            }
58            ,
59            s if s.matches("tenancy") /* Tenancy com.amazonaws.ec2#SpotPlacement$Tenancy */ =>  {
60                let var_9 =
61                    Some(
62                        Result::<crate::types::Tenancy, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
63                            crate::types::Tenancy::from(
64                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
65                            )
66                        )
67                        ?
68                    )
69                ;
70                builder = builder.set_tenancy(var_9);
71            }
72            ,
73            _ => {}
74        }
75    }
76    Ok(builder.build())
77}