aws_sdk_ec2/protocol_serde/
shape_network_interface_attachment.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_network_interface_attachment(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::NetworkInterfaceAttachment, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::NetworkInterfaceAttachment::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("attachTime") => {
11 let var_1 =
12 Some(
13 ::aws_smithy_types::DateTime::from_str(
14 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
15 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
16 )
17 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
18 ?
19 )
20 ;
21 builder = builder.set_attach_time(var_1);
22 }
23 ,
24 s if s.matches("attachmentId") => {
25 let var_2 =
26 Some(
27 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
28 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29 .into()
30 )
31 ?
32 )
33 ;
34 builder = builder.set_attachment_id(var_2);
35 }
36 ,
37 s if s.matches("deleteOnTermination") => {
38 let var_3 =
39 Some(
40 {
41 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
42 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
43 )
44 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
45 }
46 ?
47 )
48 ;
49 builder = builder.set_delete_on_termination(var_3);
50 }
51 ,
52 s if s.matches("deviceIndex") => {
53 let var_4 =
54 Some(
55 {
56 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
57 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
58 )
59 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
60 }
61 ?
62 )
63 ;
64 builder = builder.set_device_index(var_4);
65 }
66 ,
67 s if s.matches("networkCardIndex") => {
68 let var_5 =
69 Some(
70 {
71 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
72 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
73 )
74 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
75 }
76 ?
77 )
78 ;
79 builder = builder.set_network_card_index(var_5);
80 }
81 ,
82 s if s.matches("instanceId") => {
83 let var_6 =
84 Some(
85 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
86 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
87 .into()
88 )
89 ?
90 )
91 ;
92 builder = builder.set_instance_id(var_6);
93 }
94 ,
95 s if s.matches("instanceOwnerId") => {
96 let var_7 =
97 Some(
98 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
99 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
100 .into()
101 )
102 ?
103 )
104 ;
105 builder = builder.set_instance_owner_id(var_7);
106 }
107 ,
108 s if s.matches("status") => {
109 let var_8 =
110 Some(
111 Result::<crate::types::AttachmentStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
112 crate::types::AttachmentStatus::from(
113 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
114 )
115 )
116 ?
117 )
118 ;
119 builder = builder.set_status(var_8);
120 }
121 ,
122 s if s.matches("enaSrdSpecification") => {
123 let var_9 =
124 Some(
125 crate::protocol_serde::shape_attachment_ena_srd_specification::de_attachment_ena_srd_specification(&mut tag)
126 ?
127 )
128 ;
129 builder = builder.set_ena_srd_specification(var_9);
130 }
131 ,
132 s if s.matches("enaQueueCount") => {
133 let var_10 =
134 Some(
135 {
136 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
137 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
138 )
139 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
140 }
141 ?
142 )
143 ;
144 builder = builder.set_ena_queue_count(var_10);
145 }
146 ,
147 _ => {}
148 }
149 }
150 Ok(builder.build())
151}