Method: Fog::Compute::IBM::Mock#get_instance

Defined in:
lib/fog/ibm/requests/compute/get_instance.rb

#get_instance(instance_id) ⇒ Object

[View source]

46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fog/ibm/requests/compute/get_instance.rb', line 46

def get_instance(instance_id)
  response = Excon::Response.new
  if instance_exists? instance_id
    activate_instance(instance_id) # Set it to Active if it's not running
    response.status = 200
    response.body   = self.data[:instances][instance_id]
  else
    raise Fog::Compute::IBM::NotFound
  end
  response
end