Sha256: 511b2a6bf7402733317224cfe0d6d02e204f6b3abe32d37cd6498693230f741e

Contents?: true

Size: 1.58 KB

Versions: 60

Compression:

Stored size: 1.58 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
    class AWS

      class DhcpOption < Fog::Model

        identity  :id,                          :aliases => 'dhcpOptionsId'
        attribute :dhcp_configuration_set,      :aliases => 'dhcpConfigurationSet'
        attribute :tag_set,                     :aliases => 'tagSet'

        def initialize(attributes={})
          super
        end

        # Associates an existing dhcp configration set with a VPC
        #
        # dhcp_option.attach(dopt-id, vpc-id)
        #
        # ==== Returns
        #
        # True or false depending on the result
        #
        def associate(vpc_id)
          requires :id
          service.attach_dhcp_option(id, vpc_id)
          #reload
        end

        # Removes an existing dhcp configuration set
        #
        # dhcp_option.destroy
        #
        # ==== Returns
        #
        # True or false depending on the result
        #

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

        # Create a dhcp configuration set
        #
        #  >> g = AWS.dhcp_options.new()
        #  >> g.save
        #
        # == Returns:
        #
        # requestId and a dhcpOptions object
        #

        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
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 6 rubygems

Version Path
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/models/compute/dhcp_option.rb
fog-1.19.0 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/aws/models/compute/dhcp_option.rb