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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cfn-model/model/bucket_policy.rb +0 -4
  3. data/lib/cfn-model/model/cfn_model.rb +0 -22
  4. data/lib/cfn-model/model/dynamic_model_element.rb +21 -0
  5. data/lib/cfn-model/model/iam_group.rb +10 -4
  6. data/lib/cfn-model/model/iam_policy.rb +0 -2
  7. data/lib/cfn-model/model/iam_role.rb +10 -4
  8. data/lib/cfn-model/model/iam_user.rb +0 -5
  9. data/lib/cfn-model/model/model_element.rb +0 -21
  10. data/lib/cfn-model/model/queue_policy.rb +0 -3
  11. data/lib/cfn-model/model/security_group.rb +0 -6
  12. data/lib/cfn-model/model/topic_policy.rb +0 -3
  13. data/lib/cfn-model/parser/cfn_parser.rb +12 -26
  14. data/lib/cfn-model/parser/iam_role_parser.rb +6 -6
  15. data/lib/cfn-model/parser/iam_user_parser.rb +1 -13
  16. data/lib/cfn-model/parser/parser_registry.rb +1 -6
  17. data/lib/cfn-model/parser/security_group_parser.rb +4 -4
  18. data/lib/cfn-model/parser/with_policy_document_parser.rb +1 -1
  19. data/lib/cfn-model/schema/{AWS_CloudFront_Distribution.yml → AWS::CloudFront::Distribution.yml} +0 -0
  20. data/lib/cfn-model/schema/{AWS_EC2_SecurityGroup.yml → AWS::EC2::SecurityGroup.yml} +0 -14
  21. data/lib/cfn-model/schema/{AWS_EC2_SecurityGroupEgress.yml → AWS::EC2::SecurityGroupEgress.yml} +0 -0
  22. data/lib/cfn-model/schema/{AWS_EC2_SecurityGroupIngress.yml → AWS::EC2::SecurityGroupIngress.yml} +0 -0
  23. data/lib/cfn-model/schema/AWS::ElasticLoadBalancing::LoadBalancer.yml +32 -0
  24. data/lib/cfn-model/schema/{AWS_IAM_Group.yml → AWS::IAM::Group.yml} +0 -0
  25. data/lib/cfn-model/schema/{AWS_IAM_ManagedPolicy.yml → AWS::IAM::ManagedPolicy.yml} +0 -0
  26. data/lib/cfn-model/schema/{AWS_IAM_Policy.yml → AWS::IAM::Policy.yml} +0 -0
  27. data/lib/cfn-model/schema/{AWS_IAM_Role.yml → AWS::IAM::Role.yml} +0 -0
  28. data/lib/cfn-model/schema/{AWS_IAM_User.yml → AWS::IAM::User.yml} +2 -2
  29. data/lib/cfn-model/schema/{AWS_IAM_UserToGroupAddition.yml → AWS::IAM::UserToGroupAddition.yml} +0 -0
  30. data/lib/cfn-model/schema/{AWS_Lambda_Permission.yml → AWS::Lambda::Permission.yml} +0 -0
  31. data/lib/cfn-model/schema/{AWS_S3_BucketPolicy.yml → AWS::S3::BucketPolicy.yml} +0 -0
  32. data/lib/cfn-model/schema/{AWS_SNS_TopicPolicy.yml → AWS::SNS::TopicPolicy.yml} +0 -0
  33. data/lib/cfn-model/schema/{AWS_SQS_QueuePolicy.yml → AWS::SQS::QueuePolicy.yml} +0 -0
  34. data/lib/cfn-model/validator/schema_generator.rb +1 -4
  35. metadata +19 -35
  36. data/bin/cfn_parse +0 -8
  37. data/lib/cfn-model/model/ec2_instance.rb +0 -15
  38. data/lib/cfn-model/model/ec2_network_interface.rb +0 -18
  39. data/lib/cfn-model/model/iam_managed_policy.rb +0 -14
  40. data/lib/cfn-model/model/iam_user_to_group_addition.rb +0 -10
  41. data/lib/cfn-model/model/load_balancer.rb +0 -37
  42. data/lib/cfn-model/model/policy.rb +0 -10
  43. data/lib/cfn-model/parser/ec2_instance_parser.rb +0 -10
  44. data/lib/cfn-model/parser/ec2_network_interface_parser.rb +0 -10
  45. data/lib/cfn-model/parser/iam_group_parser.rb +0 -17
  46. data/lib/cfn-model/parser/load_balancer_parser.rb +0 -10
  47. data/lib/cfn-model/parser/load_balancer_v2_parser.rb +0 -15
  48. data/lib/cfn-model/schema/AWS_EC2_Instance.yml +0 -146
  49. data/lib/cfn-model/schema/AWS_EC2_NetworkInterface.yml +0 -62
  50. data/lib/cfn-model/schema/AWS_EC2_NetworkInterfaceAttachment.yml +0 -24
  51. data/lib/cfn-model/schema/AWS_ElasticLoadBalancingV2_LoadBalancer.yml +0 -56
  52. data/lib/cfn-model/schema/AWS_ElasticLoadBalancing_LoadBalancer.yml +0 -188
@@ -1,18 +0,0 @@
1
- require_relative 'model_element'
2
-
3
- class AWS::EC2::NetworkInterface < ModelElement
4
- attr_accessor :groupSet, :ipv6Addresses, :privateIpAddresses, :tags
5
- attr_accessor :description, :ipv6AddressCount, :privateIpAddress, :secondaryPrivateIpAddressCount, :sourceDestCheck, :subnetId
6
-
7
- # SecurityGroup objects based upon groupSet
8
- attr_accessor :security_groups
9
-
10
- def initialize
11
- @groupSet = []
12
- @ipv6Addresses = []
13
- @privateIpAddresses = []
14
- @tags = []
15
- @security_groups = []
16
- @resource_type = 'AWS::EC2::NetworkInterface'
17
- end
18
- end
@@ -1,14 +0,0 @@
1
- require_relative 'model_element'
2
-
3
- class AWS::IAM::ManagedPolicy < ModelElement
4
- attr_accessor :description, :managedPolicyName, :policyDocument, :groups, :roles, :users, :path
5
-
6
- attr_accessor :policy_document
7
-
8
- def initialize
9
- @groups = []
10
- @roles = []
11
- @users = []
12
- @resource_type = 'AWS::IAM::ManagedPolicy'
13
- end
14
- end
@@ -1,10 +0,0 @@
1
- require_relative 'model_element'
2
-
3
- class AWS::IAM::UserToGroupAddition < ModelElement
4
- attr_accessor :groupName, :users
5
-
6
- def initialize
7
- @users = []
8
- @resource_type = 'AWS::IAM::UserToGroupAddition'
9
- end
10
- end
@@ -1,37 +0,0 @@
1
- require_relative 'model_element'
2
-
3
- class AWS::ElasticLoadBalancing::LoadBalancer < ModelElement
4
- attr_accessor :securityGroups, :subnets, :tags, :scheme, :loadBalancerName, :crossZone, :availabilityZones, :connectionDrainingPolicy
5
- attr_accessor :connectionSettings, :accessLoggingPolicy, :instances, :appCookieStickinessPolicy, :lBCookieStickinessPolicy, :healthCheck, :policies, :listeners
6
-
7
- attr_accessor :security_groups
8
-
9
- def initialize
10
- @securityGroups = []
11
- @security_groups = []
12
- @subnets = []
13
- @tags = []
14
- @availabilityZones = []
15
- @instances = []
16
- @appCookieStickinessPolicy = []
17
- @lBCookieStickinessPolicy = []
18
- @policies = []
19
- @listeners = []
20
- @resource_type = 'AWS::ElasticLoadBalancing::LoadBalancer'
21
- end
22
- end
23
-
24
- class AWS::ElasticLoadBalancingV2::LoadBalancer < ModelElement
25
- attr_accessor :securityGroups, :loadBalancerAttributes, :subnets, :tags, :scheme, :name, :ipAddressType
26
-
27
- attr_accessor :security_groups
28
-
29
- def initialize
30
- @securityGroups = []
31
- @security_groups = []
32
- @loadBalancerAttributes = []
33
- @subnets = []
34
- @tags = []
35
- @resource_type = 'AWS::ElasticLoadBalancingV2::LoadBalancer'
36
- end
37
- end
@@ -1,10 +0,0 @@
1
- require_relative 'model_element'
2
-
3
- class Policy
4
- attr_accessor :policy_name, :policy_document
5
-
6
- def ==(another_policy)
7
- policy_name == another_policy.policy_name &&
8
- policy_document == another_policy.policy_document
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- class Ec2InstanceParser
2
- def parse(cfn_model:, resource:)
3
- ec2_instance = resource
4
-
5
- ec2_instance.security_groups = ec2_instance.securityGroupIds.map do |security_group_reference|
6
- cfn_model.find_security_group_by_group_id(security_group_reference)
7
- end
8
- ec2_instance
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- class Ec2NetworkInterfaceParser
2
- def parse(cfn_model:, resource:)
3
- network_interface = resource
4
-
5
- network_interface.security_groups = network_interface.groupSet.map do |security_group_reference|
6
- cfn_model.find_security_group_by_group_id(security_group_reference)
7
- end
8
- network_interface
9
- end
10
- end
@@ -1,17 +0,0 @@
1
- require 'cfn-model/model/iam_role'
2
- require 'cfn-model/model/policy'
3
- require_relative 'policy_document_parser'
4
-
5
- class IamGroupParser
6
- def parse(cfn_model:, resource:)
7
- iam_group = resource
8
-
9
- iam_group.policy_objects = iam_group.policies.map do |policy|
10
- new_policy = Policy.new
11
- new_policy.policyName = policy['PolicyName']
12
- new_policy.policyDocument = PolicyDocumentParser.new.parse(policy['PolicyDocument'])
13
- new_policy
14
- end
15
- iam_group
16
- end
17
- end
@@ -1,10 +0,0 @@
1
- class LoadBalancerParser
2
- def parse(cfn_model:, resource:)
3
- load_balancer = resource
4
-
5
- load_balancer.security_groups = load_balancer.securityGroups.map do |security_group_reference|
6
- cfn_model.find_security_group_by_group_id(security_group_reference)
7
- end
8
- load_balancer
9
- end
10
- end
@@ -1,15 +0,0 @@
1
- class LoadBalancerV2Parser
2
- def parse(cfn_model:, resource:)
3
- load_balancer = resource
4
-
5
- #could be a List<Subnet::Id>
6
- # if load_balancer.subnets.size < 2
7
- # raise ParserError.new("Load Balancer must have at least two subnets: #{load_balancer.logical_resource_id}")
8
- # end
9
-
10
- load_balancer.security_groups = load_balancer.securityGroups.map do |security_group_reference|
11
- cfn_model.find_security_group_by_group_id(security_group_reference)
12
- end
13
- load_balancer
14
- end
15
- end
@@ -1,146 +0,0 @@
1
- ---
2
- type: map
3
- mapping:
4
- Type:
5
- type: str
6
- required: yes
7
- pattern: /AWS::EC2::Instance/
8
- Properties:
9
- type: map
10
- required: yes
11
- mapping:
12
- BlockDeviceMappings:
13
- type: seq
14
- required: no
15
- sequence:
16
- - type: map
17
- mapping:
18
- DeviceName:
19
- type: any
20
- required: yes
21
- =:
22
- type: any
23
- ImageId:
24
- type: any
25
- required: yes
26
- Ipv6Addresses:
27
- type: seq
28
- required: no
29
- sequence:
30
- - type: map
31
- mapping:
32
- Ipv6Address:
33
- type: any
34
- required: yes
35
- =:
36
- type: any
37
- NetworkInterfaces:
38
- type: seq
39
- required: no
40
- sequence:
41
- - type: map
42
- mapping:
43
- DeviceIndex:
44
- type: any
45
- required: yes
46
- GroupSet:
47
- type: seq
48
- required: no
49
- sequence:
50
- - type: any
51
- Ipv6Addresses:
52
- type: seq
53
- required: no
54
- sequence:
55
- - type: map
56
- mapping:
57
- Ipv6Address:
58
- type: any
59
- required: yes
60
- =:
61
- type: any
62
- PrivateIpAddresses:
63
- type: seq
64
- required: no
65
- sequence:
66
- - type: map
67
- mapping:
68
- PrivateIpAddress:
69
- type: any
70
- required: yes
71
- Primary:
72
- type: any
73
- required: yes
74
- =:
75
- type: any
76
- =:
77
- type: any
78
-
79
- # sigh this could be List<AWS::EC2::SecurityGroup::Id> so can't enfore seq
80
- SecurityGroupIds:
81
- type: any
82
- required: no
83
-
84
- # sigh this could be List<AWS::EC2::SecurityGroup::GroupName> so can't enfore seq
85
- SecurityGroups:
86
- type: any
87
- required: no
88
-
89
- SsmAssociations:
90
- type: seq
91
- required: no
92
- sequence:
93
- - type: map
94
- mapping:
95
- AssociationParameters:
96
- type: seq
97
- required: no
98
- sequence:
99
- - type: map
100
- mapping:
101
- Key:
102
- type: any
103
- required: yes
104
- Value:
105
- type: seq
106
- required: yes
107
- sequence:
108
- - type: any
109
- =:
110
- type: any
111
- DocumentName:
112
- required: yes
113
- type: any
114
-
115
- Tags:
116
- type: seq
117
- required: no
118
- sequence:
119
- - type: map
120
- mapping:
121
- Key:
122
- type: any
123
- required: yes
124
- Value:
125
- type: any
126
- required: yes
127
- =:
128
- type: any
129
- Volumes:
130
- type: seq
131
- required: no
132
- sequence:
133
- - type: map
134
- mapping:
135
- Device:
136
- type: any
137
- required: yes
138
- VolumeId:
139
- type: any
140
- required: yes
141
- =:
142
- type: any
143
- =:
144
- type: any
145
- =:
146
- type: any
@@ -1,62 +0,0 @@
1
- ---
2
- type: map
3
- mapping:
4
- Type:
5
- type: str
6
- required: yes
7
- pattern: /AWS::EC2::NetworkInterface/
8
- Properties:
9
- type: map
10
- required: yes
11
- mapping:
12
- # sigh this could be List<AWS::EC2::SecurityGroup::Id> so can't enfore seq
13
- GroupSet:
14
- type: any
15
- required: no
16
-
17
- Ipv6Addresses:
18
- type: seq
19
- required: no
20
- sequence:
21
- - type: map
22
- mapping:
23
- Ipv6Address:
24
- type: any
25
- required: yes
26
- =:
27
- type: any
28
- PrivateIpAddresses:
29
- type: seq
30
- required: no
31
- sequence:
32
- - type: map
33
- mapping:
34
- PrivateIpAddress:
35
- type: any
36
- required: yes
37
- Primary:
38
- type: any
39
- required: yes
40
- =:
41
- type: any
42
- SubnetId:
43
- type: any
44
- required: yes
45
- Tags:
46
- type: seq
47
- required: no
48
- sequence:
49
- - type: map
50
- mapping:
51
- Key:
52
- type: any
53
- required: yes
54
- Value:
55
- type: any
56
- required: yes
57
- =:
58
- type: any
59
- =:
60
- type: any
61
- =:
62
- type: any
@@ -1,24 +0,0 @@
1
- ---
2
- type: map
3
- mapping:
4
- Type:
5
- type: str
6
- required: yes
7
- pattern: /AWS::EC2::NetworkInterfaceAttachment/
8
- Properties:
9
- type: map
10
- required: yes
11
- mapping:
12
- DeviceIndex:
13
- type: any
14
- required: yes
15
- InstanceId:
16
- type: any
17
- required: yes
18
- NetworkInterfaceId:
19
- type: any
20
- required: yes
21
- =:
22
- type: any
23
- =:
24
- type: any
@@ -1,56 +0,0 @@
1
- ---
2
- type: map
3
- mapping:
4
- Type:
5
- type: str
6
- required: yes
7
- pattern: /AWS::ElasticLoadBalancingV2::LoadBalancer/
8
- Properties:
9
- type: map
10
- required: yes
11
- mapping:
12
- LoadBalancerAttributes:
13
- type: seq
14
- required: no
15
- sequence:
16
- - type: map
17
- mapping:
18
- Key:
19
- type: any
20
- required: yes
21
- Value:
22
- type: any
23
- required: yes
24
- =:
25
- type: any
26
-
27
- # sigh this could be List<AWS::EC2::SecurityGroup::Id> so can't enfore seq
28
- SecurityGroups:
29
- type: any
30
- required: no
31
-
32
- # sigh this could be List<AWS::EC2::Subnet::Id> so can't enfore seq
33
- Subnets:
34
- type: any
35
- required: yes
36
-
37
- Tags:
38
- type: seq
39
- required: no
40
- sequence:
41
- - type: map
42
- mapping:
43
- Key:
44
- type: any
45
- required: yes
46
- Value:
47
- type: any
48
- required: yes
49
- =:
50
- type: any
51
- =:
52
- type: any
53
- =:
54
- type: any
55
-
56
-
@@ -1,188 +0,0 @@
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
- AppCookieStickinessPolicy:
25
- type: seq
26
- required: no
27
- sequence:
28
- - type: map
29
- mapping:
30
- CookieName:
31
- type: any
32
- required: yes
33
- PolicyName:
34
- type: any
35
- required: yes
36
- =:
37
- type: any
38
-
39
- # sigh this could be List<AWS::EC2::AvailabilityZone::Name> so can't enfore seq
40
- AvailabilityZones:
41
- type: any
42
- required: no
43
-
44
- ConnectionDrainingPolicy:
45
- type: map
46
- required: no
47
- mapping:
48
- Enabled:
49
- type: any
50
- required: yes
51
- Timeout:
52
- type: any
53
- required: no
54
- =:
55
- type: any
56
- ConnectionSettings:
57
- type: map
58
- required: no
59
- mapping:
60
- IdleTimeout:
61
- type: any
62
- required: yes
63
- =:
64
- type: any
65
- HealthCheck:
66
- type: map
67
- required: no
68
- mapping:
69
- HealthyThreshold:
70
- type: any
71
- required: yes
72
- Interval:
73
- type: any
74
- required: yes
75
- Target:
76
- type: any
77
- required: yes
78
- Timeout:
79
- type: any
80
- required: yes
81
- UnhealthyThreshold:
82
- type: any
83
- required: yes
84
- =:
85
- type: any
86
-
87
- # sigh this could be List<AWS::EC2::Instance::Id> so can't enfore seq
88
- Instances:
89
- type: any
90
- required: no
91
-
92
- LBCookieStickinessPolicy:
93
- type: map
94
- required: no
95
- mapping:
96
- CookieExpirationPeriod:
97
- type: any
98
- required: no
99
- PolicyName:
100
- type: any
101
- required: yes
102
- =:
103
- type: any
104
- Listeners:
105
- type: seq
106
- required: yes
107
- sequence:
108
- - type: map
109
- mapping:
110
- InstancePort:
111
- type: any
112
- required: yes
113
- LoadBalancerPort:
114
- type: any
115
- required: yes
116
- PolicyNames:
117
- type: seq
118
- required: no
119
- sequence:
120
- - type: any
121
- =:
122
- type: any
123
- Policies:
124
- type: seq
125
- required: no
126
- sequence:
127
- - type: map
128
- mapping:
129
- Attributes:
130
- type: seq
131
- required: yes
132
- sequence:
133
- - type: map
134
- required: yes
135
- mapping:
136
- Name:
137
- type: any
138
- required: yes
139
- Value:
140
- type: any
141
- required: yes
142
- =:
143
- type: any
144
- InstancePorts:
145
- type: seq
146
- required: no
147
- sequence:
148
- - type: any
149
- LoadBalancerPorts:
150
- type: seq
151
- required: no
152
- sequence:
153
- - type: any
154
- PolicyName:
155
- type: any
156
- required: yes
157
- PolicyType:
158
- type: any
159
- required: yes
160
-
161
- # sigh this could be List<AWS::EC2::SecurityGroup::Id> so can't enfore seq
162
- SecurityGroups:
163
- type: any
164
- required: no
165
-
166
- # sigh this could be List<AWS::EC2::Subnet::Id> so can't enfore seq
167
- Subnets:
168
- type: any
169
- required: no
170
-
171
- Tags:
172
- type: seq
173
- required: no
174
- sequence:
175
- - type: map
176
- mapping:
177
- Key:
178
- type: any
179
- required: yes
180
- Value:
181
- type: any
182
- required: yes
183
- =:
184
- type: any
185
- =:
186
- type: any
187
- =:
188
- type: any