Sha256: 75cb705d96ac117041522e7fc9d71c8500afdf6ed270c985285dab2df51e2931

Contents?: true

Size: 1.32 KB

Versions: 11

Compression:

Stored size: 1.32 KB

Contents

module Fog
  module OracleCloud
    class Java
      class Real

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

      class Mock
        def get_instance(name)
          response = Excon::Response.new

          if instance = self.data[:instances][name]
            case instance['status']
            when 'Terminating'
              if Time.now - self.data[:deleted_at][name] >= Fog::Mock.delay
                self.data[:deleted_at].delete(name)
                self.data[:instances].delete(name)
              end
            when 'In Progress'
              if Time.now - self.data[:created_at][name] >= Fog::Mock.delay
                self.data[:instances][name]['status'] = 'Running'
                instance = self.data[:instances][name]
                self.data[:created_at].delete(name)
              end
            end
            response.status = 200
            response.body = instance
            response
          else
            raise Fog::OracleCloud::Java::NotFound.new("Java #{name} does not exist");
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.12 lib/fog/oraclecloud/requests/java/get_instance.rb
fog-oraclecloud-0.1.11 lib/fog/oraclecloud/requests/java/get_instance.rb
fog-oraclecloud-0.1.10 lib/fog/oraclecloud/requests/java/get_instance.rb
fog-oraclecloud-0.1.9 lib/fog/oraclecloud/requests/java/get_instance.rb
fog-oraclecloud-0.1.8 lib/fog/oraclecloud/requests/java/get_instance.rb
fog-oraclecloud-0.1.7 lib/fog/oraclecloud/requests/java/get_instance.rb
fog-oraclecloud-0.1.6 lib/fog/oraclecloud/requests/java/get_instance.rb
fog-oraclecloud-0.1.5 lib/fog/oraclecloud/requests/java/get_instance.rb
fog-oraclecloud-0.1.4 lib/fog/oraclecloud/requests/java/get_instance.rb
fog-oraclecloud-0.1.3 lib/fog/oraclecloud/requests/java/get_instance.rb
fog-oraclecloud-0.1.2 lib/fog/oraclecloud/requests/java/get_instance.rb