cfn-model 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cfn-model/model/bucket_policy.rb +0 -4
- data/lib/cfn-model/model/cfn_model.rb +0 -22
- data/lib/cfn-model/model/dynamic_model_element.rb +21 -0
- data/lib/cfn-model/model/iam_group.rb +10 -4
- data/lib/cfn-model/model/iam_policy.rb +0 -2
- data/lib/cfn-model/model/iam_role.rb +10 -4
- data/lib/cfn-model/model/iam_user.rb +0 -5
- data/lib/cfn-model/model/model_element.rb +0 -21
- data/lib/cfn-model/model/queue_policy.rb +0 -3
- data/lib/cfn-model/model/security_group.rb +0 -6
- data/lib/cfn-model/model/topic_policy.rb +0 -3
- data/lib/cfn-model/parser/cfn_parser.rb +12 -26
- data/lib/cfn-model/parser/iam_role_parser.rb +6 -6
- data/lib/cfn-model/parser/iam_user_parser.rb +1 -13
- data/lib/cfn-model/parser/parser_registry.rb +1 -6
- data/lib/cfn-model/parser/security_group_parser.rb +4 -4
- data/lib/cfn-model/parser/with_policy_document_parser.rb +1 -1
- data/lib/cfn-model/schema/{AWS_CloudFront_Distribution.yml → AWS::CloudFront::Distribution.yml} +0 -0
- data/lib/cfn-model/schema/{AWS_EC2_SecurityGroup.yml → AWS::EC2::SecurityGroup.yml} +0 -14
- data/lib/cfn-model/schema/{AWS_EC2_SecurityGroupEgress.yml → AWS::EC2::SecurityGroupEgress.yml} +0 -0
- data/lib/cfn-model/schema/{AWS_EC2_SecurityGroupIngress.yml → AWS::EC2::SecurityGroupIngress.yml} +0 -0
- data/lib/cfn-model/schema/AWS::ElasticLoadBalancing::LoadBalancer.yml +32 -0
- data/lib/cfn-model/schema/{AWS_IAM_Group.yml → AWS::IAM::Group.yml} +0 -0
- data/lib/cfn-model/schema/{AWS_IAM_ManagedPolicy.yml → AWS::IAM::ManagedPolicy.yml} +0 -0
- data/lib/cfn-model/schema/{AWS_IAM_Policy.yml → AWS::IAM::Policy.yml} +0 -0
- data/lib/cfn-model/schema/{AWS_IAM_Role.yml → AWS::IAM::Role.yml} +0 -0
- data/lib/cfn-model/schema/{AWS_IAM_User.yml → AWS::IAM::User.yml} +2 -2
- data/lib/cfn-model/schema/{AWS_IAM_UserToGroupAddition.yml → AWS::IAM::UserToGroupAddition.yml} +0 -0
- data/lib/cfn-model/schema/{AWS_Lambda_Permission.yml → AWS::Lambda::Permission.yml} +0 -0
- data/lib/cfn-model/schema/{AWS_S3_BucketPolicy.yml → AWS::S3::BucketPolicy.yml} +0 -0
- data/lib/cfn-model/schema/{AWS_SNS_TopicPolicy.yml → AWS::SNS::TopicPolicy.yml} +0 -0
- data/lib/cfn-model/schema/{AWS_SQS_QueuePolicy.yml → AWS::SQS::QueuePolicy.yml} +0 -0
- data/lib/cfn-model/validator/schema_generator.rb +1 -4
- metadata +19 -35
- data/bin/cfn_parse +0 -8
- data/lib/cfn-model/model/ec2_instance.rb +0 -15
- data/lib/cfn-model/model/ec2_network_interface.rb +0 -18
- data/lib/cfn-model/model/iam_managed_policy.rb +0 -14
- data/lib/cfn-model/model/iam_user_to_group_addition.rb +0 -10
- data/lib/cfn-model/model/load_balancer.rb +0 -37
- data/lib/cfn-model/model/policy.rb +0 -10
- data/lib/cfn-model/parser/ec2_instance_parser.rb +0 -10
- data/lib/cfn-model/parser/ec2_network_interface_parser.rb +0 -10
- data/lib/cfn-model/parser/iam_group_parser.rb +0 -17
- data/lib/cfn-model/parser/load_balancer_parser.rb +0 -10
- data/lib/cfn-model/parser/load_balancer_v2_parser.rb +0 -15
- data/lib/cfn-model/schema/AWS_EC2_Instance.yml +0 -146
- data/lib/cfn-model/schema/AWS_EC2_NetworkInterface.yml +0 -62
- data/lib/cfn-model/schema/AWS_EC2_NetworkInterfaceAttachment.yml +0 -24
- data/lib/cfn-model/schema/AWS_ElasticLoadBalancingV2_LoadBalancer.yml +0 -56
- data/lib/cfn-model/schema/AWS_ElasticLoadBalancing_LoadBalancer.yml +0 -188
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11842247e694adc589a0eec6a813f9d9e84df92e
|
4
|
+
data.tar.gz: 7a0c86cacc8e661245d9ccf137dc097dffa0baa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fac13a07ddd7d808922f31dbaab5c659e4980012ba7ceb035b162022c1dd3ffc3c6a6d8c0d874478ac1422bee7d3a1b1d8f8236f9877d74ff4bd50bc1e61d292
|
7
|
+
data.tar.gz: 294a42bfd36cff5967c5eb91f2c027acfd3ffbbe453abdb71b9fff8149ec8efbbd0d1a95d61336a0e1787f1f091d0db2b936acc206a3816e94896c9b298a03f7
|
@@ -1,12 +1,8 @@
|
|
1
1
|
require_relative 'model_element'
|
2
2
|
|
3
3
|
class AWS::S3::BucketPolicy < ModelElement
|
4
|
-
# mapped from document
|
5
4
|
attr_accessor :bucket, :policyDocument
|
6
5
|
|
7
|
-
# PolicyDocument - objectified policyDocument
|
8
|
-
attr_accessor :policy_document
|
9
|
-
|
10
6
|
def initialize
|
11
7
|
@resource_type = 'AWS::S3::BucketPolicy'
|
12
8
|
end
|
@@ -39,26 +39,4 @@ class CfnModel
|
|
39
39
|
def resources_by_type(resource_type)
|
40
40
|
@resources.values.select { |resource| resource.resource_type == resource_type }
|
41
41
|
end
|
42
|
-
|
43
|
-
def find_security_group_by_group_id(security_group_reference)
|
44
|
-
security_group_id = References.resolve_security_group_id(security_group_reference)
|
45
|
-
if security_group_id.nil?
|
46
|
-
# leave it alone since external ref or something we don't grok
|
47
|
-
security_group_reference
|
48
|
-
else
|
49
|
-
matched_security_group = security_groups.find do |security_group|
|
50
|
-
security_group.logical_resource_id == security_group_id
|
51
|
-
end
|
52
|
-
if matched_security_group.nil?
|
53
|
-
# leave it alone since external ref or something we don't grok
|
54
|
-
security_group_reference
|
55
|
-
else
|
56
|
-
matched_security_group
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def to_s
|
62
|
-
@resources.to_s
|
63
|
-
end
|
64
42
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'model_element'
|
2
|
+
|
3
|
+
##
|
4
|
+
# This is the base class for a model element where we aren't anticipating
|
5
|
+
# a schema or doing any fancier post-processing to think the element up
|
6
|
+
# with other elements or wrap properties into higher-level objects
|
7
|
+
#
|
8
|
+
class DynamicModelElement < ModelElement
|
9
|
+
##
|
10
|
+
# Treat any missing method as an instance variable get/set
|
11
|
+
#
|
12
|
+
# This will allow arbitrary elements in Resource/Properties definitions
|
13
|
+
# to map to instance variables without having to anticipate them in a schema
|
14
|
+
def method_missing(method_name, *args)
|
15
|
+
if method_name =~ /^(\w+)=$/
|
16
|
+
instance_variable_set "@#{$1}", args[0]
|
17
|
+
else
|
18
|
+
instance_variable_get "@#{method_name}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -3,13 +3,19 @@ require_relative 'model_element'
|
|
3
3
|
class AWS::IAM::Group < ModelElement
|
4
4
|
attr_accessor :groupName, :managedPolicyArns, :path, :policies
|
5
5
|
|
6
|
-
# synthesized version of policies
|
7
|
-
attr_accessor :policy_objects
|
8
|
-
|
9
6
|
def initialize
|
10
7
|
@managedPolicyArns = []
|
11
8
|
@policies = []
|
12
|
-
@policy_objects = []
|
13
9
|
@resource_type = 'AWS::IAM::Group'
|
14
10
|
end
|
15
11
|
end
|
12
|
+
|
13
|
+
|
14
|
+
class AWS::IAM::UserToGroupAddition < ModelElement
|
15
|
+
attr_accessor :groupName, :users
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@users = []
|
19
|
+
@resource_type = 'AWS::IAM::UserToGroupAddition'
|
20
|
+
end
|
21
|
+
end
|
@@ -1,14 +1,20 @@
|
|
1
1
|
require_relative 'model_element'
|
2
2
|
|
3
|
-
class AWS::IAM::Role
|
3
|
+
class AWS::IAM::Role < ModelElement
|
4
4
|
attr_accessor :roleName, :assumeRolePolicyDocument, :policies, :path, :managedPolicyArns
|
5
5
|
|
6
|
-
attr_accessor :policy_objects, :assume_role_policy_document
|
7
|
-
|
8
6
|
def initialize
|
9
7
|
@policies = []
|
10
8
|
@managedPolicyArns = []
|
11
|
-
@policy_objects = []
|
12
9
|
@resource_type = 'AWS::IAM::Role'
|
13
10
|
end
|
14
11
|
end
|
12
|
+
|
13
|
+
class Policy
|
14
|
+
attr_accessor :policyName, :policyDocument
|
15
|
+
|
16
|
+
def ==(another_policy)
|
17
|
+
policyName == another_policy.policyName &&
|
18
|
+
policyDocument == another_policy.policyDocument
|
19
|
+
end
|
20
|
+
end
|
@@ -3,14 +3,9 @@ require_relative 'model_element'
|
|
3
3
|
class AWS::IAM::User < ModelElement
|
4
4
|
attr_accessor :groups, :loginProfile, :path, :policies, :userName
|
5
5
|
|
6
|
-
# synthesized version of policies
|
7
|
-
attr_accessor :policy_objects, :group_names
|
8
|
-
|
9
6
|
def initialize
|
10
7
|
@groups = []
|
11
8
|
@policies = []
|
12
|
-
@policy_objects = []
|
13
|
-
@group_names = []
|
14
9
|
@resource_type = 'AWS::IAM::User'
|
15
10
|
end
|
16
11
|
end
|
@@ -12,10 +12,6 @@ module AWS
|
|
12
12
|
|
13
13
|
end
|
14
14
|
|
15
|
-
module ElasticLoadBalancingV2
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
15
|
module IAM
|
20
16
|
|
21
17
|
end
|
@@ -41,10 +37,6 @@ module AWS
|
|
41
37
|
end
|
42
38
|
end
|
43
39
|
|
44
|
-
module Custom
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
40
|
class ModelElement
|
49
41
|
attr_accessor :logical_resource_id, :resource_type
|
50
42
|
|
@@ -70,19 +62,6 @@ END
|
|
70
62
|
|
71
63
|
private
|
72
64
|
|
73
|
-
##
|
74
|
-
# Treat any missing method as an instance variable get/set
|
75
|
-
#
|
76
|
-
# This will allow arbitrary elements in Resource/Properties definitions
|
77
|
-
# to map to instance variables without having to anticipate them in a schema
|
78
|
-
def method_missing(method_name, *args)
|
79
|
-
if method_name =~ /^(\w+)=$/
|
80
|
-
instance_variable_set "@#{$1}", args[0]
|
81
|
-
else
|
82
|
-
instance_variable_get "@#{method_name}"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
65
|
def instance_variables_without_at_sign
|
87
66
|
self.instance_variables.map { |instance_variable| strip(instance_variable) }
|
88
67
|
end
|
@@ -3,9 +3,6 @@ require_relative 'model_element'
|
|
3
3
|
class AWS::SQS::QueuePolicy < ModelElement
|
4
4
|
attr_accessor :queues, :policyDocument
|
5
5
|
|
6
|
-
# PolicyDocument - objectified policyDocument
|
7
|
-
attr_accessor :policy_document
|
8
|
-
|
9
6
|
def initialize
|
10
7
|
@queues = []
|
11
8
|
@resource_type = 'AWS::SQS::QueuePolicy'
|
@@ -2,17 +2,11 @@ require_relative 'model_element'
|
|
2
2
|
|
3
3
|
class AWS::EC2::SecurityGroup < ModelElement
|
4
4
|
attr_accessor :groupDescription, :vpcId
|
5
|
-
attr_accessor :tags
|
6
5
|
attr_accessor :securityGroupIngress, :securityGroupEgress
|
7
6
|
|
8
|
-
attr_accessor :ingresses, :egresses
|
9
|
-
|
10
7
|
def initialize
|
11
8
|
@securityGroupIngress = []
|
12
9
|
@securityGroupEgress = []
|
13
|
-
@ingresses = []
|
14
|
-
@egresses = []
|
15
|
-
@tags = []
|
16
10
|
@resource_type = 'AWS::EC2::SecurityGroup'
|
17
11
|
end
|
18
12
|
end
|
@@ -3,9 +3,6 @@ require_relative 'model_element'
|
|
3
3
|
class AWS::SNS::TopicPolicy < ModelElement
|
4
4
|
attr_accessor :topics, :policyDocument
|
5
5
|
|
6
|
-
# PolicyDocument - objectified policyDocument
|
7
|
-
attr_accessor :policy_document
|
8
|
-
|
9
6
|
def initialize
|
10
7
|
@topics = []
|
11
8
|
@resource_type = 'AWS::SNS::TopicPolicy'
|
@@ -12,12 +12,9 @@ Dir["#{__dir__}/../model/*.rb"].each { |model| require "cfn-model/model/#{File.b
|
|
12
12
|
#
|
13
13
|
class CfnParser
|
14
14
|
# this will convert any !Ref or !GetAtt into tranditional hash like in json
|
15
|
+
YAML.add_domain_type('', 'GetAtt') { |type, val| { 'Fn::GetAtt' => val } }
|
15
16
|
YAML.add_domain_type('', 'Ref') { |type, val| { 'Ref' => val } }
|
16
17
|
|
17
|
-
%w(GetAtt Join Base64 Sub Split Select ImportValue GetAZs FindInMap And Or If Not).each do |function_name|
|
18
|
-
YAML.add_domain_type('', function_name) { |type, val| { "Fn::#{function_name}" => val } }
|
19
|
-
end
|
20
|
-
|
21
18
|
##
|
22
19
|
# Given raw json/yml CloudFormation template, returns a CfnModel object
|
23
20
|
# or raise ParserErrors if something is amiss with the format
|
@@ -85,7 +82,7 @@ class CfnParser
|
|
85
82
|
def assign_fields_based_upon_properties(resource_object, resource)
|
86
83
|
unless resource['Properties'].nil?
|
87
84
|
resource['Properties'].each do |property_name, property_value|
|
88
|
-
resource_object.send("#{
|
85
|
+
resource_object.send("#{initialLower(property_name)}=", property_value)
|
89
86
|
end
|
90
87
|
end
|
91
88
|
end
|
@@ -94,33 +91,22 @@ class CfnParser
|
|
94
91
|
begin
|
95
92
|
resource_class = Object.const_get type_name, inherit=false
|
96
93
|
rescue NameError
|
97
|
-
|
98
|
-
resource_class =
|
99
|
-
end
|
100
|
-
resource_class
|
101
|
-
end
|
94
|
+
puts "Never seen class: #{type_name} so going dynamic"
|
95
|
+
resource_class = Class.new(DynamicModelElement)
|
102
96
|
|
103
|
-
def initial_lower(str)
|
104
|
-
str.slice(0).downcase + str[1..(str.length)]
|
105
|
-
end
|
106
|
-
|
107
|
-
def generate_resource_class_from_type(type_name)
|
108
|
-
resource_class = Class.new(ModelElement)
|
109
|
-
|
110
|
-
module_names = type_name.split('::')
|
111
|
-
if module_names.first == 'Custom'
|
112
|
-
Object.const_set(module_names[1], resource_class)
|
113
|
-
elsif module_names.first == 'AWS'
|
114
97
|
begin
|
115
|
-
module_constant = AWS.const_get(
|
98
|
+
module_constant = AWS.const_get(type_name.split('::')[1])
|
116
99
|
rescue NameError
|
117
100
|
module_constant = Module.new
|
118
|
-
module_constant.const_set(
|
101
|
+
module_constant.const_set(type_name.split('::')[1], module_constant)
|
119
102
|
end
|
120
|
-
|
121
|
-
|
122
|
-
raise "Unknown namespace in resource type: #{module_names.first}"
|
103
|
+
|
104
|
+
module_constant.const_set(type_name.split('::')[2], resource_class)
|
123
105
|
end
|
124
106
|
resource_class
|
125
107
|
end
|
108
|
+
|
109
|
+
def initialLower(str)
|
110
|
+
str.slice(0).downcase + str[1..(str.length)]
|
111
|
+
end
|
126
112
|
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
require 'cfn-model/model/iam_role'
|
2
|
-
require 'cfn-model/model/
|
2
|
+
require 'cfn-model/model/policy_document'
|
3
3
|
require_relative 'policy_document_parser'
|
4
4
|
|
5
5
|
class IamRoleParser
|
6
6
|
def parse(cfn_model:, resource:)
|
7
7
|
iam_role = resource
|
8
8
|
|
9
|
-
iam_role.
|
9
|
+
iam_role.assumeRolePolicyDocument = PolicyDocumentParser.new.parse(iam_role.assumeRolePolicyDocument)
|
10
|
+
|
11
|
+
iam_role.policies = iam_role.policies.map do |policy|
|
10
12
|
|
11
|
-
iam_role.policy_objects = iam_role.policies.map do |policy|
|
12
13
|
new_policy = Policy.new
|
13
|
-
new_policy.
|
14
|
-
new_policy.
|
14
|
+
new_policy.policyName = policy['PolicyName']
|
15
|
+
new_policy.policyDocument = PolicyDocumentParser.new.parse(policy['PolicyDocument'])
|
15
16
|
new_policy
|
16
17
|
end
|
17
|
-
|
18
18
|
iam_role
|
19
19
|
end
|
20
20
|
end
|
@@ -1,25 +1,13 @@
|
|
1
|
-
require 'cfn-model/model/policy_document'
|
2
|
-
require 'cfn-model/model/policy'
|
3
|
-
require_relative 'policy_document_parser'
|
4
1
|
|
5
2
|
class IamUserParser
|
6
3
|
def parse(cfn_model:, resource:)
|
7
4
|
iam_user = resource
|
8
5
|
|
9
|
-
iam_user.policy_objects = iam_user.policies.map do |policy|
|
10
|
-
new_policy = Policy.new
|
11
|
-
new_policy.policy_name = policy['PolicyName']
|
12
|
-
new_policy.policy_document = PolicyDocumentParser.new.parse(policy['PolicyDocument'])
|
13
|
-
new_policy
|
14
|
-
end
|
15
|
-
|
16
|
-
iam_user.groups.each { |group_name| iam_user.group_names << group_name }
|
17
|
-
|
18
6
|
user_to_group_additions = cfn_model.resources_by_type 'AWS::IAM::UserToGroupAddition'
|
19
7
|
user_to_group_additions.each do |user_to_group_addition|
|
20
8
|
|
21
9
|
if user_to_group_addition_has_username(user_to_group_addition.users,iam_user)
|
22
|
-
iam_user.
|
10
|
+
iam_user.groups << user_to_group_addition.groupName
|
23
11
|
|
24
12
|
# we need to figure out the story on resolving Refs i think for this to be real
|
25
13
|
end
|
@@ -6,17 +6,12 @@ class ParserRegistry
|
|
6
6
|
def initialize
|
7
7
|
@registry = {
|
8
8
|
'AWS::EC2::SecurityGroup' => SecurityGroupParser,
|
9
|
-
'AWS::EC2::NetworkInterface' => Ec2NetworkInterfaceParser,
|
10
|
-
'AWS::EC2::Instance' => Ec2InstanceParser,
|
11
|
-
'AWS::ElasticLoadBalancing::LoadBalancer' => LoadBalancerParser,
|
12
|
-
'AWS::ElasticLoadBalancingV2::LoadBalancer' => LoadBalancerV2Parser,
|
13
|
-
'AWS::IAM::Group' => IamGroupParser,
|
14
9
|
'AWS::IAM::User' => IamUserParser,
|
15
10
|
'AWS::IAM::Role' => IamRoleParser,
|
16
11
|
'AWS::IAM::Policy' => WithPolicyDocumentParser,
|
17
12
|
'AWS::IAM::ManagedPolicy' => WithPolicyDocumentParser,
|
18
|
-
'AWS::S3::BucketPolicy' => WithPolicyDocumentParser,
|
19
13
|
'AWS::SNS::TopicPolicy' => WithPolicyDocumentParser,
|
14
|
+
'AWS::S3::BucketPolicy' => WithPolicyDocumentParser,
|
20
15
|
'AWS::SQS::QueuePolicy' => WithPolicyDocumentParser
|
21
16
|
}
|
22
17
|
end
|
@@ -24,7 +24,7 @@ class SecurityGroupParser
|
|
24
24
|
security_group.securityGroupIngress = [security_group.securityGroupIngress]
|
25
25
|
end
|
26
26
|
|
27
|
-
security_group.
|
27
|
+
security_group.securityGroupIngress = security_group.securityGroupIngress.map do |ingress|
|
28
28
|
ingress_object = AWS::EC2::SecurityGroupIngress.new
|
29
29
|
ingress.each do |k,v|
|
30
30
|
ingress_object.send("#{initialLower(k)}=", v)
|
@@ -39,7 +39,7 @@ class SecurityGroupParser
|
|
39
39
|
security_group.securityGroupEgress = [security_group.securityGroupEgress]
|
40
40
|
end
|
41
41
|
|
42
|
-
security_group.
|
42
|
+
security_group.securityGroupEgress = security_group.securityGroupEgress.map do |egress|
|
43
43
|
egress_object = AWS::EC2::SecurityGroupEgress.new
|
44
44
|
egress.each do |k,v|
|
45
45
|
egress_object.send("#{initialLower(k)}=", v)
|
@@ -62,7 +62,7 @@ class SecurityGroupParser
|
|
62
62
|
next if group_id.nil?
|
63
63
|
|
64
64
|
if security_group.logical_resource_id == group_id
|
65
|
-
security_group.
|
65
|
+
security_group.securityGroupIngress << security_group_ingress
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -76,7 +76,7 @@ class SecurityGroupParser
|
|
76
76
|
next if group_id.nil?
|
77
77
|
|
78
78
|
if security_group.logical_resource_id == group_id
|
79
|
-
security_group.
|
79
|
+
security_group.securityGroupEgress << security_group_egress
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
@@ -4,7 +4,7 @@ require_relative 'policy_document_parser'
|
|
4
4
|
|
5
5
|
class WithPolicyDocumentParser
|
6
6
|
def parse(cfn_model:, resource:)
|
7
|
-
resource.
|
7
|
+
resource.policyDocument = PolicyDocumentParser.new.parse(resource.policyDocument)
|
8
8
|
resource
|
9
9
|
end
|
10
10
|
end
|
data/lib/cfn-model/schema/{AWS_CloudFront_Distribution.yml → AWS::CloudFront::Distribution.yml}
RENAMED
File without changes
|
@@ -15,20 +15,6 @@ mapping:
|
|
15
15
|
VpcId:
|
16
16
|
type: any
|
17
17
|
required: yes
|
18
|
-
Tags:
|
19
|
-
type: seq
|
20
|
-
required: no
|
21
|
-
sequence:
|
22
|
-
- type: map
|
23
|
-
mapping:
|
24
|
-
Key:
|
25
|
-
type: any
|
26
|
-
required: yes
|
27
|
-
Value:
|
28
|
-
type: any
|
29
|
-
required: yes
|
30
|
-
=:
|
31
|
-
type: any
|
32
18
|
# this can be a Hash or an Array... kwalify doesn't seem to have a union concept so defer any such
|
33
19
|
# validation into the parser object
|
34
20
|
# SecurityGroupIngress:
|
data/lib/cfn-model/schema/{AWS_EC2_SecurityGroupEgress.yml → AWS::EC2::SecurityGroupEgress.yml}
RENAMED
File without changes
|
data/lib/cfn-model/schema/{AWS_EC2_SecurityGroupIngress.yml → AWS::EC2::SecurityGroupIngress.yml}
RENAMED
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
type: map
|
3
|
+
mapping:
|
4
|
+
Type:
|
5
|
+
type: str
|
6
|
+
required: yes
|
7
|
+
pattern: /AWS::ElasticLoadBalancing::LoadBalancer/
|
8
|
+
Properties:
|
9
|
+
type: map
|
10
|
+
required: yes
|
11
|
+
mapping:
|
12
|
+
AccessLoggingPolicy:
|
13
|
+
type: map
|
14
|
+
required: no
|
15
|
+
mapping:
|
16
|
+
Enabled:
|
17
|
+
type: any
|
18
|
+
required: yes
|
19
|
+
S3BucketName:
|
20
|
+
type: any
|
21
|
+
required: yes
|
22
|
+
=:
|
23
|
+
type: any
|
24
|
+
Listeners:
|
25
|
+
type: seq
|
26
|
+
required: yes
|
27
|
+
sequence:
|
28
|
+
- type: any
|
29
|
+
=:
|
30
|
+
type: any
|
31
|
+
=:
|
32
|
+
type: any
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/cfn-model/schema/{AWS_IAM_UserToGroupAddition.yml → AWS::IAM::UserToGroupAddition.yml}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -46,9 +46,6 @@ class SchemaGenerator
|
|
46
46
|
'mapping' => {
|
47
47
|
'Type' => {
|
48
48
|
'type' => 'str'
|
49
|
-
},
|
50
|
-
'=' => {
|
51
|
-
'type' => 'any'
|
52
49
|
}
|
53
50
|
}
|
54
51
|
}
|
@@ -71,7 +68,7 @@ class SchemaGenerator
|
|
71
68
|
end
|
72
69
|
|
73
70
|
def schema_file(file)
|
74
|
-
"#{__dir__}/../schema/#{file
|
71
|
+
"#{__dir__}/../schema/#{file}"
|
75
72
|
end
|
76
73
|
|
77
74
|
def schema_for_type(type)
|
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.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Kascic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kwalify
|
@@ -26,26 +26,19 @@ dependencies:
|
|
26
26
|
version: 0.7.2
|
27
27
|
description: An object model for CloudFormation templates
|
28
28
|
email:
|
29
|
-
executables:
|
30
|
-
- cfn_parse
|
29
|
+
executables: []
|
31
30
|
extensions: []
|
32
31
|
extra_rdoc_files: []
|
33
32
|
files:
|
34
|
-
- bin/cfn_parse
|
35
33
|
- lib/cfn-model.rb
|
36
34
|
- lib/cfn-model/model/bucket_policy.rb
|
37
35
|
- lib/cfn-model/model/cfn_model.rb
|
38
|
-
- lib/cfn-model/model/
|
39
|
-
- lib/cfn-model/model/ec2_network_interface.rb
|
36
|
+
- lib/cfn-model/model/dynamic_model_element.rb
|
40
37
|
- lib/cfn-model/model/iam_group.rb
|
41
|
-
- lib/cfn-model/model/iam_managed_policy.rb
|
42
38
|
- lib/cfn-model/model/iam_policy.rb
|
43
39
|
- lib/cfn-model/model/iam_role.rb
|
44
40
|
- lib/cfn-model/model/iam_user.rb
|
45
|
-
- lib/cfn-model/model/iam_user_to_group_addition.rb
|
46
|
-
- lib/cfn-model/model/load_balancer.rb
|
47
41
|
- lib/cfn-model/model/model_element.rb
|
48
|
-
- lib/cfn-model/model/policy.rb
|
49
42
|
- lib/cfn-model/model/policy_document.rb
|
50
43
|
- lib/cfn-model/model/principal.rb
|
51
44
|
- lib/cfn-model/model/queue_policy.rb
|
@@ -56,37 +49,28 @@ files:
|
|
56
49
|
- lib/cfn-model/model/statement.rb
|
57
50
|
- lib/cfn-model/model/topic_policy.rb
|
58
51
|
- lib/cfn-model/parser/cfn_parser.rb
|
59
|
-
- lib/cfn-model/parser/ec2_instance_parser.rb
|
60
|
-
- lib/cfn-model/parser/ec2_network_interface_parser.rb
|
61
|
-
- lib/cfn-model/parser/iam_group_parser.rb
|
62
52
|
- lib/cfn-model/parser/iam_role_parser.rb
|
63
53
|
- lib/cfn-model/parser/iam_user_parser.rb
|
64
|
-
- lib/cfn-model/parser/load_balancer_parser.rb
|
65
|
-
- lib/cfn-model/parser/load_balancer_v2_parser.rb
|
66
54
|
- lib/cfn-model/parser/parser_error.rb
|
67
55
|
- lib/cfn-model/parser/parser_registry.rb
|
68
56
|
- lib/cfn-model/parser/policy_document_parser.rb
|
69
57
|
- lib/cfn-model/parser/security_group_parser.rb
|
70
58
|
- lib/cfn-model/parser/with_policy_document_parser.rb
|
71
|
-
- lib/cfn-model/schema/
|
72
|
-
- lib/cfn-model/schema/
|
73
|
-
- lib/cfn-model/schema/
|
74
|
-
- lib/cfn-model/schema/
|
75
|
-
- lib/cfn-model/schema/
|
76
|
-
- lib/cfn-model/schema/
|
77
|
-
- lib/cfn-model/schema/
|
78
|
-
- lib/cfn-model/schema/
|
79
|
-
- lib/cfn-model/schema/
|
80
|
-
- lib/cfn-model/schema/
|
81
|
-
- lib/cfn-model/schema/
|
82
|
-
- lib/cfn-model/schema/
|
83
|
-
- lib/cfn-model/schema/
|
84
|
-
- lib/cfn-model/schema/
|
85
|
-
- lib/cfn-model/schema/
|
86
|
-
- lib/cfn-model/schema/AWS_Lambda_Permission.yml
|
87
|
-
- lib/cfn-model/schema/AWS_S3_BucketPolicy.yml
|
88
|
-
- lib/cfn-model/schema/AWS_SNS_TopicPolicy.yml
|
89
|
-
- lib/cfn-model/schema/AWS_SQS_QueuePolicy.yml
|
59
|
+
- lib/cfn-model/schema/AWS::CloudFront::Distribution.yml
|
60
|
+
- lib/cfn-model/schema/AWS::EC2::SecurityGroup.yml
|
61
|
+
- lib/cfn-model/schema/AWS::EC2::SecurityGroupEgress.yml
|
62
|
+
- lib/cfn-model/schema/AWS::EC2::SecurityGroupIngress.yml
|
63
|
+
- lib/cfn-model/schema/AWS::ElasticLoadBalancing::LoadBalancer.yml
|
64
|
+
- lib/cfn-model/schema/AWS::IAM::Group.yml
|
65
|
+
- lib/cfn-model/schema/AWS::IAM::ManagedPolicy.yml
|
66
|
+
- lib/cfn-model/schema/AWS::IAM::Policy.yml
|
67
|
+
- lib/cfn-model/schema/AWS::IAM::Role.yml
|
68
|
+
- lib/cfn-model/schema/AWS::IAM::User.yml
|
69
|
+
- lib/cfn-model/schema/AWS::IAM::UserToGroupAddition.yml
|
70
|
+
- lib/cfn-model/schema/AWS::Lambda::Permission.yml
|
71
|
+
- lib/cfn-model/schema/AWS::S3::BucketPolicy.yml
|
72
|
+
- lib/cfn-model/schema/AWS::SNS::TopicPolicy.yml
|
73
|
+
- lib/cfn-model/schema/AWS::SQS::QueuePolicy.yml
|
90
74
|
- lib/cfn-model/schema/schema.yml.erb
|
91
75
|
- lib/cfn-model/validator/cloudformation_validator.rb
|
92
76
|
- lib/cfn-model/validator/reference_validator.rb
|
data/bin/cfn_parse
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require_relative 'model_element'
|
2
|
-
|
3
|
-
class AWS::EC2::Instance < ModelElement
|
4
|
-
attr_accessor :securityGroupIds, :networkInterfaces
|
5
|
-
|
6
|
-
# SecurityGroup objects based upon securityGroupIds
|
7
|
-
attr_accessor :security_groups
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@securityGroupIds = []
|
11
|
-
@networkInterfaces = []
|
12
|
-
@security_groups = []
|
13
|
-
@resource_type = 'AWS::EC2::Instance'
|
14
|
-
end
|
15
|
-
end
|