Sha256: d053a7a484206d15aac2c81fdf12873b2f98943ec8ce1b72f10a6884e89cb03a

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.16 lib/fog/oraclecloud/requests/compute/get_ip_association.rb