2014-12-30 17:25:09 -05:00
require 'fog/aws/models/compute/dhcp_option'
module Fog
module Compute
2015-01-02 12:34:40 -05:00
class AWS
2014-12-30 17:25:09 -05:00
class DhcpOptions < Fog :: Collection
attribute :filters
model Fog :: Compute :: AWS :: DhcpOption
# Creates a new dhcp option
#
2015-01-02 12:34:40 -05:00
# AWS.dhcp_options.new
2014-12-30 17:25:09 -05:00
#
# ==== Returns
#
# Returns the details of the new DHCP options
#
2015-01-02 12:34:40 -05:00
#>> AWS.dhcp_options.new
2014-12-30 17:25:09 -05:00
#=> <Fog::Compute::AWS::DhcpOption
#id=nil,
#dhcp_configuration_set=nil,
#tag_set=nil
#>
#
def initialize ( attributes )
self . filters || = { }
super
end
# Returns an array of all DhcpOptions that have been created
#
2015-01-02 12:34:40 -05:00
# AWS.dhcp_options.all
2014-12-30 17:25:09 -05:00
#
# ==== Returns
#
# Returns an array of all DhcpOptions
#
2015-01-02 12:34:40 -05:00
#>> AWS.dhcp_options.all
2014-12-30 17:25:09 -05:00
#<Fog::Compute::AWS::DhcpOptions
#filters={}
#[
#<Fog::Compute::AWS::DhcpOption
#id="dopt-some-id",
#dhcp_configuration_set={"vpcId"=>"vpc-some-id", "state"=>"available"},
#tag_set={}
#>
#]
#>
#
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
# Used to retrieve an DhcpOption
#
# You can run the following command to get the details:
2015-01-02 12:34:40 -05:00
# AWS.dhcp_options.get("dopt-12345678")
2014-12-30 17:25:09 -05:00
#
# ==== Returns
#
2015-01-02 12:34:40 -05:00
#>> AWS.dhcp_options.get("dopt-12345678")
2014-12-30 17:25:09 -05:00
#=> <Fog::Compute::AWS::DhcpOption
#id="dopt-12345678",
#dhcp_configuration_set={"vpcId"=>"vpc-12345678", "state"=>"available"},
#tag_set={}
#>
#
def get ( dhcp_options_id )
if dhcp_options_id
self . class . new ( :service = > service ) . all ( 'dhcp-options-id' = > dhcp_options_id ) . first
end
end
end
end
end
end