Sha256: 3a5ee3a6395e83edd789233df5d4e4a64203f875250d128e8f5f43429eaf0c22

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

module Fog
  module OracleCloud
    class Database
      class Real

      	def get_instance(instance_id)
 					response = request(
            :expects  => 200,
            :method   => 'GET',
            :path     => "/paas/service/dbcs/api/v1.1/instances/#{@identity_domain}/#{instance_id}"
          )
          response
        end
      end

      class Mock
        def get_instance(instance_id)
          response = Excon::Response.new
          if instance_exists? instance_id
            response.status = 200
            response.body   = self.data[:instances][instance_id]
          else
            raise Fog::Oracle::Database::NotFound
          end
          response
        end

        # Checks if an instance exists
        def instance_exists?(instance_id)
          self.data[:instances].key? instance_id
        end
        
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.1 lib/fog/oraclecloud/requests/database/get_instance.rb