Sha256: bf6a4ecb7e643576b77e61d2de07e2922a3b3fdca8abf4db6758aa4d82a9f309

Contents?: true

Size: 1.49 KB

Versions: 36

Compression:

Stored size: 1.49 KB

Contents

module Fog
  module AWS
    class Compute
      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::AWS::Compute::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::AWS::Compute::NotFound.new("Address does not exist")
          end
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
fog-aws-3.10.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.9.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.8.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.7.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.6.7 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.6.6 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.6.5 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.6.4 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.6.3 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.6.2 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.5.2 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.5.1 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.5.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.4.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.3.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb
fog-aws-3.2.0 lib/fog/aws/requests/compute/move_address_to_vpc.rb