Class: Fog::Compute::AWS::DhcpOption

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #symbolize_keys, #to_json, #wait_for

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 = {}) ⇒ DhcpOption

Returns a new instance of DhcpOption.



13
14
15
# File 'lib/fog/aws/models/compute/dhcp_option.rb', line 13

def initialize(attributes={})
  super
end

Instance Method Details

#associate(vpc_id) ⇒ Object

Associates an existing dhcp configration set with a VPC

dhcp_option.attach(dopt-id, vpc-id)

Returns

True or false depending on the result



25
26
27
28
29
# File 'lib/fog/aws/models/compute/dhcp_option.rb', line 25

def associate(vpc_id)
  requires :id
  connection.attach_dhcp_option(id, vpc_id)
  #reload
end

#destroyObject

Removes an existing dhcp configuration set

dhcp_option.destroy

Returns

True or false depending on the result



40
41
42
43
44
# File 'lib/fog/aws/models/compute/dhcp_option.rb', line 40

def destroy
  requires :id
  connection.delete_dhcp_options(id)
  true
end

#saveObject

Create a dhcp configuration set

>> g = AWS.dhcp_options.new()
>> g.save

Returns:

requestId and a dhcpOptions object



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

def save
  requires :dhcp_configuration_set
  data = connection.create_dhcp_options(dhcp_configuration_set).body['dhcpOptionsSet'].first
  new_attributes = data.reject {|key,value| key == 'requestId'}
  merge_attributes(new_attributes)
  true

  true
end