aws_sdk_ec2/protocol_serde/
shape_create_client_vpn_endpoint_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_create_client_vpn_endpoint_input_input_input(
3    input: &crate::operation::create_client_vpn_endpoint::CreateClientVpnEndpointInput,
4) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
5    let mut out = String::new();
6    #[allow(unused_mut)]
7    let mut writer = ::aws_smithy_query::QueryWriter::new(&mut out, "CreateClientVpnEndpoint", "2016-11-15");
8    #[allow(unused_mut)]
9    let mut scope_1 = writer.prefix("ClientCidrBlock");
10    if let Some(var_2) = &input.client_cidr_block {
11        scope_1.string(var_2);
12    }
13    #[allow(unused_mut)]
14    let mut scope_3 = writer.prefix("ServerCertificateArn");
15    if let Some(var_4) = &input.server_certificate_arn {
16        scope_3.string(var_4);
17    }
18    #[allow(unused_mut)]
19    let mut scope_5 = writer.prefix("Authentication");
20    if let Some(var_6) = &input.authentication_options {
21        if !var_6.is_empty() {
22            let mut list_8 = scope_5.start_list(true, None);
23            for item_7 in var_6 {
24                #[allow(unused_mut)]
25                let mut entry_9 = list_8.entry();
26                crate::protocol_serde::shape_client_vpn_authentication_request::ser_client_vpn_authentication_request(entry_9, item_7)?;
27            }
28            list_8.finish();
29        }
30    }
31    #[allow(unused_mut)]
32    let mut scope_10 = writer.prefix("ConnectionLogOptions");
33    if let Some(var_11) = &input.connection_log_options {
34        crate::protocol_serde::shape_connection_log_options::ser_connection_log_options(scope_10, var_11)?;
35    }
36    #[allow(unused_mut)]
37    let mut scope_12 = writer.prefix("DnsServers");
38    if let Some(var_13) = &input.dns_servers {
39        if !var_13.is_empty() {
40            let mut list_15 = scope_12.start_list(true, Some("item"));
41            for item_14 in var_13 {
42                #[allow(unused_mut)]
43                let mut entry_16 = list_15.entry();
44                entry_16.string(item_14);
45            }
46            list_15.finish();
47        }
48    }
49    #[allow(unused_mut)]
50    let mut scope_17 = writer.prefix("TransportProtocol");
51    if let Some(var_18) = &input.transport_protocol {
52        scope_17.string(var_18.as_str());
53    }
54    #[allow(unused_mut)]
55    let mut scope_19 = writer.prefix("VpnPort");
56    if let Some(var_20) = &input.vpn_port {
57        scope_19.number(
58            #[allow(clippy::useless_conversion)]
59            ::aws_smithy_types::Number::NegInt((*var_20).into()),
60        );
61    }
62    #[allow(unused_mut)]
63    let mut scope_21 = writer.prefix("Description");
64    if let Some(var_22) = &input.description {
65        scope_21.string(var_22);
66    }
67    #[allow(unused_mut)]
68    let mut scope_23 = writer.prefix("SplitTunnel");
69    if let Some(var_24) = &input.split_tunnel {
70        scope_23.boolean(*var_24);
71    }
72    #[allow(unused_mut)]
73    let mut scope_25 = writer.prefix("DryRun");
74    if let Some(var_26) = &input.dry_run {
75        scope_25.boolean(*var_26);
76    }
77    #[allow(unused_mut)]
78    let mut scope_27 = writer.prefix("ClientToken");
79    if let Some(var_28) = &input.client_token {
80        scope_27.string(var_28);
81    }
82    #[allow(unused_mut)]
83    let mut scope_29 = writer.prefix("TagSpecification");
84    if let Some(var_30) = &input.tag_specifications {
85        if !var_30.is_empty() {
86            let mut list_32 = scope_29.start_list(true, Some("item"));
87            for item_31 in var_30 {
88                #[allow(unused_mut)]
89                let mut entry_33 = list_32.entry();
90                crate::protocol_serde::shape_tag_specification::ser_tag_specification(entry_33, item_31)?;
91            }
92            list_32.finish();
93        }
94    }
95    #[allow(unused_mut)]
96    let mut scope_34 = writer.prefix("SecurityGroupId");
97    if let Some(var_35) = &input.security_group_ids {
98        if !var_35.is_empty() {
99            let mut list_37 = scope_34.start_list(true, Some("item"));
100            for item_36 in var_35 {
101                #[allow(unused_mut)]
102                let mut entry_38 = list_37.entry();
103                entry_38.string(item_36);
104            }
105            list_37.finish();
106        }
107    }
108    #[allow(unused_mut)]
109    let mut scope_39 = writer.prefix("VpcId");
110    if let Some(var_40) = &input.vpc_id {
111        scope_39.string(var_40);
112    }
113    #[allow(unused_mut)]
114    let mut scope_41 = writer.prefix("SelfServicePortal");
115    if let Some(var_42) = &input.self_service_portal {
116        scope_41.string(var_42.as_str());
117    }
118    #[allow(unused_mut)]
119    let mut scope_43 = writer.prefix("ClientConnectOptions");
120    if let Some(var_44) = &input.client_connect_options {
121        crate::protocol_serde::shape_client_connect_options::ser_client_connect_options(scope_43, var_44)?;
122    }
123    #[allow(unused_mut)]
124    let mut scope_45 = writer.prefix("SessionTimeoutHours");
125    if let Some(var_46) = &input.session_timeout_hours {
126        scope_45.number(
127            #[allow(clippy::useless_conversion)]
128            ::aws_smithy_types::Number::NegInt((*var_46).into()),
129        );
130    }
131    #[allow(unused_mut)]
132    let mut scope_47 = writer.prefix("ClientLoginBannerOptions");
133    if let Some(var_48) = &input.client_login_banner_options {
134        crate::protocol_serde::shape_client_login_banner_options::ser_client_login_banner_options(scope_47, var_48)?;
135    }
136    #[allow(unused_mut)]
137    let mut scope_49 = writer.prefix("ClientRouteEnforcementOptions");
138    if let Some(var_50) = &input.client_route_enforcement_options {
139        crate::protocol_serde::shape_client_route_enforcement_options::ser_client_route_enforcement_options(scope_49, var_50)?;
140    }
141    #[allow(unused_mut)]
142    let mut scope_51 = writer.prefix("DisconnectOnSessionTimeout");
143    if let Some(var_52) = &input.disconnect_on_session_timeout {
144        scope_51.boolean(*var_52);
145    }
146    writer.finish();
147    Ok(::aws_smithy_types::body::SdkBody::from(out))
148}