Sha256: 52f023d9dc1b6f8ccfe1376d084b761206287764beb421cf2785f92d460cdd8b

Contents?: true

Size: 1.49 KB

Versions: 11

Compression:

Stored size: 1.49 KB

Contents

module Fog
  module Compute
    class AWS
      class Real
        require 'fog/aws/parsers/compute/move_address_to_vpc'

        # Move address to VPC scope
        #
        # === Returns
        # * response<~Excon::Response>:
        #   * body<~<Hash>:
        #     * 'allocationId'<~String> - The allocation ID for the Elastic IP address
        #     * 'requestId'<~String> - Id of the request
        #     * 'status'<~String> - The status of the move of the IP address (MoveInProgress | InVpc | InClassic)

        def move_address_to_vpc(public_ip)
          request(
            'Action' => 'MoveAddressToVpc',
            'PublicIp' => public_ip,
            :idempotent => true,
            :parser => Fog::Parsers::Compute::AWS::MoveAddressToVpc.new
          )
        end
      end

      class Mock
        def move_address_to_vpc(public_ip)
          response      = Excon::Response.new
          allocation_id = "eip-#{Fog::Mock.random_hex(8)}"

          address = self.data[:addresses][public_ip]

          if address
            address['domain']       = 'vpc'
            address['allocationId'] = allocation_id

            response.status = 200
            response.body = {
              'requestId'    => Fog::AWS::Mock.request_id,
              'allocationId' => allocation_id,
              'status'       => "InVpc"
            }

            response
          else
            raise Fog::Compute::AWS::NotFound.new("Address does not exist")
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 9 versions & 2 rubygems

Version Path
fog-aws-3.1.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/compute/move_address_to_vpc.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/compute/move_address_to_vpc.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.0.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-2.0.1 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-2.0.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-1.4.1 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-1.4.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-1.3.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-1.2.1 lib/fog/aws/requests/compute/move_address_to_vpc.rb