aws_sdk_s3/protocol_serde/
shape_queue_configuration.rs
1#[allow(clippy::needless_question_mark)]
3pub fn de_queue_configuration(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::QueueConfiguration, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::QueueConfiguration::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("Id") => {
11 let var_1 =
12 Some(
13 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
15 .into()
16 )
17 ?
18 )
19 ;
20 builder = builder.set_id(var_1);
21 }
22 ,
23 s if s.matches("Queue") => {
24 let var_2 =
25 Some(
26 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
27 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
28 .into()
29 )
30 ?
31 )
32 ;
33 builder = builder.set_queue_arn(var_2);
34 }
35 ,
36 s if s.matches("Event") => {
37 let var_3 =
38 Some(
39 Result::<::std::vec::Vec::<crate::types::Event>, ::aws_smithy_xml::decode::XmlDecodeError>::Ok({
40 let mut list_4 = builder.events.take().unwrap_or_default();
41 list_4.push(
42 Result::<crate::types::Event, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
43 crate::types::Event::from(
44 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
45 )
46 )
47 ?
48 );
49 list_4
50 })
51 ?
52 )
53 ;
54 builder = builder.set_events(var_3);
55 }
56 ,
57 s if s.matches("Filter") => {
58 let var_5 =
59 Some(
60 crate::protocol_serde::shape_notification_configuration_filter::de_notification_configuration_filter(&mut tag)
61 ?
62 )
63 ;
64 builder = builder.set_filter(var_5);
65 }
66 ,
67 _ => {}
68 }
69 }
70 Ok(crate::serde_util::queue_configuration_correct_errors(builder)
71 .build()
72 .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
73}
74
75pub fn ser_queue_configuration(
76 input: &crate::types::QueueConfiguration,
77 writer: ::aws_smithy_xml::encode::ElWriter,
78) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
79 #[allow(unused_mut)]
80 let mut scope = writer.finish();
81 if let Some(var_6) = &input.id {
82 let mut inner_writer = scope.start_el("Id").finish();
83 inner_writer.data(var_6.as_str());
84 }
85 {
86 let mut inner_writer = scope.start_el("Queue").finish();
87 inner_writer.data(input.queue_arn.as_str());
88 }
89 {
90 for list_item_7 in &input.events {
91 {
92 let mut inner_writer = scope.start_el("Event").finish();
93 inner_writer.data(list_item_7.as_str());
94 }
95 }
96 }
97 if let Some(var_8) = &input.filter {
98 let inner_writer = scope.start_el("Filter");
99 crate::protocol_serde::shape_notification_configuration_filter::ser_notification_configuration_filter(var_8, inner_writer)?
100 }
101 scope.finish();
102 Ok(())
103}