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

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

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DhcpOption

Returns a new instance of DhcpOption.



9
10
11
# File 'lib/fog/aws/models/compute/dhcp_option.rb', line 9

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



21
22
23
24
25
# File 'lib/fog/aws/models/compute/dhcp_option.rb', line 21

def associate(vpc_id)
  requires :id
  service.associate_dhcp_options(id, vpc_id)
  reload
end

#destroyObject

Removes an existing dhcp configuration set

dhcp_option.destroy

Returns

True or false depending on the result



36
37
38
39
40
# File 'lib/fog/aws/models/compute/dhcp_option.rb', line 36

def destroy
  requires :id
  service.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



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

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

  true
end