cfn/aws/
globalaccelerator.rs

1//! Types for the `GlobalAccelerator` service.
2
3/// The [`AWS::GlobalAccelerator::Accelerator`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-accelerator.html) resource type.
4#[derive(Debug, Default)]
5pub struct Accelerator {
6    properties: AcceleratorProperties
7}
8
9/// Properties for the `Accelerator` resource.
10#[derive(Debug, Default)]
11pub struct AcceleratorProperties {
12    /// Property [`Enabled`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-accelerator.html#cfn-globalaccelerator-accelerator-enabled).
13    ///
14    /// Update type: _Mutable_.
15    /// AWS CloudFormation doesn't replace the resource when you change this property.
16    pub enabled: Option<::Value<bool>>,
17    /// Property [`IpAddressType`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-accelerator.html#cfn-globalaccelerator-accelerator-ipaddresstype).
18    ///
19    /// Update type: _Mutable_.
20    /// AWS CloudFormation doesn't replace the resource when you change this property.
21    pub ip_address_type: Option<::Value<String>>,
22    /// Property [`IpAddresses`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-accelerator.html#cfn-globalaccelerator-accelerator-ipaddresses).
23    ///
24    /// Update type: _Mutable_.
25    /// AWS CloudFormation doesn't replace the resource when you change this property.
26    pub ip_addresses: Option<::ValueList<String>>,
27    /// Property [`Name`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-accelerator.html#cfn-globalaccelerator-accelerator-name).
28    ///
29    /// Update type: _Mutable_.
30    /// AWS CloudFormation doesn't replace the resource when you change this property.
31    pub name: ::Value<String>,
32    /// Property [`Tags`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-accelerator.html#cfn-globalaccelerator-accelerator-tags).
33    ///
34    /// Update type: _Mutable_.
35    /// AWS CloudFormation doesn't replace the resource when you change this property.
36    pub tags: Option<::ValueList<::Tag>>,
37}
38
39impl ::serde::Serialize for AcceleratorProperties {
40    fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
41        let mut map = ::serde::Serializer::serialize_map(s, None)?;
42        if let Some(ref enabled) = self.enabled {
43            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Enabled", enabled)?;
44        }
45        if let Some(ref ip_address_type) = self.ip_address_type {
46            ::serde::ser::SerializeMap::serialize_entry(&mut map, "IpAddressType", ip_address_type)?;
47        }
48        if let Some(ref ip_addresses) = self.ip_addresses {
49            ::serde::ser::SerializeMap::serialize_entry(&mut map, "IpAddresses", ip_addresses)?;
50        }
51        ::serde::ser::SerializeMap::serialize_entry(&mut map, "Name", &self.name)?;
52        if let Some(ref tags) = self.tags {
53            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Tags", tags)?;
54        }
55        ::serde::ser::SerializeMap::end(map)
56    }
57}
58
59impl<'de> ::serde::Deserialize<'de> for AcceleratorProperties {
60    fn deserialize<D: ::serde::Deserializer<'de>>(d: D) -> Result<AcceleratorProperties, D::Error> {
61        struct Visitor;
62
63        impl<'de> ::serde::de::Visitor<'de> for Visitor {
64            type Value = AcceleratorProperties;
65
66            fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
67                write!(f, "a struct of type AcceleratorProperties")
68            }
69
70            fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
71                let mut enabled: Option<::Value<bool>> = None;
72                let mut ip_address_type: Option<::Value<String>> = None;
73                let mut ip_addresses: Option<::ValueList<String>> = None;
74                let mut name: Option<::Value<String>> = None;
75                let mut tags: Option<::ValueList<::Tag>> = None;
76
77                while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
78                    match __cfn_key.as_ref() {
79                        "Enabled" => {
80                            enabled = ::serde::de::MapAccess::next_value(&mut map)?;
81                        }
82                        "IpAddressType" => {
83                            ip_address_type = ::serde::de::MapAccess::next_value(&mut map)?;
84                        }
85                        "IpAddresses" => {
86                            ip_addresses = ::serde::de::MapAccess::next_value(&mut map)?;
87                        }
88                        "Name" => {
89                            name = ::serde::de::MapAccess::next_value(&mut map)?;
90                        }
91                        "Tags" => {
92                            tags = ::serde::de::MapAccess::next_value(&mut map)?;
93                        }
94                        _ => {}
95                    }
96                }
97
98                Ok(AcceleratorProperties {
99                    enabled: enabled,
100                    ip_address_type: ip_address_type,
101                    ip_addresses: ip_addresses,
102                    name: name.ok_or(::serde::de::Error::missing_field("Name"))?,
103                    tags: tags,
104                })
105            }
106        }
107
108        d.deserialize_map(Visitor)
109    }
110}
111
112impl ::Resource for Accelerator {
113    type Properties = AcceleratorProperties;
114    const TYPE: &'static str = "AWS::GlobalAccelerator::Accelerator";
115    fn properties(&self) -> &AcceleratorProperties {
116        &self.properties
117    }
118    fn properties_mut(&mut self) -> &mut AcceleratorProperties {
119        &mut self.properties
120    }
121}
122
123impl ::private::Sealed for Accelerator {}
124
125impl From<AcceleratorProperties> for Accelerator {
126    fn from(properties: AcceleratorProperties) -> Accelerator {
127        Accelerator { properties }
128    }
129}
130
131/// The [`AWS::GlobalAccelerator::EndpointGroup`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html) resource type.
132#[derive(Debug, Default)]
133pub struct EndpointGroup {
134    properties: EndpointGroupProperties
135}
136
137/// Properties for the `EndpointGroup` resource.
138#[derive(Debug, Default)]
139pub struct EndpointGroupProperties {
140    /// Property [`EndpointConfigurations`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html#cfn-globalaccelerator-endpointgroup-endpointconfigurations).
141    ///
142    /// Update type: _Mutable_.
143    /// AWS CloudFormation doesn't replace the resource when you change this property.
144    pub endpoint_configurations: Option<::ValueList<self::endpoint_group::EndpointConfiguration>>,
145    /// Property [`EndpointGroupRegion`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html#cfn-globalaccelerator-endpointgroup-endpointgroupregion).
146    ///
147    /// Update type: _Immutable_.
148    /// AWS CloudFormation replaces the resource when you change this property.
149    pub endpoint_group_region: ::Value<String>,
150    /// Property [`HealthCheckIntervalSeconds`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html#cfn-globalaccelerator-endpointgroup-healthcheckintervalseconds).
151    ///
152    /// Update type: _Mutable_.
153    /// AWS CloudFormation doesn't replace the resource when you change this property.
154    pub health_check_interval_seconds: Option<::Value<u32>>,
155    /// Property [`HealthCheckPath`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html#cfn-globalaccelerator-endpointgroup-healthcheckpath).
156    ///
157    /// Update type: _Mutable_.
158    /// AWS CloudFormation doesn't replace the resource when you change this property.
159    pub health_check_path: Option<::Value<String>>,
160    /// Property [`HealthCheckPort`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html#cfn-globalaccelerator-endpointgroup-healthcheckport).
161    ///
162    /// Update type: _Mutable_.
163    /// AWS CloudFormation doesn't replace the resource when you change this property.
164    pub health_check_port: Option<::Value<u32>>,
165    /// Property [`HealthCheckProtocol`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html#cfn-globalaccelerator-endpointgroup-healthcheckprotocol).
166    ///
167    /// Update type: _Mutable_.
168    /// AWS CloudFormation doesn't replace the resource when you change this property.
169    pub health_check_protocol: Option<::Value<String>>,
170    /// Property [`ListenerArn`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html#cfn-globalaccelerator-endpointgroup-listenerarn).
171    ///
172    /// Update type: _Immutable_.
173    /// AWS CloudFormation replaces the resource when you change this property.
174    pub listener_arn: ::Value<String>,
175    /// Property [`PortOverrides`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html#cfn-globalaccelerator-endpointgroup-portoverrides).
176    ///
177    /// Update type: _Mutable_.
178    /// AWS CloudFormation doesn't replace the resource when you change this property.
179    pub port_overrides: Option<::ValueList<self::endpoint_group::PortOverride>>,
180    /// Property [`ThresholdCount`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html#cfn-globalaccelerator-endpointgroup-thresholdcount).
181    ///
182    /// Update type: _Mutable_.
183    /// AWS CloudFormation doesn't replace the resource when you change this property.
184    pub threshold_count: Option<::Value<u32>>,
185    /// Property [`TrafficDialPercentage`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-endpointgroup.html#cfn-globalaccelerator-endpointgroup-trafficdialpercentage).
186    ///
187    /// Update type: _Mutable_.
188    /// AWS CloudFormation doesn't replace the resource when you change this property.
189    pub traffic_dial_percentage: Option<::Value<f64>>,
190}
191
192impl ::serde::Serialize for EndpointGroupProperties {
193    fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
194        let mut map = ::serde::Serializer::serialize_map(s, None)?;
195        if let Some(ref endpoint_configurations) = self.endpoint_configurations {
196            ::serde::ser::SerializeMap::serialize_entry(&mut map, "EndpointConfigurations", endpoint_configurations)?;
197        }
198        ::serde::ser::SerializeMap::serialize_entry(&mut map, "EndpointGroupRegion", &self.endpoint_group_region)?;
199        if let Some(ref health_check_interval_seconds) = self.health_check_interval_seconds {
200            ::serde::ser::SerializeMap::serialize_entry(&mut map, "HealthCheckIntervalSeconds", health_check_interval_seconds)?;
201        }
202        if let Some(ref health_check_path) = self.health_check_path {
203            ::serde::ser::SerializeMap::serialize_entry(&mut map, "HealthCheckPath", health_check_path)?;
204        }
205        if let Some(ref health_check_port) = self.health_check_port {
206            ::serde::ser::SerializeMap::serialize_entry(&mut map, "HealthCheckPort", health_check_port)?;
207        }
208        if let Some(ref health_check_protocol) = self.health_check_protocol {
209            ::serde::ser::SerializeMap::serialize_entry(&mut map, "HealthCheckProtocol", health_check_protocol)?;
210        }
211        ::serde::ser::SerializeMap::serialize_entry(&mut map, "ListenerArn", &self.listener_arn)?;
212        if let Some(ref port_overrides) = self.port_overrides {
213            ::serde::ser::SerializeMap::serialize_entry(&mut map, "PortOverrides", port_overrides)?;
214        }
215        if let Some(ref threshold_count) = self.threshold_count {
216            ::serde::ser::SerializeMap::serialize_entry(&mut map, "ThresholdCount", threshold_count)?;
217        }
218        if let Some(ref traffic_dial_percentage) = self.traffic_dial_percentage {
219            ::serde::ser::SerializeMap::serialize_entry(&mut map, "TrafficDialPercentage", traffic_dial_percentage)?;
220        }
221        ::serde::ser::SerializeMap::end(map)
222    }
223}
224
225impl<'de> ::serde::Deserialize<'de> for EndpointGroupProperties {
226    fn deserialize<D: ::serde::Deserializer<'de>>(d: D) -> Result<EndpointGroupProperties, D::Error> {
227        struct Visitor;
228
229        impl<'de> ::serde::de::Visitor<'de> for Visitor {
230            type Value = EndpointGroupProperties;
231
232            fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
233                write!(f, "a struct of type EndpointGroupProperties")
234            }
235
236            fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
237                let mut endpoint_configurations: Option<::ValueList<self::endpoint_group::EndpointConfiguration>> = None;
238                let mut endpoint_group_region: Option<::Value<String>> = None;
239                let mut health_check_interval_seconds: Option<::Value<u32>> = None;
240                let mut health_check_path: Option<::Value<String>> = None;
241                let mut health_check_port: Option<::Value<u32>> = None;
242                let mut health_check_protocol: Option<::Value<String>> = None;
243                let mut listener_arn: Option<::Value<String>> = None;
244                let mut port_overrides: Option<::ValueList<self::endpoint_group::PortOverride>> = None;
245                let mut threshold_count: Option<::Value<u32>> = None;
246                let mut traffic_dial_percentage: Option<::Value<f64>> = None;
247
248                while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
249                    match __cfn_key.as_ref() {
250                        "EndpointConfigurations" => {
251                            endpoint_configurations = ::serde::de::MapAccess::next_value(&mut map)?;
252                        }
253                        "EndpointGroupRegion" => {
254                            endpoint_group_region = ::serde::de::MapAccess::next_value(&mut map)?;
255                        }
256                        "HealthCheckIntervalSeconds" => {
257                            health_check_interval_seconds = ::serde::de::MapAccess::next_value(&mut map)?;
258                        }
259                        "HealthCheckPath" => {
260                            health_check_path = ::serde::de::MapAccess::next_value(&mut map)?;
261                        }
262                        "HealthCheckPort" => {
263                            health_check_port = ::serde::de::MapAccess::next_value(&mut map)?;
264                        }
265                        "HealthCheckProtocol" => {
266                            health_check_protocol = ::serde::de::MapAccess::next_value(&mut map)?;
267                        }
268                        "ListenerArn" => {
269                            listener_arn = ::serde::de::MapAccess::next_value(&mut map)?;
270                        }
271                        "PortOverrides" => {
272                            port_overrides = ::serde::de::MapAccess::next_value(&mut map)?;
273                        }
274                        "ThresholdCount" => {
275                            threshold_count = ::serde::de::MapAccess::next_value(&mut map)?;
276                        }
277                        "TrafficDialPercentage" => {
278                            traffic_dial_percentage = ::serde::de::MapAccess::next_value(&mut map)?;
279                        }
280                        _ => {}
281                    }
282                }
283
284                Ok(EndpointGroupProperties {
285                    endpoint_configurations: endpoint_configurations,
286                    endpoint_group_region: endpoint_group_region.ok_or(::serde::de::Error::missing_field("EndpointGroupRegion"))?,
287                    health_check_interval_seconds: health_check_interval_seconds,
288                    health_check_path: health_check_path,
289                    health_check_port: health_check_port,
290                    health_check_protocol: health_check_protocol,
291                    listener_arn: listener_arn.ok_or(::serde::de::Error::missing_field("ListenerArn"))?,
292                    port_overrides: port_overrides,
293                    threshold_count: threshold_count,
294                    traffic_dial_percentage: traffic_dial_percentage,
295                })
296            }
297        }
298
299        d.deserialize_map(Visitor)
300    }
301}
302
303impl ::Resource for EndpointGroup {
304    type Properties = EndpointGroupProperties;
305    const TYPE: &'static str = "AWS::GlobalAccelerator::EndpointGroup";
306    fn properties(&self) -> &EndpointGroupProperties {
307        &self.properties
308    }
309    fn properties_mut(&mut self) -> &mut EndpointGroupProperties {
310        &mut self.properties
311    }
312}
313
314impl ::private::Sealed for EndpointGroup {}
315
316impl From<EndpointGroupProperties> for EndpointGroup {
317    fn from(properties: EndpointGroupProperties) -> EndpointGroup {
318        EndpointGroup { properties }
319    }
320}
321
322/// The [`AWS::GlobalAccelerator::Listener`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-listener.html) resource type.
323#[derive(Debug, Default)]
324pub struct Listener {
325    properties: ListenerProperties
326}
327
328/// Properties for the `Listener` resource.
329#[derive(Debug, Default)]
330pub struct ListenerProperties {
331    /// Property [`AcceleratorArn`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-listener.html#cfn-globalaccelerator-listener-acceleratorarn).
332    ///
333    /// Update type: _Immutable_.
334    /// AWS CloudFormation replaces the resource when you change this property.
335    pub accelerator_arn: ::Value<String>,
336    /// Property [`ClientAffinity`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-listener.html#cfn-globalaccelerator-listener-clientaffinity).
337    ///
338    /// Update type: _Mutable_.
339    /// AWS CloudFormation doesn't replace the resource when you change this property.
340    pub client_affinity: Option<::Value<String>>,
341    /// Property [`PortRanges`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-listener.html#cfn-globalaccelerator-listener-portranges).
342    ///
343    /// Update type: _Mutable_.
344    /// AWS CloudFormation doesn't replace the resource when you change this property.
345    pub port_ranges: ::ValueList<self::listener::PortRange>,
346    /// Property [`Protocol`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-globalaccelerator-listener.html#cfn-globalaccelerator-listener-protocol).
347    ///
348    /// Update type: _Mutable_.
349    /// AWS CloudFormation doesn't replace the resource when you change this property.
350    pub protocol: ::Value<String>,
351}
352
353impl ::serde::Serialize for ListenerProperties {
354    fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
355        let mut map = ::serde::Serializer::serialize_map(s, None)?;
356        ::serde::ser::SerializeMap::serialize_entry(&mut map, "AcceleratorArn", &self.accelerator_arn)?;
357        if let Some(ref client_affinity) = self.client_affinity {
358            ::serde::ser::SerializeMap::serialize_entry(&mut map, "ClientAffinity", client_affinity)?;
359        }
360        ::serde::ser::SerializeMap::serialize_entry(&mut map, "PortRanges", &self.port_ranges)?;
361        ::serde::ser::SerializeMap::serialize_entry(&mut map, "Protocol", &self.protocol)?;
362        ::serde::ser::SerializeMap::end(map)
363    }
364}
365
366impl<'de> ::serde::Deserialize<'de> for ListenerProperties {
367    fn deserialize<D: ::serde::Deserializer<'de>>(d: D) -> Result<ListenerProperties, D::Error> {
368        struct Visitor;
369
370        impl<'de> ::serde::de::Visitor<'de> for Visitor {
371            type Value = ListenerProperties;
372
373            fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
374                write!(f, "a struct of type ListenerProperties")
375            }
376
377            fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
378                let mut accelerator_arn: Option<::Value<String>> = None;
379                let mut client_affinity: Option<::Value<String>> = None;
380                let mut port_ranges: Option<::ValueList<self::listener::PortRange>> = None;
381                let mut protocol: Option<::Value<String>> = None;
382
383                while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
384                    match __cfn_key.as_ref() {
385                        "AcceleratorArn" => {
386                            accelerator_arn = ::serde::de::MapAccess::next_value(&mut map)?;
387                        }
388                        "ClientAffinity" => {
389                            client_affinity = ::serde::de::MapAccess::next_value(&mut map)?;
390                        }
391                        "PortRanges" => {
392                            port_ranges = ::serde::de::MapAccess::next_value(&mut map)?;
393                        }
394                        "Protocol" => {
395                            protocol = ::serde::de::MapAccess::next_value(&mut map)?;
396                        }
397                        _ => {}
398                    }
399                }
400
401                Ok(ListenerProperties {
402                    accelerator_arn: accelerator_arn.ok_or(::serde::de::Error::missing_field("AcceleratorArn"))?,
403                    client_affinity: client_affinity,
404                    port_ranges: port_ranges.ok_or(::serde::de::Error::missing_field("PortRanges"))?,
405                    protocol: protocol.ok_or(::serde::de::Error::missing_field("Protocol"))?,
406                })
407            }
408        }
409
410        d.deserialize_map(Visitor)
411    }
412}
413
414impl ::Resource for Listener {
415    type Properties = ListenerProperties;
416    const TYPE: &'static str = "AWS::GlobalAccelerator::Listener";
417    fn properties(&self) -> &ListenerProperties {
418        &self.properties
419    }
420    fn properties_mut(&mut self) -> &mut ListenerProperties {
421        &mut self.properties
422    }
423}
424
425impl ::private::Sealed for Listener {}
426
427impl From<ListenerProperties> for Listener {
428    fn from(properties: ListenerProperties) -> Listener {
429        Listener { properties }
430    }
431}
432
433pub mod endpoint_group {
434    //! Property types for the `EndpointGroup` resource.
435
436    /// The [`AWS::GlobalAccelerator::EndpointGroup.EndpointConfiguration`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-globalaccelerator-endpointgroup-endpointconfiguration.html) property type.
437    #[derive(Debug, Default)]
438    pub struct EndpointConfiguration {
439        /// Property [`ClientIPPreservationEnabled`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-globalaccelerator-endpointgroup-endpointconfiguration.html#cfn-globalaccelerator-endpointgroup-endpointconfiguration-clientippreservationenabled).
440        ///
441        /// Update type: _Mutable_.
442        /// AWS CloudFormation doesn't replace the resource when you change this property.
443        pub client_ip_preservation_enabled: Option<::Value<bool>>,
444        /// Property [`EndpointId`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-globalaccelerator-endpointgroup-endpointconfiguration.html#cfn-globalaccelerator-endpointgroup-endpointconfiguration-endpointid).
445        ///
446        /// Update type: _Mutable_.
447        /// AWS CloudFormation doesn't replace the resource when you change this property.
448        pub endpoint_id: ::Value<String>,
449        /// Property [`Weight`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-globalaccelerator-endpointgroup-endpointconfiguration.html#cfn-globalaccelerator-endpointgroup-endpointconfiguration-weight).
450        ///
451        /// Update type: _Mutable_.
452        /// AWS CloudFormation doesn't replace the resource when you change this property.
453        pub weight: Option<::Value<u32>>,
454    }
455
456    impl ::codec::SerializeValue for EndpointConfiguration {
457        fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
458            let mut map = ::serde::Serializer::serialize_map(s, None)?;
459            if let Some(ref client_ip_preservation_enabled) = self.client_ip_preservation_enabled {
460                ::serde::ser::SerializeMap::serialize_entry(&mut map, "ClientIPPreservationEnabled", client_ip_preservation_enabled)?;
461            }
462            ::serde::ser::SerializeMap::serialize_entry(&mut map, "EndpointId", &self.endpoint_id)?;
463            if let Some(ref weight) = self.weight {
464                ::serde::ser::SerializeMap::serialize_entry(&mut map, "Weight", weight)?;
465            }
466            ::serde::ser::SerializeMap::end(map)
467        }
468    }
469
470    impl ::codec::DeserializeValue for EndpointConfiguration {
471        fn deserialize<'de, D: ::serde::Deserializer<'de>>(d: D) -> Result<EndpointConfiguration, D::Error> {
472            struct Visitor;
473
474            impl<'de> ::serde::de::Visitor<'de> for Visitor {
475                type Value = EndpointConfiguration;
476
477                fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
478                    write!(f, "a struct of type EndpointConfiguration")
479                }
480
481                fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
482                    let mut client_ip_preservation_enabled: Option<::Value<bool>> = None;
483                    let mut endpoint_id: Option<::Value<String>> = None;
484                    let mut weight: Option<::Value<u32>> = None;
485
486                    while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
487                        match __cfn_key.as_ref() {
488                            "ClientIPPreservationEnabled" => {
489                                client_ip_preservation_enabled = ::serde::de::MapAccess::next_value(&mut map)?;
490                            }
491                            "EndpointId" => {
492                                endpoint_id = ::serde::de::MapAccess::next_value(&mut map)?;
493                            }
494                            "Weight" => {
495                                weight = ::serde::de::MapAccess::next_value(&mut map)?;
496                            }
497                            _ => {}
498                        }
499                    }
500
501                    Ok(EndpointConfiguration {
502                        client_ip_preservation_enabled: client_ip_preservation_enabled,
503                        endpoint_id: endpoint_id.ok_or(::serde::de::Error::missing_field("EndpointId"))?,
504                        weight: weight,
505                    })
506                }
507            }
508
509            d.deserialize_map(Visitor)
510        }
511    }
512
513    /// The [`AWS::GlobalAccelerator::EndpointGroup.PortOverride`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-globalaccelerator-endpointgroup-portoverride.html) property type.
514    #[derive(Debug, Default)]
515    pub struct PortOverride {
516        /// Property [`EndpointPort`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-globalaccelerator-endpointgroup-portoverride.html#cfn-globalaccelerator-endpointgroup-portoverride-endpointport).
517        ///
518        /// Update type: _Mutable_.
519        /// AWS CloudFormation doesn't replace the resource when you change this property.
520        pub endpoint_port: ::Value<u32>,
521        /// Property [`ListenerPort`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-globalaccelerator-endpointgroup-portoverride.html#cfn-globalaccelerator-endpointgroup-portoverride-listenerport).
522        ///
523        /// Update type: _Mutable_.
524        /// AWS CloudFormation doesn't replace the resource when you change this property.
525        pub listener_port: ::Value<u32>,
526    }
527
528    impl ::codec::SerializeValue for PortOverride {
529        fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
530            let mut map = ::serde::Serializer::serialize_map(s, None)?;
531            ::serde::ser::SerializeMap::serialize_entry(&mut map, "EndpointPort", &self.endpoint_port)?;
532            ::serde::ser::SerializeMap::serialize_entry(&mut map, "ListenerPort", &self.listener_port)?;
533            ::serde::ser::SerializeMap::end(map)
534        }
535    }
536
537    impl ::codec::DeserializeValue for PortOverride {
538        fn deserialize<'de, D: ::serde::Deserializer<'de>>(d: D) -> Result<PortOverride, D::Error> {
539            struct Visitor;
540
541            impl<'de> ::serde::de::Visitor<'de> for Visitor {
542                type Value = PortOverride;
543
544                fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
545                    write!(f, "a struct of type PortOverride")
546                }
547
548                fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
549                    let mut endpoint_port: Option<::Value<u32>> = None;
550                    let mut listener_port: Option<::Value<u32>> = None;
551
552                    while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
553                        match __cfn_key.as_ref() {
554                            "EndpointPort" => {
555                                endpoint_port = ::serde::de::MapAccess::next_value(&mut map)?;
556                            }
557                            "ListenerPort" => {
558                                listener_port = ::serde::de::MapAccess::next_value(&mut map)?;
559                            }
560                            _ => {}
561                        }
562                    }
563
564                    Ok(PortOverride {
565                        endpoint_port: endpoint_port.ok_or(::serde::de::Error::missing_field("EndpointPort"))?,
566                        listener_port: listener_port.ok_or(::serde::de::Error::missing_field("ListenerPort"))?,
567                    })
568                }
569            }
570
571            d.deserialize_map(Visitor)
572        }
573    }
574}
575
576pub mod listener {
577    //! Property types for the `Listener` resource.
578
579    /// The [`AWS::GlobalAccelerator::Listener.PortRange`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-globalaccelerator-listener-portrange.html) property type.
580    #[derive(Debug, Default)]
581    pub struct PortRange {
582        /// Property [`FromPort`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-globalaccelerator-listener-portrange.html#cfn-globalaccelerator-listener-portrange-fromport).
583        ///
584        /// Update type: _Mutable_.
585        /// AWS CloudFormation doesn't replace the resource when you change this property.
586        pub from_port: ::Value<u32>,
587        /// Property [`ToPort`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-globalaccelerator-listener-portrange.html#cfn-globalaccelerator-listener-portrange-toport).
588        ///
589        /// Update type: _Mutable_.
590        /// AWS CloudFormation doesn't replace the resource when you change this property.
591        pub to_port: ::Value<u32>,
592    }
593
594    impl ::codec::SerializeValue for PortRange {
595        fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
596            let mut map = ::serde::Serializer::serialize_map(s, None)?;
597            ::serde::ser::SerializeMap::serialize_entry(&mut map, "FromPort", &self.from_port)?;
598            ::serde::ser::SerializeMap::serialize_entry(&mut map, "ToPort", &self.to_port)?;
599            ::serde::ser::SerializeMap::end(map)
600        }
601    }
602
603    impl ::codec::DeserializeValue for PortRange {
604        fn deserialize<'de, D: ::serde::Deserializer<'de>>(d: D) -> Result<PortRange, D::Error> {
605            struct Visitor;
606
607            impl<'de> ::serde::de::Visitor<'de> for Visitor {
608                type Value = PortRange;
609
610                fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
611                    write!(f, "a struct of type PortRange")
612                }
613
614                fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
615                    let mut from_port: Option<::Value<u32>> = None;
616                    let mut to_port: Option<::Value<u32>> = None;
617
618                    while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
619                        match __cfn_key.as_ref() {
620                            "FromPort" => {
621                                from_port = ::serde::de::MapAccess::next_value(&mut map)?;
622                            }
623                            "ToPort" => {
624                                to_port = ::serde::de::MapAccess::next_value(&mut map)?;
625                            }
626                            _ => {}
627                        }
628                    }
629
630                    Ok(PortRange {
631                        from_port: from_port.ok_or(::serde::de::Error::missing_field("FromPort"))?,
632                        to_port: to_port.ok_or(::serde::de::Error::missing_field("ToPort"))?,
633                    })
634                }
635            }
636
637            d.deserialize_map(Visitor)
638        }
639    }
640}