aws_sdk_elasticloadbalancingv2/protocol_serde/
shape_rule_condition.rs1#[allow(unused_mut)]
3pub fn ser_rule_condition(
4 mut writer: ::aws_smithy_query::QueryValueWriter,
5 input: &crate::types::RuleCondition,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7 #[allow(unused_mut)]
8 let mut scope_1 = writer.prefix("Field");
9 if let Some(var_2) = &input.field {
10 scope_1.string(var_2);
11 }
12 #[allow(unused_mut)]
13 let mut scope_3 = writer.prefix("Values");
14 if let Some(var_4) = &input.values {
15 let mut list_6 = scope_3.start_list(false, None);
16 for item_5 in var_4 {
17 #[allow(unused_mut)]
18 let mut entry_7 = list_6.entry();
19 entry_7.string(item_5);
20 }
21 list_6.finish();
22 }
23 #[allow(unused_mut)]
24 let mut scope_8 = writer.prefix("HostHeaderConfig");
25 if let Some(var_9) = &input.host_header_config {
26 crate::protocol_serde::shape_host_header_condition_config::ser_host_header_condition_config(scope_8, var_9)?;
27 }
28 #[allow(unused_mut)]
29 let mut scope_10 = writer.prefix("PathPatternConfig");
30 if let Some(var_11) = &input.path_pattern_config {
31 crate::protocol_serde::shape_path_pattern_condition_config::ser_path_pattern_condition_config(scope_10, var_11)?;
32 }
33 #[allow(unused_mut)]
34 let mut scope_12 = writer.prefix("HttpHeaderConfig");
35 if let Some(var_13) = &input.http_header_config {
36 crate::protocol_serde::shape_http_header_condition_config::ser_http_header_condition_config(scope_12, var_13)?;
37 }
38 #[allow(unused_mut)]
39 let mut scope_14 = writer.prefix("QueryStringConfig");
40 if let Some(var_15) = &input.query_string_config {
41 crate::protocol_serde::shape_query_string_condition_config::ser_query_string_condition_config(scope_14, var_15)?;
42 }
43 #[allow(unused_mut)]
44 let mut scope_16 = writer.prefix("HttpRequestMethodConfig");
45 if let Some(var_17) = &input.http_request_method_config {
46 crate::protocol_serde::shape_http_request_method_condition_config::ser_http_request_method_condition_config(scope_16, var_17)?;
47 }
48 #[allow(unused_mut)]
49 let mut scope_18 = writer.prefix("SourceIpConfig");
50 if let Some(var_19) = &input.source_ip_config {
51 crate::protocol_serde::shape_source_ip_condition_config::ser_source_ip_condition_config(scope_18, var_19)?;
52 }
53 Ok(())
54}
55
56#[allow(clippy::needless_question_mark)]
57pub fn de_rule_condition(
58 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
59) -> ::std::result::Result<crate::types::RuleCondition, ::aws_smithy_xml::decode::XmlDecodeError> {
60 #[allow(unused_mut)]
61 let mut builder = crate::types::RuleCondition::builder();
62 while let Some(mut tag) = decoder.next_tag() {
63 match tag.start_el() {
64 s if s.matches("Field") => {
65 let var_20 =
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_field(var_20);
75 }
76 ,
77 s if s.matches("Values") => {
78 let var_21 =
79 Some(
80 crate::protocol_serde::shape_list_of_string::de_list_of_string(&mut tag)
81 ?
82 )
83 ;
84 builder = builder.set_values(var_21);
85 }
86 ,
87 s if s.matches("HostHeaderConfig") => {
88 let var_22 =
89 Some(
90 crate::protocol_serde::shape_host_header_condition_config::de_host_header_condition_config(&mut tag)
91 ?
92 )
93 ;
94 builder = builder.set_host_header_config(var_22);
95 }
96 ,
97 s if s.matches("PathPatternConfig") => {
98 let var_23 =
99 Some(
100 crate::protocol_serde::shape_path_pattern_condition_config::de_path_pattern_condition_config(&mut tag)
101 ?
102 )
103 ;
104 builder = builder.set_path_pattern_config(var_23);
105 }
106 ,
107 s if s.matches("HttpHeaderConfig") => {
108 let var_24 =
109 Some(
110 crate::protocol_serde::shape_http_header_condition_config::de_http_header_condition_config(&mut tag)
111 ?
112 )
113 ;
114 builder = builder.set_http_header_config(var_24);
115 }
116 ,
117 s if s.matches("QueryStringConfig") => {
118 let var_25 =
119 Some(
120 crate::protocol_serde::shape_query_string_condition_config::de_query_string_condition_config(&mut tag)
121 ?
122 )
123 ;
124 builder = builder.set_query_string_config(var_25);
125 }
126 ,
127 s if s.matches("HttpRequestMethodConfig") => {
128 let var_26 =
129 Some(
130 crate::protocol_serde::shape_http_request_method_condition_config::de_http_request_method_condition_config(&mut tag)
131 ?
132 )
133 ;
134 builder = builder.set_http_request_method_config(var_26);
135 }
136 ,
137 s if s.matches("SourceIpConfig") => {
138 let var_27 =
139 Some(
140 crate::protocol_serde::shape_source_ip_condition_config::de_source_ip_condition_config(&mut tag)
141 ?
142 )
143 ;
144 builder = builder.set_source_ip_config(var_27);
145 }
146 ,
147 _ => {}
148 }
149 }
150 Ok(builder.build())
151}