cfn-model 0.4.1 → 0.4.3
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,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee88579d79a7de2a38cfd40032eeca6eabd4c6a20461b7bd07b846c1b8505e84
|
4
|
+
data.tar.gz: da93cbfd56b231d5ee4852a6fbecacc7b15432cdceca731c4865f734049b8565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8eee9d1a663f1518ae0b50b8b57456214d3c0a03fce1946bf4adbaed2cf35bf3ae26d206617096f2748af509b31330a6c91b5746769ae6743a99aad5b51ef50
|
7
|
+
data.tar.gz: 60b05b4b60c9b72f8a6ae9eefbdbaae71559a7dc224c08c4a2c9ba7150572e1a1ababe384a3fde7e35771ff408d248f9e486bdf3446e27b47d8922d4906a0e71
|
@@ -14,7 +14,7 @@ class Statement
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def wildcard_actions
|
17
|
-
@actions.select { |action| action.to_s
|
17
|
+
@actions.select { |action| action.to_s == '*' }
|
18
18
|
end
|
19
19
|
|
20
20
|
def wildcard_principal?
|
@@ -22,7 +22,7 @@ class Statement
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def wildcard_resources
|
25
|
-
@resources.select { |
|
25
|
+
@resources.select { |resource| resource.to_s == '*' }
|
26
26
|
end
|
27
27
|
|
28
28
|
def ==(another_statement)
|
@@ -1,30 +1,12 @@
|
|
1
1
|
require_relative 'schema_generator'
|
2
2
|
require 'kwalify'
|
3
|
-
require 'json'
|
4
3
|
|
5
4
|
class CloudFormationValidator
|
6
5
|
def validate(cloudformation_string)
|
7
|
-
if json_text?(cloudformation_string)
|
8
|
-
raise ParserError.new('Invalid JSON!') unless valid_json?(cloudformation_string)
|
9
|
-
end
|
10
|
-
|
11
6
|
schema = SchemaGenerator.new.generate cloudformation_string
|
12
|
-
validator = Kwalify::Validator.new(schema)
|
13
|
-
validator.validate(YAML.load(cloudformation_string))
|
14
|
-
end
|
15
7
|
|
16
|
-
|
17
|
-
|
18
|
-
def json_text?(cloudformation_string)
|
19
|
-
first_character = cloudformation_string.gsub(/\s/, '').split('').first
|
20
|
-
matches = cloudformation_string.scan(/\{[^}]*\}/)
|
21
|
-
first_character == '{' && !matches.empty?
|
22
|
-
end
|
8
|
+
validator = Kwalify::Validator.new(schema)
|
23
9
|
|
24
|
-
|
25
|
-
JSON.parse(cloudformation_string)
|
26
|
-
return true
|
27
|
-
rescue JSON::ParserError => error
|
28
|
-
return false
|
10
|
+
validator.validate(YAML.load(cloudformation_string))
|
29
11
|
end
|
30
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfn-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Kascic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|