aws_sdk_elasticloadbalancingv2/protocol_serde/
shape_target_description.rs1#[allow(unused_mut)]
3pub fn ser_target_description(
4 mut writer: ::aws_smithy_query::QueryValueWriter,
5 input: &crate::types::TargetDescription,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7 #[allow(unused_mut)]
8 let mut scope_1 = writer.prefix("Id");
9 if let Some(var_2) = &input.id {
10 scope_1.string(var_2);
11 }
12 #[allow(unused_mut)]
13 let mut scope_3 = writer.prefix("Port");
14 if let Some(var_4) = &input.port {
15 scope_3.number(
16 #[allow(clippy::useless_conversion)]
17 ::aws_smithy_types::Number::NegInt((*var_4).into()),
18 );
19 }
20 #[allow(unused_mut)]
21 let mut scope_5 = writer.prefix("AvailabilityZone");
22 if let Some(var_6) = &input.availability_zone {
23 scope_5.string(var_6);
24 }
25 Ok(())
26}
27
28#[allow(clippy::needless_question_mark)]
29pub fn de_target_description(
30 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
31) -> ::std::result::Result<crate::types::TargetDescription, ::aws_smithy_xml::decode::XmlDecodeError> {
32 #[allow(unused_mut)]
33 let mut builder = crate::types::TargetDescription::builder();
34 while let Some(mut tag) = decoder.next_tag() {
35 match tag.start_el() {
36 s if s.matches("Id") => {
37 let var_7 =
38 Some(
39 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
40 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
41 .into()
42 )
43 ?
44 )
45 ;
46 builder = builder.set_id(var_7);
47 }
48 ,
49 s if s.matches("Port") => {
50 let var_8 =
51 Some(
52 {
53 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
54 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
55 )
56 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.elasticloadbalancingv2#Port`)"))
57 }
58 ?
59 )
60 ;
61 builder = builder.set_port(var_8);
62 }
63 ,
64 s if s.matches("AvailabilityZone") => {
65 let var_9 =
66 Some(
67 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
68 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
69 .into()
70 )
71 ?
72 )
73 ;
74 builder = builder.set_availability_zone(var_9);
75 }
76 ,
77 _ => {}
78 }
79 }
80 Ok(crate::serde_util::target_description_correct_errors(builder).build())
81}