cfn/aws/
codecommit.rs

1//! Types for the `CodeCommit` service.
2
3/// The [`AWS::CodeCommit::Repository`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html) resource type.
4#[derive(Debug, Default)]
5pub struct Repository {
6    properties: RepositoryProperties
7}
8
9/// Properties for the `Repository` resource.
10#[derive(Debug, Default)]
11pub struct RepositoryProperties {
12    /// Property [`Code`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html#cfn-codecommit-repository-code).
13    ///
14    /// Update type: _Mutable_.
15    /// AWS CloudFormation doesn't replace the resource when you change this property.
16    pub code: Option<::Value<self::repository::Code>>,
17    /// Property [`RepositoryDescription`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html#cfn-codecommit-repository-repositorydescription).
18    ///
19    /// Update type: _Mutable_.
20    /// AWS CloudFormation doesn't replace the resource when you change this property.
21    pub repository_description: Option<::Value<String>>,
22    /// Property [`RepositoryName`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html#cfn-codecommit-repository-repositoryname).
23    ///
24    /// Update type: _Mutable_.
25    /// AWS CloudFormation doesn't replace the resource when you change this property.
26    pub repository_name: ::Value<String>,
27    /// Property [`Tags`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html#cfn-codecommit-repository-tags).
28    ///
29    /// Update type: _Mutable_.
30    /// AWS CloudFormation doesn't replace the resource when you change this property.
31    pub tags: Option<::ValueList<::Tag>>,
32    /// Property [`Triggers`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html#cfn-codecommit-repository-triggers).
33    ///
34    /// Update type: _Conditional_.
35    /// Conditional updates can be mutable or immutable, depending on, for example, which other properties you updated.
36    /// For more information, see the relevant resource type documentation.
37    pub triggers: Option<::ValueList<self::repository::RepositoryTrigger>>,
38}
39
40impl ::serde::Serialize for RepositoryProperties {
41    fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
42        let mut map = ::serde::Serializer::serialize_map(s, None)?;
43        if let Some(ref code) = self.code {
44            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Code", code)?;
45        }
46        if let Some(ref repository_description) = self.repository_description {
47            ::serde::ser::SerializeMap::serialize_entry(&mut map, "RepositoryDescription", repository_description)?;
48        }
49        ::serde::ser::SerializeMap::serialize_entry(&mut map, "RepositoryName", &self.repository_name)?;
50        if let Some(ref tags) = self.tags {
51            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Tags", tags)?;
52        }
53        if let Some(ref triggers) = self.triggers {
54            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Triggers", triggers)?;
55        }
56        ::serde::ser::SerializeMap::end(map)
57    }
58}
59
60impl<'de> ::serde::Deserialize<'de> for RepositoryProperties {
61    fn deserialize<D: ::serde::Deserializer<'de>>(d: D) -> Result<RepositoryProperties, D::Error> {
62        struct Visitor;
63
64        impl<'de> ::serde::de::Visitor<'de> for Visitor {
65            type Value = RepositoryProperties;
66
67            fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
68                write!(f, "a struct of type RepositoryProperties")
69            }
70
71            fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
72                let mut code: Option<::Value<self::repository::Code>> = None;
73                let mut repository_description: Option<::Value<String>> = None;
74                let mut repository_name: Option<::Value<String>> = None;
75                let mut tags: Option<::ValueList<::Tag>> = None;
76                let mut triggers: Option<::ValueList<self::repository::RepositoryTrigger>> = None;
77
78                while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
79                    match __cfn_key.as_ref() {
80                        "Code" => {
81                            code = ::serde::de::MapAccess::next_value(&mut map)?;
82                        }
83                        "RepositoryDescription" => {
84                            repository_description = ::serde::de::MapAccess::next_value(&mut map)?;
85                        }
86                        "RepositoryName" => {
87                            repository_name = ::serde::de::MapAccess::next_value(&mut map)?;
88                        }
89                        "Tags" => {
90                            tags = ::serde::de::MapAccess::next_value(&mut map)?;
91                        }
92                        "Triggers" => {
93                            triggers = ::serde::de::MapAccess::next_value(&mut map)?;
94                        }
95                        _ => {}
96                    }
97                }
98
99                Ok(RepositoryProperties {
100                    code: code,
101                    repository_description: repository_description,
102                    repository_name: repository_name.ok_or(::serde::de::Error::missing_field("RepositoryName"))?,
103                    tags: tags,
104                    triggers: triggers,
105                })
106            }
107        }
108
109        d.deserialize_map(Visitor)
110    }
111}
112
113impl ::Resource for Repository {
114    type Properties = RepositoryProperties;
115    const TYPE: &'static str = "AWS::CodeCommit::Repository";
116    fn properties(&self) -> &RepositoryProperties {
117        &self.properties
118    }
119    fn properties_mut(&mut self) -> &mut RepositoryProperties {
120        &mut self.properties
121    }
122}
123
124impl ::private::Sealed for Repository {}
125
126impl From<RepositoryProperties> for Repository {
127    fn from(properties: RepositoryProperties) -> Repository {
128        Repository { properties }
129    }
130}
131
132pub mod repository {
133    //! Property types for the `Repository` resource.
134
135    /// The [`AWS::CodeCommit::Repository.Code`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-code.html) property type.
136    #[derive(Debug, Default)]
137    pub struct Code {
138        /// Property [`BranchName`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-code.html#cfn-codecommit-repository-code-branchname).
139        ///
140        /// Update type: _Mutable_.
141        /// AWS CloudFormation doesn't replace the resource when you change this property.
142        pub branch_name: Option<::Value<String>>,
143        /// Property [`S3`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-code.html#cfn-codecommit-repository-code-s3).
144        ///
145        /// Update type: _Mutable_.
146        /// AWS CloudFormation doesn't replace the resource when you change this property.
147        pub s3: ::Value<S3>,
148    }
149
150    impl ::codec::SerializeValue for Code {
151        fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
152            let mut map = ::serde::Serializer::serialize_map(s, None)?;
153            if let Some(ref branch_name) = self.branch_name {
154                ::serde::ser::SerializeMap::serialize_entry(&mut map, "BranchName", branch_name)?;
155            }
156            ::serde::ser::SerializeMap::serialize_entry(&mut map, "S3", &self.s3)?;
157            ::serde::ser::SerializeMap::end(map)
158        }
159    }
160
161    impl ::codec::DeserializeValue for Code {
162        fn deserialize<'de, D: ::serde::Deserializer<'de>>(d: D) -> Result<Code, D::Error> {
163            struct Visitor;
164
165            impl<'de> ::serde::de::Visitor<'de> for Visitor {
166                type Value = Code;
167
168                fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
169                    write!(f, "a struct of type Code")
170                }
171
172                fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
173                    let mut branch_name: Option<::Value<String>> = None;
174                    let mut s3: Option<::Value<S3>> = None;
175
176                    while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
177                        match __cfn_key.as_ref() {
178                            "BranchName" => {
179                                branch_name = ::serde::de::MapAccess::next_value(&mut map)?;
180                            }
181                            "S3" => {
182                                s3 = ::serde::de::MapAccess::next_value(&mut map)?;
183                            }
184                            _ => {}
185                        }
186                    }
187
188                    Ok(Code {
189                        branch_name: branch_name,
190                        s3: s3.ok_or(::serde::de::Error::missing_field("S3"))?,
191                    })
192                }
193            }
194
195            d.deserialize_map(Visitor)
196        }
197    }
198
199    /// The [`AWS::CodeCommit::Repository.RepositoryTrigger`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html) property type.
200    #[derive(Debug, Default)]
201    pub struct RepositoryTrigger {
202        /// Property [`Branches`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html#cfn-codecommit-repository-repositorytrigger-branches).
203        ///
204        /// Update type: _Mutable_.
205        /// AWS CloudFormation doesn't replace the resource when you change this property.
206        pub branches: Option<::ValueList<String>>,
207        /// Property [`CustomData`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html#cfn-codecommit-repository-repositorytrigger-customdata).
208        ///
209        /// Update type: _Mutable_.
210        /// AWS CloudFormation doesn't replace the resource when you change this property.
211        pub custom_data: Option<::Value<String>>,
212        /// Property [`DestinationArn`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html#cfn-codecommit-repository-repositorytrigger-destinationarn).
213        ///
214        /// Update type: _Mutable_.
215        /// AWS CloudFormation doesn't replace the resource when you change this property.
216        pub destination_arn: ::Value<String>,
217        /// Property [`Events`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html#cfn-codecommit-repository-repositorytrigger-events).
218        ///
219        /// Update type: _Mutable_.
220        /// AWS CloudFormation doesn't replace the resource when you change this property.
221        pub events: ::ValueList<String>,
222        /// Property [`Name`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html#cfn-codecommit-repository-repositorytrigger-name).
223        ///
224        /// Update type: _Mutable_.
225        /// AWS CloudFormation doesn't replace the resource when you change this property.
226        pub name: ::Value<String>,
227    }
228
229    impl ::codec::SerializeValue for RepositoryTrigger {
230        fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
231            let mut map = ::serde::Serializer::serialize_map(s, None)?;
232            if let Some(ref branches) = self.branches {
233                ::serde::ser::SerializeMap::serialize_entry(&mut map, "Branches", branches)?;
234            }
235            if let Some(ref custom_data) = self.custom_data {
236                ::serde::ser::SerializeMap::serialize_entry(&mut map, "CustomData", custom_data)?;
237            }
238            ::serde::ser::SerializeMap::serialize_entry(&mut map, "DestinationArn", &self.destination_arn)?;
239            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Events", &self.events)?;
240            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Name", &self.name)?;
241            ::serde::ser::SerializeMap::end(map)
242        }
243    }
244
245    impl ::codec::DeserializeValue for RepositoryTrigger {
246        fn deserialize<'de, D: ::serde::Deserializer<'de>>(d: D) -> Result<RepositoryTrigger, D::Error> {
247            struct Visitor;
248
249            impl<'de> ::serde::de::Visitor<'de> for Visitor {
250                type Value = RepositoryTrigger;
251
252                fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
253                    write!(f, "a struct of type RepositoryTrigger")
254                }
255
256                fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
257                    let mut branches: Option<::ValueList<String>> = None;
258                    let mut custom_data: Option<::Value<String>> = None;
259                    let mut destination_arn: Option<::Value<String>> = None;
260                    let mut events: Option<::ValueList<String>> = None;
261                    let mut name: Option<::Value<String>> = None;
262
263                    while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
264                        match __cfn_key.as_ref() {
265                            "Branches" => {
266                                branches = ::serde::de::MapAccess::next_value(&mut map)?;
267                            }
268                            "CustomData" => {
269                                custom_data = ::serde::de::MapAccess::next_value(&mut map)?;
270                            }
271                            "DestinationArn" => {
272                                destination_arn = ::serde::de::MapAccess::next_value(&mut map)?;
273                            }
274                            "Events" => {
275                                events = ::serde::de::MapAccess::next_value(&mut map)?;
276                            }
277                            "Name" => {
278                                name = ::serde::de::MapAccess::next_value(&mut map)?;
279                            }
280                            _ => {}
281                        }
282                    }
283
284                    Ok(RepositoryTrigger {
285                        branches: branches,
286                        custom_data: custom_data,
287                        destination_arn: destination_arn.ok_or(::serde::de::Error::missing_field("DestinationArn"))?,
288                        events: events.ok_or(::serde::de::Error::missing_field("Events"))?,
289                        name: name.ok_or(::serde::de::Error::missing_field("Name"))?,
290                    })
291                }
292            }
293
294            d.deserialize_map(Visitor)
295        }
296    }
297
298    /// The [`AWS::CodeCommit::Repository.S3`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-s3.html) property type.
299    #[derive(Debug, Default)]
300    pub struct S3 {
301        /// Property [`Bucket`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-s3.html#cfn-codecommit-repository-s3-bucket).
302        ///
303        /// Update type: _Mutable_.
304        /// AWS CloudFormation doesn't replace the resource when you change this property.
305        pub bucket: ::Value<String>,
306        /// Property [`Key`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-s3.html#cfn-codecommit-repository-s3-key).
307        ///
308        /// Update type: _Mutable_.
309        /// AWS CloudFormation doesn't replace the resource when you change this property.
310        pub key: ::Value<String>,
311        /// Property [`ObjectVersion`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-s3.html#cfn-codecommit-repository-s3-objectversion).
312        ///
313        /// Update type: _Mutable_.
314        /// AWS CloudFormation doesn't replace the resource when you change this property.
315        pub object_version: Option<::Value<String>>,
316    }
317
318    impl ::codec::SerializeValue for S3 {
319        fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
320            let mut map = ::serde::Serializer::serialize_map(s, None)?;
321            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Bucket", &self.bucket)?;
322            ::serde::ser::SerializeMap::serialize_entry(&mut map, "Key", &self.key)?;
323            if let Some(ref object_version) = self.object_version {
324                ::serde::ser::SerializeMap::serialize_entry(&mut map, "ObjectVersion", object_version)?;
325            }
326            ::serde::ser::SerializeMap::end(map)
327        }
328    }
329
330    impl ::codec::DeserializeValue for S3 {
331        fn deserialize<'de, D: ::serde::Deserializer<'de>>(d: D) -> Result<S3, D::Error> {
332            struct Visitor;
333
334            impl<'de> ::serde::de::Visitor<'de> for Visitor {
335                type Value = S3;
336
337                fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
338                    write!(f, "a struct of type S3")
339                }
340
341                fn visit_map<A: ::serde::de::MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
342                    let mut bucket: Option<::Value<String>> = None;
343                    let mut key: Option<::Value<String>> = None;
344                    let mut object_version: Option<::Value<String>> = None;
345
346                    while let Some(__cfn_key) = ::serde::de::MapAccess::next_key::<String>(&mut map)? {
347                        match __cfn_key.as_ref() {
348                            "Bucket" => {
349                                bucket = ::serde::de::MapAccess::next_value(&mut map)?;
350                            }
351                            "Key" => {
352                                key = ::serde::de::MapAccess::next_value(&mut map)?;
353                            }
354                            "ObjectVersion" => {
355                                object_version = ::serde::de::MapAccess::next_value(&mut map)?;
356                            }
357                            _ => {}
358                        }
359                    }
360
361                    Ok(S3 {
362                        bucket: bucket.ok_or(::serde::de::Error::missing_field("Bucket"))?,
363                        key: key.ok_or(::serde::de::Error::missing_field("Key"))?,
364                        object_version: object_version,
365                    })
366                }
367            }
368
369            d.deserialize_map(Visitor)
370        }
371    }
372}