cfndsl 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWQyZDBlNzMzYWU2OGNiOWY3NWU2ZjhlYzVmYzBhZTIwYjdiNjZjMw==
4
+ YmEzYWFkNWUxNGEwYzE5MDFkYTczOWUzNTk4NDIyZmE0ODM3NTI0Nw==
5
5
  data.tar.gz: !binary |-
6
- Yzc4MzM2MjkzYzI1MTllYzIxNzFlZmE4NGIzNDdkYWM3OTU3N2NjNw==
6
+ YTZlMzMxMmQ0NGQ2NjM4NjdjNDRmMmM1NzA3NDZiNTYzOTM0MzZjOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmI1MzdiMTg2ODFhYTE0ZDVmMDA4OWM4NGQyYWIwNTAzYWExZmVmZjYxNTli
10
- NDZmZDlhYmJkNzhlNmIxMDM0Y2ZjNzIxZmJiODk0ZTQ3ZjBhZGRjMTE4ODY1
11
- ZTgxNzU1NTFjMWYzNzE3OTJjOGM4MjNjM2JmYTAwYjA3MTc4OTA=
9
+ ZGIzZWZiZjFiMDdlMTAwNzdjYzk5NGQ0N2VjZTQ2NDQxNTQ0OGM4NTMyMGIy
10
+ MDA0ZDA4MTI5MTRjZGE2OGNhMmFlZjAxNmY5ZWY4OGZkZTI4MzRkNWIzMWJh
11
+ NjgzZGYyODczNzdiMWEzY2RhMWFhMTVkMThmZWJmZjhlMDQwNGE=
12
12
  data.tar.gz: !binary |-
13
- NTgzZTQ5OWIxYTM4YTVlNTc2MzhlNDVjMDM5YTE3M2MxZjY5NDkxNTRiOWJi
14
- OTAzZDVmN2M1NWU1MWFiMjE2NDI3OTVjZDYxNWQzZjdmN2E1MGE3MTgwYzI5
15
- NmQ2MDE1ZGY2YjAyMTMwMDU0ZDllNGYwZmI3MTQ3NDgxOWIzOTI=
13
+ MjRiNDFjZDFhNDA0ZmU0NDAwYjY1ZTAxNjQxNzhlMDAzYjc5MzA0ZDg3NWJh
14
+ YzUyNmQ3MmZjYWIzZmQ5M2EzOWNiNjA3MTU3NTM2NDNiYTQwYzZlYTU0MDQy
15
+ NWYxNzcxNWM2M2YwZDMyNDY0NDZhNjZhMjA2MThhZjA4MDlkYTc=
data/Gemfile CHANGED
@@ -2,6 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'json'
6
+
5
7
  group :test do
6
8
  gem 'rake'
7
9
  gem 'rspec'
data/README.md CHANGED
@@ -125,7 +125,7 @@ template
125
125
  CloudFormation {
126
126
 
127
127
  DESCRIPTION ||= "default description"
128
- MACHINES ||= 3
128
+ MACHINES ||= 1
129
129
 
130
130
  Description DESCRIPTION
131
131
 
@@ -90,7 +90,7 @@ module CfnDsl
90
90
  values.push create_klass.new
91
91
  end
92
92
  @Properties ||= {}
93
- @Properties[pname] ||= CfnDsl::PropertyDefinition.new( *values )
93
+ @Properties[pname] = CfnDsl::PropertyDefinition.new( *values )
94
94
  @Properties[pname].value.instance_eval &block if block
95
95
  @Properties[pname].value
96
96
  end
@@ -192,7 +192,7 @@ module CfnDsl
192
192
  values.push create_klass.new
193
193
  end
194
194
  @Properties ||= {}
195
- @Properties[pname] ||= CfnDsl::PropertyDefinition.new( *values )
195
+ @Properties[pname] = CfnDsl::PropertyDefinition.new( *values )
196
196
  @Properties[pname].value.instance_eval &block if block
197
197
  @Properties[pname].value
198
198
  end
data/lib/cfndsl/Types.rb CHANGED
@@ -86,7 +86,7 @@ module CfnDsl
86
86
  val = klass.new
87
87
  existing.push val
88
88
  value.instance_eval &block(val)
89
- return existin
89
+ return existing
90
90
  end
91
91
 
92
92
  # Glue all of our parameters together into
@@ -660,6 +660,7 @@ Resources:
660
660
  BucketName: String
661
661
  AccessControl: String
662
662
  LifecycleConfiguration: JSON
663
+ NotificationConfiguration: S3NotificationConfiguration
663
664
  VersioningConfiguration: JSON
664
665
  WebsiteConfiguration: JSON
665
666
  Tags: [ EC2Tag ]
@@ -1006,3 +1007,17 @@ Types:
1006
1007
  Key: String
1007
1008
  Type: String
1008
1009
  Value: String
1010
+ S3NotificationConfiguration:
1011
+ LambdaConfigurations: [ S3NotificationLambdaConfiguration ]
1012
+ QueueConfigurations: [ S3NotificationQueueConfiguration ]
1013
+ TopicConfigurations: [ S3NotificationTopicConfiguration ]
1014
+ S3NotificationLambdaConfiguration:
1015
+ Event: String
1016
+ Function: String
1017
+ S3NotificationQueueConfiguration:
1018
+ Event: String
1019
+ Queue: String
1020
+ S3NotificationTopicConfiguration:
1021
+ Event: String
1022
+ Topic: String
1023
+
@@ -1,3 +1,3 @@
1
1
  module CfnDsl
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
data/sample/s3.rb ADDED
@@ -0,0 +1,46 @@
1
+ CloudFormation {
2
+ S3_Bucket('Bucket') {
3
+ BucketName 'MyBucket'
4
+ VersioningConfiguration(Status: 'Enabled')
5
+ NotificationConfiguration(
6
+ LambdaConfigurations: [
7
+ {
8
+ Function: 'MyLambdaFunction',
9
+ Event: 'S3:ObjectCreated:*'
10
+ },
11
+ {
12
+ Function: 'MyLambdaFunction',
13
+ Event: 's3:ObjectRemoved:*'
14
+ }
15
+ ],
16
+ QueueConfigurations: [
17
+ {
18
+ Queue: 'SQSQueue',
19
+ Event: 'S3:ObjectCreated:*'
20
+ }
21
+ ],
22
+ TopicConfigurations: [
23
+ {
24
+ Topic: 'SNSTopic',
25
+ Event: 'S3:ObjectCreated:*'
26
+ }
27
+ ]
28
+ )
29
+ WebsiteConfiguration(
30
+ ErrorDocument: 'error.htm',
31
+ IndexDocument: 'index.htm',
32
+ RoutingRules: [
33
+ {
34
+ RoutingRuleCondition: {
35
+ HttpErrorCodeReturnedEquals: "404",
36
+ KeyPrefixEquals: "out1/"
37
+ },
38
+ RedirectRule: {
39
+ HostName: "ec2-11-22-333-44.compute-1.amazonaws.com",
40
+ ReplaceKeyPrefixWith: "report-404/"
41
+ }
42
+ }
43
+ ]
44
+ )
45
+ }
46
+ }
data/spec/cfndsl_spec.rb CHANGED
@@ -1,5 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe CfnDsl::HeatTemplate do
4
+ it 'honors last-set value for non-array properties' do
5
+ spec = self
6
+ subject.declare do
7
+ Server('myserver') do
8
+ flavor 'foo'
9
+ flavor 'bar'
10
+ f = @Properties['flavor'].value
11
+ spec.expect(f).to spec.eq('bar')
12
+ end
13
+ end
14
+ end
15
+ end
16
+
3
17
  describe CfnDsl::CloudFormationTemplate do
4
18
 
5
19
  it 'populates an empty template' do
@@ -82,6 +96,18 @@ describe CfnDsl::CloudFormationTemplate do
82
96
  end
83
97
  end
84
98
 
99
+ it 'honors last-set value for non-array properties' do
100
+ spec = self
101
+ subject.declare do
102
+ EC2_Instance('myserver') do
103
+ InstanceType 'foo'
104
+ InstanceType 'bar'
105
+ f = @Properties['InstanceType'].value
106
+ spec.expect(f).to spec.eq('bar')
107
+ end
108
+ end
109
+ end
110
+
85
111
  context 'built-in functions' do
86
112
  it 'FnGetAtt' do
87
113
  func = subject.FnGetAtt('A', 'B')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfndsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Jack
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-29 00:00:00.000000000 Z
12
+ date: 2015-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -70,6 +70,7 @@ files:
70
70
  - sample/circular.rb
71
71
  - sample/codedeploy.rb
72
72
  - sample/ecs.rb
73
+ - sample/s3.rb
73
74
  - sample/t1.rb
74
75
  - sample/t1.yaml
75
76
  - sample/vpc-example.rb