cfndsl 0.17.1 → 0.17.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -4
- data/CHANGELOG.md +20 -3
- data/lib/cfndsl.rb +1 -0
- data/lib/cfndsl/globals.rb +1 -1
- data/lib/cfndsl/orchestration_template.rb +18 -2
- data/lib/cfndsl/rules.rb +46 -0
- data/lib/cfndsl/version.rb +1 -1
- data/spec/fixtures/rule-assertion.json +1 -0
- data/spec/rule_spec.rb +17 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d08e50970be94f664f6e4775cb3367c51a16e8702e6ff023e632b69bd9802ab6
|
4
|
+
data.tar.gz: dc2ed8885d37cc044293a3cc1aa4ee4139a237042bc5722d2f07c78aecba584d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 345a8c5bca051ecd484118cbb6ccbb862de0dceac2a9abbf5d314ca288741cd920be05fbe0a76b2331639a03f6e97bc48e2896ca0f3f6b7dc349e5ee862f4934
|
7
|
+
data.tar.gz: ae7442508593ec6bb3cd0957cd3656f6782e31d1487292c5a37bdd703b83aea3c4751b5a5470b630abfc2295b5c181415da5c3066986f772f49851c1b3c957fd
|
data/.travis.yml
CHANGED
@@ -2,11 +2,10 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- 2.3.3
|
4
4
|
sudo: false
|
5
|
-
|
6
5
|
deploy:
|
7
6
|
provider: rubygems
|
8
7
|
api_key:
|
9
|
-
secure:
|
8
|
+
secure: cIDF27JCirxxg7SXw6R+xxABMwCrrirJiJzljVxb/MdlRyUVaSW8XdZjOVyNgJkCx+vQOX4U+hp+p0xVI/Loh4EXkgbDvu2oGIAn/g1lfWabwKtdkFEviQn4tWvqDcEkxm5Hm6Gs0pFCaurqynMPNbsLVAEIiSw+la8LxEeeQ6I=
|
10
9
|
gem: cfndsl
|
11
10
|
on:
|
12
11
|
tags: true
|
@@ -14,7 +13,7 @@ deploy:
|
|
14
13
|
notifications:
|
15
14
|
email:
|
16
15
|
recipients:
|
17
|
-
|
18
|
-
|
16
|
+
- dempsey.travis@gmail.com
|
17
|
+
- gergnz@gmail.com
|
19
18
|
on_failure: change
|
20
19
|
on_success: never
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,24 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [0.17.
|
4
|
-
[Full Changelog](https://github.com/cfndsl/cfndsl/compare/v0.17.
|
3
|
+
## [0.17.2](https://github.com/cfndsl/cfndsl/tree/0.17.2) (2019-09-05)
|
4
|
+
[Full Changelog](https://github.com/cfndsl/cfndsl/compare/v0.17.1...0.17.2)
|
5
|
+
|
6
|
+
**Fixed bugs:**
|
7
|
+
|
8
|
+
- update rubygems api key [\#416](https://github.com/cfndsl/cfndsl/pull/416) ([gergnz](https://github.com/gergnz))
|
9
|
+
|
10
|
+
**Closed issues:**
|
11
|
+
|
12
|
+
- Support for cross-parameter validation rules [\#414](https://github.com/cfndsl/cfndsl/issues/414)
|
13
|
+
- Missing patch for Tag support in AWS::IAM::Role and AWS::Serverless::Function [\#412](https://github.com/cfndsl/cfndsl/issues/412)
|
14
|
+
- Access to rubygems [\#391](https://github.com/cfndsl/cfndsl/issues/391)
|
15
|
+
|
16
|
+
**Merged pull requests:**
|
17
|
+
|
18
|
+
- Added Rules support for cross-parameter validation [\#417](https://github.com/cfndsl/cfndsl/pull/417) ([cmaxwellau](https://github.com/cmaxwellau))
|
19
|
+
|
20
|
+
## [v0.17.1](https://github.com/cfndsl/cfndsl/tree/v0.17.1) (2019-09-01)
|
21
|
+
[Full Changelog](https://github.com/cfndsl/cfndsl/compare/v0.17.0...v0.17.1)
|
5
22
|
|
6
23
|
**Fixed bugs:**
|
7
24
|
|
@@ -327,6 +344,7 @@
|
|
327
344
|
**Merged pull requests:**
|
328
345
|
|
329
346
|
- Update AWS::CloudWatch::Alarm with 2 new properties [\#312](https://github.com/cfndsl/cfndsl/pull/312) ([AnominousSign](https://github.com/AnominousSign))
|
347
|
+
- Add support for AWS::KMS::Alias [\#265](https://github.com/cfndsl/cfndsl/pull/265) ([mikechau](https://github.com/mikechau))
|
330
348
|
|
331
349
|
## [v0.12.8](https://github.com/cfndsl/cfndsl/tree/v0.12.8) (2017-05-03)
|
332
350
|
[Full Changelog](https://github.com/cfndsl/cfndsl/compare/v0.12.7...v0.12.8)
|
@@ -483,7 +501,6 @@
|
|
483
501
|
|
484
502
|
- Certificate manager type [\#267](https://github.com/cfndsl/cfndsl/pull/267) ([kornypoet](https://github.com/kornypoet))
|
485
503
|
- Add monitoring properties to AWS::RDS::DBInstance [\#266](https://github.com/cfndsl/cfndsl/pull/266) ([mikechau](https://github.com/mikechau))
|
486
|
-
- Add support for AWS::KMS::Alias [\#265](https://github.com/cfndsl/cfndsl/pull/265) ([mikechau](https://github.com/mikechau))
|
487
504
|
|
488
505
|
## [v0.11.6](https://github.com/cfndsl/cfndsl/tree/v0.11.6) (2016-10-23)
|
489
506
|
[Full Changelog](https://github.com/cfndsl/cfndsl/compare/v0.11.5...v0.11.6)
|
data/lib/cfndsl.rb
CHANGED
data/lib/cfndsl/globals.rb
CHANGED
@@ -11,7 +11,7 @@ module CfnDsl
|
|
11
11
|
# rubocop:disable Metrics/ClassLength
|
12
12
|
class OrchestrationTemplate < JSONable
|
13
13
|
dsl_attr_setter :AWSTemplateFormatVersion, :Description, :Metadata, :Transform
|
14
|
-
dsl_content_object :Condition, :Parameter, :Output, :Resource, :Mapping
|
14
|
+
dsl_content_object :Condition, :Parameter, :Output, :Resource, :Mapping, :Rule
|
15
15
|
|
16
16
|
GLOBAL_REFS = {
|
17
17
|
'AWS::NotificationARNs' => 1,
|
@@ -132,7 +132,7 @@ module CfnDsl
|
|
132
132
|
# rubocop:enable Metrics/PerceivedComplexity
|
133
133
|
|
134
134
|
def check_refs
|
135
|
-
invalids = check_resource_refs + check_output_refs
|
135
|
+
invalids = check_resource_refs + check_output_refs + check_rule_refs
|
136
136
|
invalids unless invalids.empty?
|
137
137
|
end
|
138
138
|
|
@@ -167,6 +167,22 @@ module CfnDsl
|
|
167
167
|
end
|
168
168
|
invalids
|
169
169
|
end
|
170
|
+
|
171
|
+
def check_rule_refs
|
172
|
+
invalids = []
|
173
|
+
@_rule_refs = {}
|
174
|
+
if @Rules
|
175
|
+
@Rules.each_key do |rule|
|
176
|
+
@_rule_refs[resource.to_s] = @Rules[rule].build_references({})
|
177
|
+
end
|
178
|
+
@_rule_refs.each_key do |origin|
|
179
|
+
@_rule_refs[origin].each_key do |ref|
|
180
|
+
invalids.push "Invalid Reference: Rule #{origin} refers to #{ref}" unless valid_ref?(ref, origin)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
invalids
|
185
|
+
end
|
170
186
|
end
|
171
187
|
# rubocop:enable Metrics/ClassLength
|
172
188
|
end
|
data/lib/cfndsl/rules.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cfndsl/jsonable'
|
4
|
+
|
5
|
+
module CfnDsl
|
6
|
+
# Handles Rule objects
|
7
|
+
class RuleDefinition < JSONable
|
8
|
+
dsl_attr_setter :RuleCondition, :Assertions
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@Assertions = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def Assert(desc, struct)
|
15
|
+
@Assertions.push('Assert' => struct, 'AssertDescription' => desc)
|
16
|
+
end
|
17
|
+
|
18
|
+
def FnContains(list_of_strings, string)
|
19
|
+
Fn.new('Contains', [list_of_strings, string])
|
20
|
+
end
|
21
|
+
|
22
|
+
def FnEachMemberEquals(list_of_strings, string)
|
23
|
+
Fn.new('EachMemberEquals', [list_of_strings, string])
|
24
|
+
end
|
25
|
+
|
26
|
+
def FnEachMemberIn(strings_to_check, strings_to_match)
|
27
|
+
Fn.new('EachMemberIn', [strings_to_check, strings_to_match])
|
28
|
+
end
|
29
|
+
|
30
|
+
def FnRefAll(parameter_type)
|
31
|
+
Fn.new('RefAll', parameter_type)
|
32
|
+
end
|
33
|
+
|
34
|
+
def FnValueOf(parameter_logical_id, attribute)
|
35
|
+
raise 'Cannot use functions within FnValueOf' unless parameter_logical_id.is_a?(String) && attribute.is_a?(String)
|
36
|
+
|
37
|
+
Fn.new('ValueOf', [parameter_logical_id, attribute])
|
38
|
+
end
|
39
|
+
|
40
|
+
def FnValueOfAll(parameter_logical_id, attribute)
|
41
|
+
raise 'Cannot use functions within FnValueOfAll' unless parameter_logical_id.is_a?(String) && attribute.is_a?(String)
|
42
|
+
|
43
|
+
Fn.new('ValueOfAll', [parameter_logical_id, attribute])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/cfndsl/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"Assertions":[{"Assert":{"Fn::EachMemberIn":[{"Fn::ValueOfAll":["a","b"]},{"Fn::RefAll":"c"}]},"AssertDescription":"x"}],"RuleCondition":{"Fn::Equals":[{"Ref":"y"},"z"]}}
|
data/spec/rule_spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe CfnDsl::OutputDefinition do
|
6
|
+
let(:template) { CfnDsl::OrchestrationTemplate.new }
|
7
|
+
let(:target) { File.read("#{File.dirname(__FILE__)}/fixtures/rule-assertion.json") }
|
8
|
+
context '#Assert' do
|
9
|
+
it 'formats correctly' do
|
10
|
+
output = template.Rule(:testRule) do
|
11
|
+
Assert('x', FnEachMemberIn(FnValueOfAll('a', 'b'), FnRefAll('c')))
|
12
|
+
RuleCondition FnEquals(Ref('y'), 'z')
|
13
|
+
end
|
14
|
+
expect(output.to_json).to eq(target)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
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.17.
|
4
|
+
version: 0.17.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Jack
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-09-
|
14
|
+
date: 2019-09-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/cfndsl/rake_task.rb
|
76
76
|
- lib/cfndsl/ref_check.rb
|
77
77
|
- lib/cfndsl/resources.rb
|
78
|
+
- lib/cfndsl/rules.rb
|
78
79
|
- lib/cfndsl/specification.rb
|
79
80
|
- lib/cfndsl/types.rb
|
80
81
|
- lib/cfndsl/update_policy.rb
|
@@ -115,6 +116,7 @@ files:
|
|
115
116
|
- spec/deep_merge_spec.rb
|
116
117
|
- spec/external_parameters_spec.rb
|
117
118
|
- spec/fixtures/heattest.rb
|
119
|
+
- spec/fixtures/rule-assertion.json
|
118
120
|
- spec/fixtures/serverless-api.json
|
119
121
|
- spec/fixtures/serverless-function.json
|
120
122
|
- spec/fixtures/test.rb
|
@@ -126,6 +128,7 @@ files:
|
|
126
128
|
- spec/output_spec.rb
|
127
129
|
- spec/plurals_spec.rb
|
128
130
|
- spec/resources_spec.rb
|
131
|
+
- spec/rule_spec.rb
|
129
132
|
- spec/spec_helper.rb
|
130
133
|
- spec/support/shared_examples/orchestration_template.rb
|
131
134
|
- spec/transform_spec.rb
|
@@ -170,6 +173,7 @@ test_files:
|
|
170
173
|
- spec/deep_merge_spec.rb
|
171
174
|
- spec/external_parameters_spec.rb
|
172
175
|
- spec/fixtures/heattest.rb
|
176
|
+
- spec/fixtures/rule-assertion.json
|
173
177
|
- spec/fixtures/serverless-api.json
|
174
178
|
- spec/fixtures/serverless-function.json
|
175
179
|
- spec/fixtures/test.rb
|
@@ -181,6 +185,7 @@ test_files:
|
|
181
185
|
- spec/output_spec.rb
|
182
186
|
- spec/plurals_spec.rb
|
183
187
|
- spec/resources_spec.rb
|
188
|
+
- spec/rule_spec.rb
|
184
189
|
- spec/spec_helper.rb
|
185
190
|
- spec/support/shared_examples/orchestration_template.rb
|
186
191
|
- spec/transform_spec.rb
|