Sha256: 9ef0a2afa2881c5e2d2a40da76c83931356792f88d951b45dbdd7a68cfd9fdaa

Contents?: true

Size: 1.87 KB

Versions: 13

Compression:

Stored size: 1.87 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
    class AWS

      class InternetGateway < Fog::Model

        identity  :id,                          :aliases => 'internetGatewayId'
        attribute :attachment_set,              :aliases => 'attachmentSet'
        attribute :tag_set,                     :aliases => 'tagSet'

        def initialize(attributes={})
          super
        end

        # Attaches an existing internet gateway
        #
        # internet_gateway.attach(igw-id, vpc-id)
        #
        # ==== Returns
        #
        # True or false depending on the result
        #
        def attach(vpc_id)
          requires :id
          connection.attach_internet_gateway(id, vpc_id)
          reload
        end

        # Detaches an existing internet gateway
        #
        # internet_gateway.detach(igw-id, vpc-id)
        #
        # ==== Returns
        #
        # True or false depending on the result
        #
        def detach(vpc_id)
          requires :id
          connection.detach_internet_gateway(id, vpc_id)
          reload
        end


        # Removes an existing internet gateway
        #
        # internet_gateway.destroy
        #
        # ==== Returns
        #
        # True or false depending on the result
        #
        def destroy
          requires :id

          connection.delete_internet_gateway(id)
          true
        end

        # Create an internet gateway
        #
        #  >> g = AWS.internet_gateways.new()
        #  >> g.save
        #
        # == Returns:
        #
        # requestId and a internetGateway object
        #
        def save
          data = connection.create_internet_gateway.body['internetGatewaySet'].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/internet_gateway.rb
fog-nirvanix-1.8.1 lib/fog/aws/models/compute/internet_gateway.rb
fog-parser-fix-1.6.1 lib/fog/aws/models/compute/internet_gateway.rb
fog-test-again-1.6.0 lib/fog/aws/models/compute/internet_gateway.rb
fog-parser-fix-1.6.0 lib/fog/aws/models/compute/internet_gateway.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/models/compute/internet_gateway.rb
fog-sgonyea-1.8.1 lib/fog/aws/models/compute/internet_gateway.rb
fog-1.8.0 lib/fog/aws/models/compute/internet_gateway.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/models/compute/internet_gateway.rb
fog-1.7.0 lib/fog/aws/models/compute/internet_gateway.rb
fog-1.6.0 lib/fog/aws/models/compute/internet_gateway.rb
fog-1.5.0 lib/fog/aws/models/compute/internet_gateway.rb
fog-1.4.0 lib/fog/aws/models/compute/internet_gateway.rb