Sha256: 2285fcc938281b772bb8594df96f58053a4aee66d9b339f0cdbd7b0877a42d66

Contents?: true

Size: 1.85 KB

Versions: 37

Compression:

Stored size: 1.85 KB

Contents

module Fog
  module Compute
    class AWS
      class Real

        require 'fog/aws/parsers/compute/attach_internet_gateway'
        # Attaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC
        #
        # ==== Parameters
        # * internet_gateway_id<~String> - The ID of the Internet gateway to attach
        # * vpc_id<~String> - The ID of the VPC
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'requestId'<~String> - Id of request
        #     * 'return'<~Boolean> - Returns true if the request succeeds.
        #
        # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AttachInternetGateway.html]
        def attach_internet_gateway(internet_gateway_id, vpc_id)
          request(
            'Action'               => 'AttachInternetGateway',
            'InternetGatewayId'    => internet_gateway_id,
            'VpcId'                => vpc_id,
            :idempotent   => true,
            :parser       => Fog::Parsers::Compute::AWS::AttachInternetGateway.new
          )
        end

      end

      class Mock

        def attach_internet_gateway(internet_gateway_id, vpc_id)
          response = Excon::Response.new
          if internet_gateway_id && vpc_id
            response.status = 200
            response.body = {
              'requestId' => Fog::AWS::Mock.request_id,
              'return' => true
            }
            response
          else
            if !internet_gateway_id
              message << 'The request must contain the parameter internet_gateway_id'
            elsif !vpc_id
              message << 'The request must contain the parameter vpc_id'
            end
            raise Fog::Compute::AWS::Error.new(message)
          end
        end

      end
    end
  end
end

Version data entries

37 entries across 37 versions & 11 rubygems

Version Path
fog-parser-fix-1.6.1 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-test-again-1.6.0 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-test-me-1.10.0 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-parser-fix-1.6.0 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-1.10.0 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-1.9.0 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/aws/requests/compute/attach_internet_gateway.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-sgonyea-1.8.1 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-1.8.0 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-1.7.0 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-1.6.0 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-1.5.0 lib/fog/aws/requests/compute/attach_internet_gateway.rb
fog-1.4.0 lib/fog/aws/requests/compute/attach_internet_gateway.rb