cfndsl 0.11.12 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39c0a723b14a76e495e1e0aa7e7af38c9a34aee9
4
- data.tar.gz: 32b0b32b2ad45d53168e0606b8e51f278549323e
3
+ metadata.gz: cb6555a75da928cfe515f8d24185ea742235c16c
4
+ data.tar.gz: e051814ab4bc1886548b46f8a7871949f53f0bcc
5
5
  SHA512:
6
- metadata.gz: d471b2921db35d11f539c749bf48e7a1c5321a3fe8ad3ed2ed7f3e1ef17c170db46054f2b2a37e6470b6d7489b2a7f3cf6c06dc796faf26d47e54ba6d8406f73
7
- data.tar.gz: bbb8988b364b7029280d9091e7d9aa653e29f8fe9bcd32a3a885aeb3c074bbb6afb567d0dd946f30314be5ae7cc1c6a2dc3322460483cc3f36947f6368961068
6
+ metadata.gz: fd993ac44ac9990bce1d324c59c375258e77fc631a156785264847dfe55ff6580657dbd1ebf1de4376e0bd98c81be9a1c6085529c59efdaf43164101b0f6fc83
7
+ data.tar.gz: 6ca5e90c4fa97aac87dbd09ff01ed51d07f66704f7b4fdfe1e470e727d5bb8502e58a074f727e11b0a793fc1cae70182a7b32c446ccf6e51d269c7bef534a152
@@ -1,4 +1,22 @@
1
1
  Resources:
2
+ "AWS::Serverless::API":
3
+ Properties:
4
+ StageName: String
5
+ DefinitionUri: String
6
+ CacheClusterEnabled: Boolean
7
+ CacheClusterSize: String
8
+ Variables: JSON
9
+ "AWS::Serverless::Function":
10
+ Properties:
11
+ Handler: String
12
+ Runtime: String
13
+ CodeUri: String
14
+ Description: String
15
+ MemorySize: Integer
16
+ Timeout: Integer
17
+ Policies: [ IAMEmbeddedPolicy ]
18
+ Environment: JSON
19
+ Events: JSON
2
20
  "AWS::ApiGateway::Account" :
3
21
  Properties:
4
22
  CloudWatchRoleArn: String
@@ -7,7 +7,7 @@ module CfnDsl
7
7
  # Handles the overall template object
8
8
  # rubocop:disable Metrics/ClassLength
9
9
  class OrchestrationTemplate < JSONable
10
- dsl_attr_setter :AWSTemplateFormatVersion, :Description, :Metadata
10
+ dsl_attr_setter :AWSTemplateFormatVersion, :Description, :Metadata, :Transform
11
11
  dsl_content_object :Condition, :Parameter, :Output, :Resource, :Mapping
12
12
 
13
13
  GlobalRefs = {
@@ -1,3 +1,3 @@
1
1
  module CfnDsl
2
- VERSION = '0.11.12'.freeze
2
+ VERSION = '0.12.0'.freeze
3
3
  end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ def read_json_fixture(filename)
4
+ spec_dir = File.dirname(__dir__)
5
+ filename = File.join(spec_dir, 'fixtures', filename)
6
+ JSON.parse(File.read(filename))
7
+ end
8
+
9
+ describe CfnDsl::CloudFormationTemplate do
10
+ subject(:template) { described_class.new }
11
+
12
+ it 'Serverless_Function' do
13
+ template.Serverless_Function(:Test) do
14
+ Handler 'fn.handler'
15
+ Runtime 'python2.7'
16
+ CodeUri 's3://my-code-bucket/my-function.zip'
17
+ Description 'Creates thumbnails of uploaded images'
18
+ MemorySize 1024
19
+ Timeout 15
20
+ Policies 'AmazonS3FullAccess'
21
+ Environment(
22
+ Variables: { TABLE_NAME: 'my-table' }
23
+ )
24
+ Events(
25
+ PhotoUpload: {
26
+ Type: 'S3',
27
+ Properties: { Bucket: 'my-photo-bucket' }
28
+ }
29
+ )
30
+ end
31
+ # File.open('/tmp/dump', 'w') { |f| f.write(template.to_json) }
32
+ expect(JSON.parse(template.to_json)).to eq(read_json_fixture('serverless-function.json'))
33
+ end
34
+
35
+ it 'Serverless_Api' do
36
+ template.Serverless_API(:Test) do
37
+ StageName 'prod'
38
+ DefinitionUri 'swagger.yml'
39
+ CacheClusterEnabled false
40
+ CacheClusterSize '512M'
41
+ Variables(Var1: 'value1')
42
+ end
43
+ File.open('/tmp/dump', 'w') { |f| f.write(template.to_json) }
44
+ expect(JSON.parse(template.to_json)).to eq(read_json_fixture('serverless-api.json'))
45
+ end
46
+ end
@@ -0,0 +1 @@
1
+ {"AWSTemplateFormatVersion":"2010-09-09","Resources":{"Test":{"Properties":{"StageName":"prod","DefinitionUri":"swagger.yml","CacheClusterEnabled":false,"CacheClusterSize":"512M","Variables":{"Var1":"value1"}},"Type":"AWS::Serverless::API"}}}
@@ -0,0 +1 @@
1
+ {"AWSTemplateFormatVersion":"2010-09-09","Resources":{"Test":{"Properties":{"Handler":"fn.handler","Runtime":"python2.7","CodeUri":"s3://my-code-bucket/my-function.zip","Description":"Creates thumbnails of uploaded images","MemorySize":1024,"Timeout":15,"Policies":"AmazonS3FullAccess","Environment":{"Variables":{"TABLE_NAME":"my-table"}},"Events":{"PhotoUpload":{"Type":"S3","Properties":{"Bucket":"my-photo-bucket"}}}},"Type":"AWS::Serverless::Function"}}}
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Transform' do
4
+ let(:template) { CfnDsl::OrchestrationTemplate.new }
5
+
6
+ it 'is settable for a template' do
7
+ template.Transform('AWS::Serverless-2016-10-31')
8
+ expect(template.to_json).to match(/"Transform":"AWS::Serverless-2016-10-31"/)
9
+ end
10
+ end
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.11.12
4
+ version: 0.12.0
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: 2017-01-20 00:00:00.000000000 Z
12
+ date: 2017-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -91,11 +91,14 @@ files:
91
91
  - spec/aws/kms_alias_spec.rb
92
92
  - spec/aws/logs_log_group_spec.rb
93
93
  - spec/aws/rds_db_instance_spec.rb
94
+ - spec/aws/serverless_spec.rb
94
95
  - spec/cfndsl_spec.rb
95
96
  - spec/cli_spec.rb
96
97
  - spec/cloud_formation_template_spec.rb
97
98
  - spec/external_parameters_spec.rb
98
99
  - spec/fixtures/heattest.rb
100
+ - spec/fixtures/serverless-api.json
101
+ - spec/fixtures/serverless-function.json
99
102
  - spec/fixtures/test.rb
100
103
  - spec/heat_template_spec.rb
101
104
  - spec/jsonable_spec.rb
@@ -106,6 +109,7 @@ files:
106
109
  - spec/resources_spec.rb
107
110
  - spec/spec_helper.rb
108
111
  - spec/support/shared_examples/orchestration_template.rb
112
+ - spec/transform_spec.rb
109
113
  homepage: https://github.com/stevenjack/cfndsl
110
114
  licenses:
111
115
  - MIT
@@ -136,11 +140,14 @@ test_files:
136
140
  - spec/aws/kms_alias_spec.rb
137
141
  - spec/aws/logs_log_group_spec.rb
138
142
  - spec/aws/rds_db_instance_spec.rb
143
+ - spec/aws/serverless_spec.rb
139
144
  - spec/cfndsl_spec.rb
140
145
  - spec/cli_spec.rb
141
146
  - spec/cloud_formation_template_spec.rb
142
147
  - spec/external_parameters_spec.rb
143
148
  - spec/fixtures/heattest.rb
149
+ - spec/fixtures/serverless-api.json
150
+ - spec/fixtures/serverless-function.json
144
151
  - spec/fixtures/test.rb
145
152
  - spec/heat_template_spec.rb
146
153
  - spec/jsonable_spec.rb
@@ -151,3 +158,4 @@ test_files:
151
158
  - spec/resources_spec.rb
152
159
  - spec/spec_helper.rb
153
160
  - spec/support/shared_examples/orchestration_template.rb
161
+ - spec/transform_spec.rb