Sha256: d685eb7c6c76d7c31a4827584fb179e33cfe1ce66889985d46c5ccc4cdfbc482

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

module Fog
  module AWS
    class Compute
      class Real

        require 'fog/compute/parsers/aws/basic'

        # Release an elastic IP address.
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'requestId'<~String> - Id of request
        #     * 'return'<~Boolean> - success?
        def release_address(public_ip)
          request(
            'Action'    => 'ReleaseAddress',
            'PublicIp'  => public_ip,
            :idempotent => true,
            :parser     => Fog::Parsers::AWS::Compute::Basic.new
          )
        end

      end

      class Mock

        def release_address(public_ip)
          response = Excon::Response.new
          if (address = @data[:addresses].delete(public_ip))
            response.status = 200
            response.body = {
              'requestId' => Fog::AWS::Mock.request_id,
              'return'    => true
            }
            response
          else
            raise Fog::AWS::Compute::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.")
          end
        end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fog-0.8.1 lib/fog/compute/requests/aws/release_address.rb
fog-0.8.0 lib/fog/compute/requests/aws/release_address.rb
fog-0.7.2 lib/fog/compute/requests/aws/release_address.rb
fog-0.7.1 lib/fog/compute/requests/aws/release_address.rb
fog-0.7.0 lib/fog/compute/requests/aws/release_address.rb
fog-0.6.0 lib/fog/compute/requests/aws/release_address.rb