cfn/aws/
securityhub.rs

1//! Types for the `SecurityHub` service.
2
3/// The [`AWS::SecurityHub::Hub`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-securityhub-hub.html) resource type.
4#[derive(Debug, Default)]
5pub struct Hub {
6    properties: HubProperties
7}
8
9/// Properties for the `Hub` resource.
10#[derive(Debug, Default)]
11pub struct HubProperties {
12    /// Property [`Tags`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-securityhub-hub.html#cfn-securityhub-hub-tags).
13    ///
14    /// Update type: _Mutable_.
15    /// AWS CloudFormation doesn't replace the resource when you change this property.
16    pub tags: Option<::Value<::json::Value>>,
17}
18
19impl ::serde::Serialize for HubProperties {
20    fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
21        let mut map = ::serde::Serializer::serialize_map(s, None)?;
22        if let Some(ref tags) = self.tags {
23            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Tags", tags)?;
24        }
25        ::serde::ser::SerializeMap::end(map)
26    }
27}
28
29impl<'de> ::serde::Deserialize<'de> for HubProperties {
30    fn deserialize<D: ::serde::Deserializer<'de>>(d: D) -> Result<HubProperties, D::Error> {
31        struct Visitor;
32
33        impl<'de> ::serde::de::Visitor<'de> for Visitor {
34            type Value = HubProperties;
35
36            fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
37                write!(f, "a struct of type HubProperties")
38            }
39
40            fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
41                let mut tags: Option<::Value<::json::Value>> = None;
42
43                while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
44                    match __cfn_key.as_ref() {
45                        "Tags" => {
46                            tags = ::serde::de::MapAccess::next_value(&mut map)?;
47                        }
48                        _ => {}
49                    }
50                }
51
52                Ok(HubProperties {
53                    tags: tags,
54                })
55            }
56        }
57
58        d.deserialize_map(Visitor)
59    }
60}
61
62impl ::Resource for Hub {
63    type Properties = HubProperties;
64    const TYPE: &'static str = "AWS::SecurityHub::Hub";
65    fn properties(&self) -> &HubProperties {
66        &self.properties
67    }
68    fn properties_mut(&mut self) -> &mut HubProperties {
69        &mut self.properties
70    }
71}
72
73impl ::private::Sealed for Hub {}
74
75impl From<HubProperties> for Hub {
76    fn from(properties: HubProperties) -> Hub {
77        Hub { properties }
78    }
79}