aws_sdk_ec2/protocol_serde/
shape_launch_permission.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(unused_mut)]
3pub fn ser_launch_permission(
4    mut writer: ::aws_smithy_query::QueryValueWriter,
5    input: &crate::types::LaunchPermission,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7    #[allow(unused_mut)]
8    let mut scope_1 = writer.prefix("OrganizationArn");
9    if let Some(var_2) = &input.organization_arn {
10        scope_1.string(var_2);
11    }
12    #[allow(unused_mut)]
13    let mut scope_3 = writer.prefix("OrganizationalUnitArn");
14    if let Some(var_4) = &input.organizational_unit_arn {
15        scope_3.string(var_4);
16    }
17    #[allow(unused_mut)]
18    let mut scope_5 = writer.prefix("UserId");
19    if let Some(var_6) = &input.user_id {
20        scope_5.string(var_6);
21    }
22    #[allow(unused_mut)]
23    let mut scope_7 = writer.prefix("Group");
24    if let Some(var_8) = &input.group {
25        scope_7.string(var_8.as_str());
26    }
27    Ok(())
28}
29
30#[allow(clippy::needless_question_mark)]
31pub fn de_launch_permission(
32    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
33) -> ::std::result::Result<crate::types::LaunchPermission, ::aws_smithy_xml::decode::XmlDecodeError> {
34    #[allow(unused_mut)]
35    let mut builder = crate::types::LaunchPermission::builder();
36    while let Some(mut tag) = decoder.next_tag() {
37        match tag.start_el() {
38            s if s.matches("organizationArn") /* OrganizationArn com.amazonaws.ec2#LaunchPermission$OrganizationArn */ =>  {
39                let var_9 =
40                    Some(
41                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
42                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
43                            .into()
44                        )
45                        ?
46                    )
47                ;
48                builder = builder.set_organization_arn(var_9);
49            }
50            ,
51            s if s.matches("organizationalUnitArn") /* OrganizationalUnitArn com.amazonaws.ec2#LaunchPermission$OrganizationalUnitArn */ =>  {
52                let var_10 =
53                    Some(
54                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
55                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
56                            .into()
57                        )
58                        ?
59                    )
60                ;
61                builder = builder.set_organizational_unit_arn(var_10);
62            }
63            ,
64            s if s.matches("userId") /* UserId com.amazonaws.ec2#LaunchPermission$UserId */ =>  {
65                let var_11 =
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_user_id(var_11);
75            }
76            ,
77            s if s.matches("group") /* Group com.amazonaws.ec2#LaunchPermission$Group */ =>  {
78                let var_12 =
79                    Some(
80                        Result::<crate::types::PermissionGroup, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
81                            crate::types::PermissionGroup::from(
82                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
83                            )
84                        )
85                        ?
86                    )
87                ;
88                builder = builder.set_group(var_12);
89            }
90            ,
91            _ => {}
92        }
93    }
94    Ok(builder.build())
95}