aws_sdk_ec2/protocol_serde/
shape_instance_metadata_options_response.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_instance_metadata_options_response(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::InstanceMetadataOptionsResponse, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::InstanceMetadataOptionsResponse::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("state") /* State com.amazonaws.ec2#InstanceMetadataOptionsResponse$State */ =>  {
11                let var_1 =
12                    Some(
13                        Result::<crate::types::InstanceMetadataOptionsState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14                            crate::types::InstanceMetadataOptionsState::from(
15                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
16                            )
17                        )
18                        ?
19                    )
20                ;
21                builder = builder.set_state(var_1);
22            }
23            ,
24            s if s.matches("httpTokens") /* HttpTokens com.amazonaws.ec2#InstanceMetadataOptionsResponse$HttpTokens */ =>  {
25                let var_2 =
26                    Some(
27                        Result::<crate::types::HttpTokensState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
28                            crate::types::HttpTokensState::from(
29                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
30                            )
31                        )
32                        ?
33                    )
34                ;
35                builder = builder.set_http_tokens(var_2);
36            }
37            ,
38            s if s.matches("httpPutResponseHopLimit") /* HttpPutResponseHopLimit com.amazonaws.ec2#InstanceMetadataOptionsResponse$HttpPutResponseHopLimit */ =>  {
39                let var_3 =
40                    Some(
41                         {
42                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
43                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
44                            )
45                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
46                        }
47                        ?
48                    )
49                ;
50                builder = builder.set_http_put_response_hop_limit(var_3);
51            }
52            ,
53            s if s.matches("httpEndpoint") /* HttpEndpoint com.amazonaws.ec2#InstanceMetadataOptionsResponse$HttpEndpoint */ =>  {
54                let var_4 =
55                    Some(
56                        Result::<crate::types::InstanceMetadataEndpointState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
57                            crate::types::InstanceMetadataEndpointState::from(
58                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
59                            )
60                        )
61                        ?
62                    )
63                ;
64                builder = builder.set_http_endpoint(var_4);
65            }
66            ,
67            s if s.matches("httpProtocolIpv6") /* HttpProtocolIpv6 com.amazonaws.ec2#InstanceMetadataOptionsResponse$HttpProtocolIpv6 */ =>  {
68                let var_5 =
69                    Some(
70                        Result::<crate::types::InstanceMetadataProtocolState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
71                            crate::types::InstanceMetadataProtocolState::from(
72                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
73                            )
74                        )
75                        ?
76                    )
77                ;
78                builder = builder.set_http_protocol_ipv6(var_5);
79            }
80            ,
81            s if s.matches("instanceMetadataTags") /* InstanceMetadataTags com.amazonaws.ec2#InstanceMetadataOptionsResponse$InstanceMetadataTags */ =>  {
82                let var_6 =
83                    Some(
84                        Result::<crate::types::InstanceMetadataTagsState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
85                            crate::types::InstanceMetadataTagsState::from(
86                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
87                            )
88                        )
89                        ?
90                    )
91                ;
92                builder = builder.set_instance_metadata_tags(var_6);
93            }
94            ,
95            _ => {}
96        }
97    }
98    Ok(builder.build())
99}