Sha256: 7f365e7bb7903ed1c8f7ca0a40d6dc2ff5e9ddc63de5731621b7a576ed1beb62

Contents?: true

Size: 1.85 KB

Versions: 22

Compression:

Stored size: 1.85 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
          service.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
          service.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

          service.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 = service.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

22 entries across 22 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/aws/models/compute/internet_gateway.rb
fog-aws-0.1.1 lib/fog/aws/models/compute/internet_gateway.rb
fog-aws-0.1.0 lib/fog/aws/models/compute/internet_gateway.rb
fog-aws-0.0.8 lib/fog/aws/models/compute/internet_gateway.rb
fog-aws-0.0.7 lib/fog/aws/models/compute/internet_gateway.rb
fog-aws-0.0.6 lib/fog/aws/models/compute/internet_gateway.rb
fog-aws-0.0.5 lib/fog/aws/models/compute/internet_gateway.rb
fog-1.26.0 lib/fog/aws/models/compute/internet_gateway.rb
fog-1.25.0 lib/fog/aws/models/compute/internet_gateway.rb
nsidc-fog-1.24.1 lib/fog/aws/models/compute/internet_gateway.rb
fog-1.24.0 lib/fog/aws/models/compute/internet_gateway.rb
ns-fog-1.22.11 lib/fog/aws/models/compute/internet_gateway.rb
ns-fog-1.22.10 lib/fog/aws/models/compute/internet_gateway.rb
ns-fog-1.22.9 lib/fog/aws/models/compute/internet_gateway.rb
ns-fog-1.22.8 lib/fog/aws/models/compute/internet_gateway.rb
ns-fog-1.22.7 lib/fog/aws/models/compute/internet_gateway.rb
ns-fog-1.22.6 lib/fog/aws/models/compute/internet_gateway.rb
fog-1.23.0 lib/fog/aws/models/compute/internet_gateway.rb
ns-fog-1.22.4 lib/fog/aws/models/compute/internet_gateway.rb
ns-fog-1.22.3 lib/fog/aws/models/compute/internet_gateway.rb