Method: Awspec::Generator::Spec::NetworkAcl#generate_by_vpc_id

Defined in:
lib/awspec/generator/spec/network_acl.rb

#generate_by_vpc_id(vpc_id) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/awspec/generator/spec/network_acl.rb', line 7

def generate_by_vpc_id(vpc_id)
  describes = %w[
  ]
  vpc = find_vpc(vpc_id)
  raise 'Not Found VPC' unless vpc

  @vpc_id = vpc[:vpc_id]
  @vpc_tag_name = vpc.tag_name
  network_acls = select_network_acl_by_vpc_id(@vpc_id)
  specs = network_acls.map do |acl|
    linespecs = generate_linespecs(acl)
    subnet_specs = generate_subnet_specs(acl)
    network_acl_id = acl[:network_acl_id]
    network_acl_tag_name = acl.tag_name
    inbound_entries_count = acl.entries.count do |entry|
      entry.egress == false
    end
    outbound_entries_count = acl.entries.count do |entry|
      entry.egress == true
    end
    content = ERB.new(network_acl_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
  end
  specs.join("\n")
end