cfn-model 0.4.27 → 0.4.28

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
  SHA256:
3
- metadata.gz: e5feb1962cc34b035503b0359a30d5dbbfd55d23f2c6753c8a4ede574f49d32e
4
- data.tar.gz: 33e6ffd7bd6c8b543f696176b02e1443ddac8924ddaac58bd24a49bdeb8d820a
3
+ metadata.gz: df1ac14db4c825a752953a999fca09e56eaaa3e7141146bea1892cfe0c1f350c
4
+ data.tar.gz: 010c17ccd4d19b1999768d8b41b71dd98f6cca02713cf3065ac6cf208ee4d4f2
5
5
  SHA512:
6
- metadata.gz: e411bd196fbfcb2e372c1e46bb6be0dad34c94193e2fdd182092f090f63617e8df3f4942b5b076cfb272b82fe05a6a0515b408a873119b932f925f19d34b20d4
7
- data.tar.gz: 40eeee5ae68f71008117469f9aa4639b40770c997657d28a4b048377d59e926d5c3c2128e65dbf4e06f4dc39c65a18043d581273b9bad0218f1223217a70825b
6
+ metadata.gz: 2530d80cc408f921c69ec5757c6b4c73a064a1d6e7c980cce9dd3a0441bdd501e82685ceff915c756ea7a4cd4fd52f712ddb7cd63a190686abc9b8613b63de05
7
+ data.tar.gz: 8f053b02001d51fb7f4130e6b77d0e9cc7d3c36f35d8e3b9c3d55b6d9cc610a9ab02cdb8604c4385556819aa4e7581f2bf23cd912b910220b0f7c7bfd13d8dd6
@@ -3,13 +3,11 @@
3
3
  require_relative 'model_element'
4
4
 
5
5
  class AWS::EC2::NetworkAcl < ModelElement
6
- attr_accessor :network_acl_egress_entries
7
- attr_accessor :network_acl_ingress_entries
6
+ attr_accessor :network_acl_entries
8
7
 
9
8
  def initialize(cfn_model)
10
9
  super
11
- @network_acl_egress_entries = []
12
- @network_acl_ingress_entries = []
10
+ @network_acl_entries = []
13
11
  @resource_type = 'AWS::EC2::NetworkAcl'
14
12
  end
15
- end
13
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'model_element'
4
+
5
+ class AWS::EC2::NetworkAclEntry < ModelElement
6
+ def initialize(cfn_model)
7
+ super
8
+ @resource_type = 'AWS::EC2::NetworkAclEntry'
9
+ end
10
+ end
@@ -8,45 +8,23 @@ require 'cfn-model/util/truthy'
8
8
  class Ec2NetworkAclParser
9
9
  def parse(cfn_model:, resource:)
10
10
  network_acl = resource
11
-
12
11
  attach_nacl_entries_to_nacl(cfn_model: cfn_model, network_acl: network_acl)
13
12
  network_acl
14
13
  end
15
14
 
16
15
  private
17
16
 
18
- def egress_network_acl_entries(cfn_model)
19
- network_acl_entries = cfn_model.resources_by_type 'AWS::EC2::NetworkAclEntry'
20
- network_acl_entries.select(&:egress)
21
- end
22
-
23
- def ingress_network_acl_entries(cfn_model)
24
- network_acl_entries = cfn_model.resources_by_type 'AWS::EC2::NetworkAclEntry'
25
- network_acl_entries.select do |network_acl_entry|
26
- not_truthy?(network_acl_entry.egress)
27
- end
28
- end
29
-
30
- def egress_nacl_entries_for_nacl(cfn_model, logical_resource_id)
31
- egress_nacl_entries = egress_network_acl_entries(cfn_model)
32
- egress_nacl_entries.select do |egress_nacl_entry|
33
- References.resolve_resource_id(egress_nacl_entry.networkAclId) == logical_resource_id
34
- end
35
- end
36
-
37
- def ingress_nacl_entries_for_nacl(cfn_model, logical_resource_id)
38
- ingress_nacl_entries = ingress_network_acl_entries(cfn_model)
39
- ingress_nacl_entries.select do |ingress_nacl_entry|
40
- References.resolve_resource_id(ingress_nacl_entry.networkAclId) == logical_resource_id
17
+ def nacl_entries_for_nacl(cfn_model, logical_resource_id)
18
+ network_acl_entries = cfn_model.resources_by_type('AWS::EC2::NetworkAclEntry')
19
+ .select do |network_acl_entry|
20
+ References.resolve_resource_id(network_acl_entry.networkAclId) == logical_resource_id
41
21
  end
22
+ network_acl_entries
42
23
  end
43
24
 
44
25
  def attach_nacl_entries_for_nacl(cfn_model, network_acl)
45
- egress_nacl_entries_for_nacl(cfn_model, network_acl.logical_resource_id).each do |egress_entry|
46
- network_acl.network_acl_egress_entries << egress_entry.logical_resource_id
47
- end
48
- ingress_nacl_entries_for_nacl(cfn_model, network_acl.logical_resource_id).each do |ingress_entry|
49
- network_acl.network_acl_ingress_entries << ingress_entry.logical_resource_id
26
+ nacl_entries_for_nacl(cfn_model, network_acl.logical_resource_id).each do |network_acl_entry|
27
+ network_acl.network_acl_entries << network_acl_entry
50
28
  end
51
29
  end
52
30
 
@@ -0,0 +1,15 @@
1
+ ---
2
+ type: map
3
+ mapping:
4
+ Type:
5
+ type: str
6
+ required: yes
7
+ pattern: /AWS::EC2::NetworkAcl/
8
+ Properties:
9
+ type: map
10
+ required: yes
11
+ mapping:
12
+ =:
13
+ type: any
14
+ =:
15
+ type: any
@@ -0,0 +1,21 @@
1
+ ---
2
+ type: map
3
+ mapping:
4
+ Type:
5
+ type: str
6
+ required: yes
7
+ pattern: /AWS::EC2::NetworkAclEntry/
8
+ Properties:
9
+ type: map
10
+ required: yes
11
+ mapping:
12
+ Icmp:
13
+ type: any
14
+ required: no
15
+ PortRange:
16
+ type: any
17
+ required: no
18
+ =:
19
+ type: any
20
+ =:
21
+ type: any
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.27
4
+ version: 0.4.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kascic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-01 00:00:00.000000000 Z
11
+ date: 2020-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -67,6 +67,7 @@ files:
67
67
  - lib/cfn-model/model/cfn_model.rb
68
68
  - lib/cfn-model/model/ec2_instance.rb
69
69
  - lib/cfn-model/model/ec2_network_acl.rb
70
+ - lib/cfn-model/model/ec2_network_acl_entry.rb
70
71
  - lib/cfn-model/model/ec2_network_interface.rb
71
72
  - lib/cfn-model/model/iam_group.rb
72
73
  - lib/cfn-model/model/iam_managed_policy.rb
@@ -115,6 +116,8 @@ files:
115
116
  - lib/cfn-model/psych/visitors/to_ruby_with_line_numbers.rb
116
117
  - lib/cfn-model/schema/AWS_CloudFront_Distribution.yml
117
118
  - lib/cfn-model/schema/AWS_EC2_Instance.yml
119
+ - lib/cfn-model/schema/AWS_EC2_NetworkAcl.yml
120
+ - lib/cfn-model/schema/AWS_EC2_NetworkAclEntry.yml
118
121
  - lib/cfn-model/schema/AWS_EC2_NetworkInterface.yml
119
122
  - lib/cfn-model/schema/AWS_EC2_NetworkInterfaceAttachment.yml
120
123
  - lib/cfn-model/schema/AWS_EC2_SecurityGroup.yml