Method: Awspec::Helper::Finder::Vpc#select_vpc_attribute

Defined in:
lib/awspec/helper/finder/vpc.rb

#select_vpc_attribute(vpc_id) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/awspec/helper/finder/vpc.rb', line 103

def select_vpc_attribute(vpc_id)
  attributes = {}
  vpc_attributes = %w[
    enableDnsHostnames enableDnsSupport
  ]
  vpc_attributes.each do |vpc_attribute|
    res = ec2_client.describe_vpc_attribute({ vpc_id: vpc_id, attribute: vpc_attribute })
    attributes[vpc_attribute] = case vpc_attribute
                                when 'enableDnsHostnames'
                                  res.enable_dns_hostnames.value
                                when 'enableDnsSupport'
                                  res.enable_dns_support.value
                                end
  end
  attributes
end