aws_sdk_elasticloadbalancingv2/protocol_serde/
shape_action.rs1#[allow(unused_mut)]
3pub fn ser_action(
4 mut writer: ::aws_smithy_query::QueryValueWriter,
5 input: &crate::types::Action,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7 #[allow(unused_mut)]
8 let mut scope_1 = writer.prefix("Type");
9 if let Some(var_2) = &input.r#type {
10 scope_1.string(var_2.as_str());
11 }
12 #[allow(unused_mut)]
13 let mut scope_3 = writer.prefix("TargetGroupArn");
14 if let Some(var_4) = &input.target_group_arn {
15 scope_3.string(var_4);
16 }
17 #[allow(unused_mut)]
18 let mut scope_5 = writer.prefix("AuthenticateOidcConfig");
19 if let Some(var_6) = &input.authenticate_oidc_config {
20 crate::protocol_serde::shape_authenticate_oidc_action_config::ser_authenticate_oidc_action_config(scope_5, var_6)?;
21 }
22 #[allow(unused_mut)]
23 let mut scope_7 = writer.prefix("AuthenticateCognitoConfig");
24 if let Some(var_8) = &input.authenticate_cognito_config {
25 crate::protocol_serde::shape_authenticate_cognito_action_config::ser_authenticate_cognito_action_config(scope_7, var_8)?;
26 }
27 #[allow(unused_mut)]
28 let mut scope_9 = writer.prefix("Order");
29 if let Some(var_10) = &input.order {
30 scope_9.number(
31 #[allow(clippy::useless_conversion)]
32 ::aws_smithy_types::Number::NegInt((*var_10).into()),
33 );
34 }
35 #[allow(unused_mut)]
36 let mut scope_11 = writer.prefix("RedirectConfig");
37 if let Some(var_12) = &input.redirect_config {
38 crate::protocol_serde::shape_redirect_action_config::ser_redirect_action_config(scope_11, var_12)?;
39 }
40 #[allow(unused_mut)]
41 let mut scope_13 = writer.prefix("FixedResponseConfig");
42 if let Some(var_14) = &input.fixed_response_config {
43 crate::protocol_serde::shape_fixed_response_action_config::ser_fixed_response_action_config(scope_13, var_14)?;
44 }
45 #[allow(unused_mut)]
46 let mut scope_15 = writer.prefix("ForwardConfig");
47 if let Some(var_16) = &input.forward_config {
48 crate::protocol_serde::shape_forward_action_config::ser_forward_action_config(scope_15, var_16)?;
49 }
50 Ok(())
51}
52
53#[allow(clippy::needless_question_mark)]
54pub fn de_action(
55 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
56) -> ::std::result::Result<crate::types::Action, ::aws_smithy_xml::decode::XmlDecodeError> {
57 #[allow(unused_mut)]
58 let mut builder = crate::types::Action::builder();
59 while let Some(mut tag) = decoder.next_tag() {
60 match tag.start_el() {
61 s if s.matches("Type") => {
62 let var_17 =
63 Some(
64 Result::<crate::types::ActionTypeEnum, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
65 crate::types::ActionTypeEnum::from(
66 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
67 )
68 )
69 ?
70 )
71 ;
72 builder = builder.set_type(var_17);
73 }
74 ,
75 s if s.matches("TargetGroupArn") => {
76 let var_18 =
77 Some(
78 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
79 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
80 .into()
81 )
82 ?
83 )
84 ;
85 builder = builder.set_target_group_arn(var_18);
86 }
87 ,
88 s if s.matches("AuthenticateOidcConfig") => {
89 let var_19 =
90 Some(
91 crate::protocol_serde::shape_authenticate_oidc_action_config::de_authenticate_oidc_action_config(&mut tag)
92 ?
93 )
94 ;
95 builder = builder.set_authenticate_oidc_config(var_19);
96 }
97 ,
98 s if s.matches("AuthenticateCognitoConfig") => {
99 let var_20 =
100 Some(
101 crate::protocol_serde::shape_authenticate_cognito_action_config::de_authenticate_cognito_action_config(&mut tag)
102 ?
103 )
104 ;
105 builder = builder.set_authenticate_cognito_config(var_20);
106 }
107 ,
108 s if s.matches("Order") => {
109 let var_21 =
110 Some(
111 {
112 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
113 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
114 )
115 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.elasticloadbalancingv2#ActionOrder`)"))
116 }
117 ?
118 )
119 ;
120 builder = builder.set_order(var_21);
121 }
122 ,
123 s if s.matches("RedirectConfig") => {
124 let var_22 =
125 Some(
126 crate::protocol_serde::shape_redirect_action_config::de_redirect_action_config(&mut tag)
127 ?
128 )
129 ;
130 builder = builder.set_redirect_config(var_22);
131 }
132 ,
133 s if s.matches("FixedResponseConfig") => {
134 let var_23 =
135 Some(
136 crate::protocol_serde::shape_fixed_response_action_config::de_fixed_response_action_config(&mut tag)
137 ?
138 )
139 ;
140 builder = builder.set_fixed_response_config(var_23);
141 }
142 ,
143 s if s.matches("ForwardConfig") => {
144 let var_24 =
145 Some(
146 crate::protocol_serde::shape_forward_action_config::de_forward_action_config(&mut tag)
147 ?
148 )
149 ;
150 builder = builder.set_forward_config(var_24);
151 }
152 ,
153 _ => {}
154 }
155 }
156 Ok(crate::serde_util::action_correct_errors(builder).build())
157}