cfn 0.0.8

Type-safe representations for AWS CloudFormation templates, resources and properties
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
//! Types for the `CE` service.

/// The [`AWS::CE::AnomalyMonitor`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalymonitor.html) resource type.
#[derive(Debug, Default)]
pub struct AnomalyMonitor {
    properties: AnomalyMonitorProperties
}

/// Properties for the `AnomalyMonitor` resource.
#[derive(Debug, Default)]
pub struct AnomalyMonitorProperties {
    /// Property [`MonitorDimension`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalymonitor.html#cfn-ce-anomalymonitor-monitordimension).
    ///
    /// Update type: _Immutable_.
    /// AWS CloudFormation replaces the resource when you change this property.
    pub monitor_dimension: Option<::Value<String>>,
    /// Property [`MonitorName`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalymonitor.html#cfn-ce-anomalymonitor-monitorname).
    ///
    /// Update type: _Mutable_.
    /// AWS CloudFormation doesn't replace the resource when you change this property.
    pub monitor_name: ::Value<String>,
    /// Property [`MonitorSpecification`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalymonitor.html#cfn-ce-anomalymonitor-monitorspecification).
    ///
    /// Update type: _Immutable_.
    /// AWS CloudFormation replaces the resource when you change this property.
    pub monitor_specification: Option<::Value<String>>,
    /// Property [`MonitorType`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalymonitor.html#cfn-ce-anomalymonitor-monitortype).
    ///
    /// Update type: _Immutable_.
    /// AWS CloudFormation replaces the resource when you change this property.
    pub monitor_type: ::Value<String>,
}

impl ::serde::Serialize for AnomalyMonitorProperties {
    fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
        let mut map = ::serde::Serializer::serialize_map(s, None)?;
        if let Some(ref monitor_dimension) = self.monitor_dimension {
            ::serde::ser::SerializeMap::serialize_entry(&mut map, "MonitorDimension", monitor_dimension)?;
        }
        ::serde::ser::SerializeMap::serialize_entry(&mut map, "MonitorName", &self.monitor_name)?;
        if let Some(ref monitor_specification) = self.monitor_specification {
            ::serde::ser::SerializeMap::serialize_entry(&mut map, "MonitorSpecification", monitor_specification)?;
        }
        ::serde::ser::SerializeMap::serialize_entry(&mut map, "MonitorType", &self.monitor_type)?;
        ::serde::ser::SerializeMap::end(map)
    }
}

impl<'de> ::serde::Deserialize<'de> for AnomalyMonitorProperties {
    fn deserialize<D: ::serde::Deserializer<'de>>(d: D) -> Result<AnomalyMonitorProperties, D::Error> {
        struct Visitor;

        impl<'de> ::serde::de::Visitor<'de> for Visitor {
            type Value = AnomalyMonitorProperties;

            fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                write!(f, "a struct of type AnomalyMonitorProperties")
            }

            fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
                let mut monitor_dimension: Option<::Value<String>> = None;
                let mut monitor_name: Option<::Value<String>> = None;
                let mut monitor_specification: Option<::Value<String>> = None;
                let mut monitor_type: Option<::Value<String>> = None;

                while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
                    match __cfn_key.as_ref() {
                        "MonitorDimension" => {
                            monitor_dimension = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        "MonitorName" => {
                            monitor_name = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        "MonitorSpecification" => {
                            monitor_specification = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        "MonitorType" => {
                            monitor_type = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        _ => {}
                    }
                }

                Ok(AnomalyMonitorProperties {
                    monitor_dimension: monitor_dimension,
                    monitor_name: monitor_name.ok_or(::serde::de::Error::missing_field("MonitorName"))?,
                    monitor_specification: monitor_specification,
                    monitor_type: monitor_type.ok_or(::serde::de::Error::missing_field("MonitorType"))?,
                })
            }
        }

        d.deserialize_map(Visitor)
    }
}

impl ::Resource for AnomalyMonitor {
    type Properties = AnomalyMonitorProperties;
    const TYPE: &'static str = "AWS::CE::AnomalyMonitor";
    fn properties(&self) -> &AnomalyMonitorProperties {
        &self.properties
    }
    fn properties_mut(&mut self) -> &mut AnomalyMonitorProperties {
        &mut self.properties
    }
}

impl ::private::Sealed for AnomalyMonitor {}

impl From<AnomalyMonitorProperties> for AnomalyMonitor {
    fn from(properties: AnomalyMonitorProperties) -> AnomalyMonitor {
        AnomalyMonitor { properties }
    }
}

/// The [`AWS::CE::AnomalySubscription`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalysubscription.html) resource type.
#[derive(Debug, Default)]
pub struct AnomalySubscription {
    properties: AnomalySubscriptionProperties
}

/// Properties for the `AnomalySubscription` resource.
#[derive(Debug, Default)]
pub struct AnomalySubscriptionProperties {
    /// Property [`Frequency`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalysubscription.html#cfn-ce-anomalysubscription-frequency).
    ///
    /// Update type: _Mutable_.
    /// AWS CloudFormation doesn't replace the resource when you change this property.
    pub frequency: ::Value<String>,
    /// Property [`MonitorArnList`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalysubscription.html#cfn-ce-anomalysubscription-monitorarnlist).
    ///
    /// Update type: _Mutable_.
    /// AWS CloudFormation doesn't replace the resource when you change this property.
    pub monitor_arn_list: ::ValueList<String>,
    /// Property [`Subscribers`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalysubscription.html#cfn-ce-anomalysubscription-subscribers).
    ///
    /// Update type: _Mutable_.
    /// AWS CloudFormation doesn't replace the resource when you change this property.
    pub subscribers: ::ValueList<self::anomaly_subscription::Subscriber>,
    /// Property [`SubscriptionName`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalysubscription.html#cfn-ce-anomalysubscription-subscriptionname).
    ///
    /// Update type: _Mutable_.
    /// AWS CloudFormation doesn't replace the resource when you change this property.
    pub subscription_name: ::Value<String>,
    /// Property [`Threshold`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalysubscription.html#cfn-ce-anomalysubscription-threshold).
    ///
    /// Update type: _Mutable_.
    /// AWS CloudFormation doesn't replace the resource when you change this property.
    pub threshold: ::Value<f64>,
}

impl ::serde::Serialize for AnomalySubscriptionProperties {
    fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
        let mut map = ::serde::Serializer::serialize_map(s, None)?;
        ::serde::ser::SerializeMap::serialize_entry(&mut map, "Frequency", &self.frequency)?;
        ::serde::ser::SerializeMap::serialize_entry(&mut map, "MonitorArnList", &self.monitor_arn_list)?;
        ::serde::ser::SerializeMap::serialize_entry(&mut map, "Subscribers", &self.subscribers)?;
        ::serde::ser::SerializeMap::serialize_entry(&mut map, "SubscriptionName", &self.subscription_name)?;
        ::serde::ser::SerializeMap::serialize_entry(&mut map, "Threshold", &self.threshold)?;
        ::serde::ser::SerializeMap::end(map)
    }
}

impl<'de> ::serde::Deserialize<'de> for AnomalySubscriptionProperties {
    fn deserialize<D: ::serde::Deserializer<'de>>(d: D) -> Result<AnomalySubscriptionProperties, D::Error> {
        struct Visitor;

        impl<'de> ::serde::de::Visitor<'de> for Visitor {
            type Value = AnomalySubscriptionProperties;

            fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                write!(f, "a struct of type AnomalySubscriptionProperties")
            }

            fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
                let mut frequency: Option<::Value<String>> = None;
                let mut monitor_arn_list: Option<::ValueList<String>> = None;
                let mut subscribers: Option<::ValueList<self::anomaly_subscription::Subscriber>> = None;
                let mut subscription_name: Option<::Value<String>> = None;
                let mut threshold: Option<::Value<f64>> = None;

                while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
                    match __cfn_key.as_ref() {
                        "Frequency" => {
                            frequency = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        "MonitorArnList" => {
                            monitor_arn_list = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        "Subscribers" => {
                            subscribers = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        "SubscriptionName" => {
                            subscription_name = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        "Threshold" => {
                            threshold = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        _ => {}
                    }
                }

                Ok(AnomalySubscriptionProperties {
                    frequency: frequency.ok_or(::serde::de::Error::missing_field("Frequency"))?,
                    monitor_arn_list: monitor_arn_list.ok_or(::serde::de::Error::missing_field("MonitorArnList"))?,
                    subscribers: subscribers.ok_or(::serde::de::Error::missing_field("Subscribers"))?,
                    subscription_name: subscription_name.ok_or(::serde::de::Error::missing_field("SubscriptionName"))?,
                    threshold: threshold.ok_or(::serde::de::Error::missing_field("Threshold"))?,
                })
            }
        }

        d.deserialize_map(Visitor)
    }
}

impl ::Resource for AnomalySubscription {
    type Properties = AnomalySubscriptionProperties;
    const TYPE: &'static str = "AWS::CE::AnomalySubscription";
    fn properties(&self) -> &AnomalySubscriptionProperties {
        &self.properties
    }
    fn properties_mut(&mut self) -> &mut AnomalySubscriptionProperties {
        &mut self.properties
    }
}

impl ::private::Sealed for AnomalySubscription {}

impl From<AnomalySubscriptionProperties> for AnomalySubscription {
    fn from(properties: AnomalySubscriptionProperties) -> AnomalySubscription {
        AnomalySubscription { properties }
    }
}

/// The [`AWS::CE::CostCategory`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-costcategory.html) resource type.
#[derive(Debug, Default)]
pub struct CostCategory {
    properties: CostCategoryProperties
}

/// Properties for the `CostCategory` resource.
#[derive(Debug, Default)]
pub struct CostCategoryProperties {
    /// Property [`DefaultValue`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-costcategory.html#cfn-ce-costcategory-defaultvalue).
    ///
    /// Update type: _Mutable_.
    /// AWS CloudFormation doesn't replace the resource when you change this property.
    pub default_value: Option<::Value<String>>,
    /// Property [`Name`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-costcategory.html#cfn-ce-costcategory-name).
    ///
    /// Update type: _Immutable_.
    /// AWS CloudFormation replaces the resource when you change this property.
    pub name: ::Value<String>,
    /// Property [`RuleVersion`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-costcategory.html#cfn-ce-costcategory-ruleversion).
    ///
    /// Update type: _Mutable_.
    /// AWS CloudFormation doesn't replace the resource when you change this property.
    pub rule_version: ::Value<String>,
    /// Property [`Rules`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-costcategory.html#cfn-ce-costcategory-rules).
    ///
    /// Update type: _Mutable_.
    /// AWS CloudFormation doesn't replace the resource when you change this property.
    pub rules: ::Value<String>,
}

impl ::serde::Serialize for CostCategoryProperties {
    fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
        let mut map = ::serde::Serializer::serialize_map(s, None)?;
        if let Some(ref default_value) = self.default_value {
            ::serde::ser::SerializeMap::serialize_entry(&mut map, "DefaultValue", default_value)?;
        }
        ::serde::ser::SerializeMap::serialize_entry(&mut map, "Name", &self.name)?;
        ::serde::ser::SerializeMap::serialize_entry(&mut map, "RuleVersion", &self.rule_version)?;
        ::serde::ser::SerializeMap::serialize_entry(&mut map, "Rules", &self.rules)?;
        ::serde::ser::SerializeMap::end(map)
    }
}

impl<'de> ::serde::Deserialize<'de> for CostCategoryProperties {
    fn deserialize<D: ::serde::Deserializer<'de>>(d: D) -> Result<CostCategoryProperties, D::Error> {
        struct Visitor;

        impl<'de> ::serde::de::Visitor<'de> for Visitor {
            type Value = CostCategoryProperties;

            fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                write!(f, "a struct of type CostCategoryProperties")
            }

            fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
                let mut default_value: Option<::Value<String>> = None;
                let mut name: Option<::Value<String>> = None;
                let mut rule_version: Option<::Value<String>> = None;
                let mut rules: Option<::Value<String>> = None;

                while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
                    match __cfn_key.as_ref() {
                        "DefaultValue" => {
                            default_value = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        "Name" => {
                            name = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        "RuleVersion" => {
                            rule_version = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        "Rules" => {
                            rules = ::serde::de::MapAccess::next_value(&mut map)?;
                        }
                        _ => {}
                    }
                }

                Ok(CostCategoryProperties {
                    default_value: default_value,
                    name: name.ok_or(::serde::de::Error::missing_field("Name"))?,
                    rule_version: rule_version.ok_or(::serde::de::Error::missing_field("RuleVersion"))?,
                    rules: rules.ok_or(::serde::de::Error::missing_field("Rules"))?,
                })
            }
        }

        d.deserialize_map(Visitor)
    }
}

impl ::Resource for CostCategory {
    type Properties = CostCategoryProperties;
    const TYPE: &'static str = "AWS::CE::CostCategory";
    fn properties(&self) -> &CostCategoryProperties {
        &self.properties
    }
    fn properties_mut(&mut self) -> &mut CostCategoryProperties {
        &mut self.properties
    }
}

impl ::private::Sealed for CostCategory {}

impl From<CostCategoryProperties> for CostCategory {
    fn from(properties: CostCategoryProperties) -> CostCategory {
        CostCategory { properties }
    }
}

pub mod anomaly_subscription {
    //! Property types for the `AnomalySubscription` resource.

    /// The [`AWS::CE::AnomalySubscription.Subscriber`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ce-anomalysubscription-subscriber.html) property type.
    #[derive(Debug, Default)]
    pub struct Subscriber {
        /// Property [`Address`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ce-anomalysubscription-subscriber.html#cfn-ce-anomalysubscription-subscriber-address).
        ///
        /// Update type: _Mutable_.
        /// AWS CloudFormation doesn't replace the resource when you change this property.
        pub address: ::Value<String>,
        /// Property [`Status`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ce-anomalysubscription-subscriber.html#cfn-ce-anomalysubscription-subscriber-status).
        ///
        /// Update type: _Mutable_.
        /// AWS CloudFormation doesn't replace the resource when you change this property.
        pub status: Option<::Value<String>>,
        /// Property [`Type`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ce-anomalysubscription-subscriber.html#cfn-ce-anomalysubscription-subscriber-type).
        ///
        /// Update type: _Mutable_.
        /// AWS CloudFormation doesn't replace the resource when you change this property.
        pub r#type: ::Value<String>,
    }

    impl ::codec::SerializeValue for Subscriber {
        fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
            let mut map = ::serde::Serializer::serialize_map(s, None)?;
            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Address", &self.address)?;
            if let Some(ref status) = self.status {
                ::serde::ser::SerializeMap::serialize_entry(&mut map, "Status", status)?;
            }
            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Type", &self.r#type)?;
            ::serde::ser::SerializeMap::end(map)
        }
    }

    impl ::codec::DeserializeValue for Subscriber {
        fn deserialize<'de, D: ::serde::Deserializer<'de>>(d: D) -> Result<Subscriber, D::Error> {
            struct Visitor;

            impl<'de> ::serde::de::Visitor<'de> for Visitor {
                type Value = Subscriber;

                fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                    write!(f, "a struct of type Subscriber")
                }

                fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
                    let mut address: Option<::Value<String>> = None;
                    let mut status: Option<::Value<String>> = None;
                    let mut r#type: Option<::Value<String>> = None;

                    while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
                        match __cfn_key.as_ref() {
                            "Address" => {
                                address = ::serde::de::MapAccess::next_value(&mut map)?;
                            }
                            "Status" => {
                                status = ::serde::de::MapAccess::next_value(&mut map)?;
                            }
                            "Type" => {
                                r#type = ::serde::de::MapAccess::next_value(&mut map)?;
                            }
                            _ => {}
                        }
                    }

                    Ok(Subscriber {
                        address: address.ok_or(::serde::de::Error::missing_field("Address"))?,
                        status: status,
                        r#type: r#type.ok_or(::serde::de::Error::missing_field("Type"))?,
                    })
                }
            }

            d.deserialize_map(Visitor)
        }
    }
}