Sha256: a5566471c1d5f3a4ec3a5e2b5f900a16c1338bff0385067246ad92aadbb3ad51

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module Fog
  module Compute
    class OracleCloud
      class Real
        def get_ip_association(name)
          name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
          response = request(
            :expects  => 200,
            :method   => 'GET',
            :path     => "/ip/association/Compute-#{@identity_domain}/#{@username}/#{name}",
            :headers  => {
              'Content-Type' => 'application/oracle-compute-v3+json',
              'Accept' => 'application/oracle-compute-v3+json'
            }
          )
          response
        end
      end

      class Mock
        def get_ip_association(name)
          response = Excon::Response.new
          clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
          if ip = self.data[:ip_associations][clean_name] 
            response.status = 200
            response.body = ip
            response
          else;
            raise Fog::Compute::OracleCloud::NotFound.new("IP Association #{name} does not exist");
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.17 lib/fog/oraclecloud/requests/compute/get_ip_association.rb