Method: Awspec::Generator::Spec::NetworkInterface#generate_by_vpc_id

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

#generate_by_vpc_id(vpc_id) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/awspec/generator/spec/network_interface.rb', line 5

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_interfaces = select_network_interface_by_vpc_id(@vpc_id)
  specs = network_interfaces.map do |interface|
    instance_spec = generate_instance_spec(interface)
    subnet_spec = generate_subnet_spec(interface)
    network_interface_id = interface[:network_interface_id]
    linespecs = generate_linespecs(interface)
    private_ip_addresses_count = interface.private_ip_addresses.count
    content = ERB.new(network_interface_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
  end
  specs.join("\n")
end