aws_sdk_sns/protocol_serde/
shape_phone_number_information.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_phone_number_information(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::PhoneNumberInformation, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::PhoneNumberInformation::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("CreatedAt") /* CreatedAt com.amazonaws.sns#PhoneNumberInformation$CreatedAt */ =>  {
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.sns#Timestamp`)"))
18                        ?
19                    )
20                ;
21                builder = builder.set_created_at(var_1);
22            }
23            ,
24            s if s.matches("PhoneNumber") /* PhoneNumber com.amazonaws.sns#PhoneNumberInformation$PhoneNumber */ =>  {
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_phone_number(var_2);
35            }
36            ,
37            s if s.matches("Status") /* Status com.amazonaws.sns#PhoneNumberInformation$Status */ =>  {
38                let var_3 =
39                    Some(
40                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
41                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42                            .into()
43                        )
44                        ?
45                    )
46                ;
47                builder = builder.set_status(var_3);
48            }
49            ,
50            s if s.matches("Iso2CountryCode") /* Iso2CountryCode com.amazonaws.sns#PhoneNumberInformation$Iso2CountryCode */ =>  {
51                let var_4 =
52                    Some(
53                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
54                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
55                            .into()
56                        )
57                        ?
58                    )
59                ;
60                builder = builder.set_iso2_country_code(var_4);
61            }
62            ,
63            s if s.matches("RouteType") /* RouteType com.amazonaws.sns#PhoneNumberInformation$RouteType */ =>  {
64                let var_5 =
65                    Some(
66                        Result::<crate::types::RouteType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
67                            crate::types::RouteType::from(
68                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
69                            )
70                        )
71                        ?
72                    )
73                ;
74                builder = builder.set_route_type(var_5);
75            }
76            ,
77            s if s.matches("NumberCapabilities") /* NumberCapabilities com.amazonaws.sns#PhoneNumberInformation$NumberCapabilities */ =>  {
78                let var_6 =
79                    Some(
80                        crate::protocol_serde::shape_number_capability_list::de_number_capability_list(&mut tag)
81                        ?
82                    )
83                ;
84                builder = builder.set_number_capabilities(var_6);
85            }
86            ,
87            _ => {}
88        }
89    }
90    Ok(builder.build())
91}