Sha256: 00013969922b6f65a7d453e653d37678485a5da24db5c576e3c6ed74f6e4bf87

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

module Fog
  module OracleCloud
    class Java
      class Real

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

      class Mock
        def get_server(service_name, server_name)
          response = Excon::Response.new

          if server = self.data[:servers][service_name][server_name]
            case server[:status]
            when 'Maintenance'
              info = self.data[:maintenance_at][server_name]
              if Time.now - info['time'] >= Fog::Mock.delay
                self.data[:servers][service_name][server_name][:status] = 'Ready'
                self.data[:servers][service_name][server_name][info['attribute']] = info['value']
                self.data[:maintenance_at].delete(server_name)
              end
            end
            
            response.status = 200           
            response.body =  {
              'servers' => self.data[:servers][service_name].values
            }
            response
          else
            raise Fog::OracleCloud::Java::NotFound.new("Java Server #{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.12 lib/fog/oraclecloud/requests/java/get_server.rb