@return [String]
@return [String]
@private
# File lib/aws/ec2/dhcp_options.rb, line 22 def initialize dhcp_options_id, options = {} @dhcp_options_id = dhcp_options_id super end
Associates this set of options to the given VPC. @param [VPC,String] vpc A {VPC} object or a vpc id string. @return [nil]
# File lib/aws/ec2/dhcp_options.rb, line 60 def associate vpc client_opts = {} client_opts[:dhcp_options_id] = dhcp_options_id client_opts[:vpc_id] = vpc_id_option(vpc) client.associate_dhcp_options(client_opts) nil end
@return [Hash]
# File lib/aws/ec2/dhcp_options.rb, line 47 def configuration dhcp_configuration_set.inject({}) do |config,opt| key = opt.key.gsub(%r-/, '_').to_sym values = opt.value_set.map(&:value) values = values.first if key == :domain_name values = values.first.to_i if key == :netbios_node_type config.merge(key => values) end end
Deletes these DHCP options. An error will be raised if these options are currently associated to a VPC. To disassociate this set of options from a VPC, associate a different set of options with the VPC.
@return [nil]
# File lib/aws/ec2/dhcp_options.rb, line 75 def delete client_opts = {} client_opts[:dhcp_options_id] = dhcp_options_id client.delete_dhcp_options(client_opts) nil end
@return [Boolean] Returns true if the dhcp options exists.
# File lib/aws/ec2/dhcp_options.rb, line 90 def exists? begin get_resource true rescue Errors::InvalidDhcpOptionID::NotFound false end end
@return [VPCCollection] Returns a collection that represents
all VPCs currently using this dhcp options.
# File lib/aws/ec2/dhcp_options.rb, line 84 def vpcs vpcs = VPCCollection.new(:config => config) vpcs.filter('dhcp-options-id', dhcp_options_id) end
# File lib/aws/ec2/dhcp_options.rb, line 100 def vpc_id_option vpc vpc.is_a?(VPC) ? vpc.vpc_id : vpc end