Method: Fog::Compute::IBM::Mock#delete_instance

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

#delete_instance(instance_id) ⇒ Object

[View source]

27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fog/ibm/requests/compute/delete_instance.rb', line 27

def delete_instance(instance_id)
  response = Excon::Response.new
  if deleteable? instance_id
    # remove from memoreeeez.
    self.data[:instances].delete instance_id
    response.body = { 'success' => true }
    response.status = 200
  else
    # TODO: we should really return a 412 if the instance is in an invalid state, and a 404 if it doesn't exist.
    response.status = 404
  end
  response
end