class AWS::EC2::DHCPOptions
Attributes
dhcp_options_id[R]
@return [String]
id[R]
@return [String]
Public Class Methods
new(dhcp_options_id, options = {})
click to toggle source
@api private
Calls superclass method
# File lib/aws/ec2/dhcp_options.rb, line 22 def initialize dhcp_options_id, options = {} @dhcp_options_id = dhcp_options_id super end
Public Instance Methods
associate(vpc)
click to toggle source
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
configuration()
click to toggle source
@return [Hash]
# File lib/aws/ec2/dhcp_options.rb, line 47 def configuration dhcp_configuration_set.to_a.inject({}) do |config,opt| key = opt[:key].gsub(/-/, '_').to_sym values = opt[:value_set].map{|v| v[:value] } values = values.first if key == :domain_name values = values.first.to_i if key == :netbios_node_type config.merge(key => values) end end
delete()
click to toggle source
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
exists?()
click to toggle source
@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
vpcs()
click to toggle source
@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
Protected Instance Methods
vpc_id_option(vpc)
click to toggle source
# File lib/aws/ec2/dhcp_options.rb, line 100 def vpc_id_option vpc vpc.is_a?(VPC) ? vpc.vpc_id : vpc end