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

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/aws/models/compute/dhcp_options.rb

Instance Method Summary collapse

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::AWS::Compute::DhcpOption

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



27
28
29
30
# File 'lib/fog/aws/models/compute/dhcp_options.rb', line 27

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

Instance Method Details

#all(filters_arg = 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::AWS::Compute::DhcpOptions filters={} [ <Fog::AWS::Compute::DhcpOption id=“dopt-some-id”, dhcp_configuration_set=“state”=>“available”, tag_set={} > ] >



53
54
55
56
57
58
59
60
61
# File 'lib/fog/aws/models/compute/dhcp_options.rb', line 53

def all(filters_arg = filters)
  unless filters_arg.is_a?(Hash)
    Fog::Logger.warning("all with #{filters_arg.class} param is deprecated, use all('internet-gateway-id' => []) instead [light_black](#{caller.first})[/]")
    filters_arg = {'dhcp-options-id' => [*filters_arg]}
  end
  filters = filters_arg
  data = service.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::AWS::Compute::DhcpOption

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



78
79
80
81
82
# File 'lib/fog/aws/models/compute/dhcp_options.rb', line 78

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