Sha256: 6c33cc5ea0582cdcee49ee8c6d07f584ca42321d2e50a17001d9811267fd8a6b

Contents?: true

Size: 1.59 KB

Versions: 13

Compression:

Stored size: 1.59 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
          connection.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
          connection.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 = 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
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 7 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/aws/models/compute/dhcp_option.rb
fog-nirvanix-1.8.1 lib/fog/aws/models/compute/dhcp_option.rb
fog-parser-fix-1.6.1 lib/fog/aws/models/compute/dhcp_option.rb
fog-test-again-1.6.0 lib/fog/aws/models/compute/dhcp_option.rb
fog-parser-fix-1.6.0 lib/fog/aws/models/compute/dhcp_option.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/models/compute/dhcp_option.rb
fog-sgonyea-1.8.1 lib/fog/aws/models/compute/dhcp_option.rb
fog-1.8.0 lib/fog/aws/models/compute/dhcp_option.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/models/compute/dhcp_option.rb
fog-1.7.0 lib/fog/aws/models/compute/dhcp_option.rb
fog-1.6.0 lib/fog/aws/models/compute/dhcp_option.rb
fog-1.5.0 lib/fog/aws/models/compute/dhcp_option.rb
fog-1.4.0 lib/fog/aws/models/compute/dhcp_option.rb