Class: Fog::Compute::AWS::DhcpOptions

Inherits:
Fog::Collection show all
Defined in:
lib/rackspace-fog/aws/models/compute/dhcp_options.rb

Instance Attribute Summary

Attributes inherited from Fog::Collection

#connection

Instance Method Summary collapse

Methods inherited from Fog::Collection

#clear, #create, #destroy, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

#initialize(attributes) ⇒ DhcpOptions

Creates a new dhcp option

AWS.dhcp_options.new

Returns

Returns the details of the new DHCP options

>> AWS.dhcp_options.new

> <Fog::Compute::AWS::DhcpOption

id=nil, dhcp_configuration_set=nil, tag_set=nil >



30
31
32
33
# File 'lib/rackspace-fog/aws/models/compute/dhcp_options.rb', line 30

def initialize(attributes)
  self.filters ||= {}
  super
end

Instance Method Details

#all(filters = filters) ⇒ Object

Returns an array of all DhcpOptions that have been created

AWS.dhcp_options.all

Returns

Returns an array of all DhcpOptions

>> AWS.dhcp_options.all <Fog::Compute::AWS::DhcpOptions filters={} [ <Fog::Compute::AWS::DhcpOption id=“dopt-some-id”, dhcp_configuration_set=“state”=>“available”, tag_set={} > ] >



56
57
58
59
60
61
62
63
64
# File 'lib/rackspace-fog/aws/models/compute/dhcp_options.rb', line 56

def all(filters = filters)
  unless filters.is_a?(Hash)
    Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('internet-gateway-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'dhcp-options-id' => [*filters]}
  end
  self.filters = filters
  data = connection.describe_dhcp_options(filters).body
  load(data['dhcpOptionsSet'])
end

#get(dhcp_options_id) ⇒ Object

Used to retrieve an DhcpOption

You can run the following command to get the details: AWS.dhcp_options.get(“dopt-12345678”)

Returns

>> AWS.dhcp_options.get(“dopt-12345678”)

> <Fog::Compute::AWS::DhcpOption

id=“dopt-12345678”, dhcp_configuration_set=“state”=>“available”, tag_set={} >



81
82
83
84
85
# File 'lib/rackspace-fog/aws/models/compute/dhcp_options.rb', line 81

def get(dhcp_options_id)
  if dhcp_options_id
    self.class.new(:connection => connection).all('dhcp-options-id' => dhcp_options_id).first
  end
end