Method: Fog::AWS::RDS::Mock#reboot_db_instance

Defined in:
lib/fog/aws/requests/rds/reboot_db_instance.rb

#reboot_db_instance(instance_identifier) ⇒ Object

[View source]

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fog/aws/requests/rds/reboot_db_instance.rb', line 27

def reboot_db_instance(instance_identifier)
  response = Excon::Response.new
  if server = self.data[:servers][instance_identifier]
    if server["DBInstanceStatus"] != "available"
      raise Fog::AWS::RDS::NotFound.new("DBInstance #{instance_identifier} not available for rebooting")
    else
      server["DBInstanceStatus"] = 'rebooting'
      self.data[:reboot_time] = Time.now
      response.status = 200
      response.body = {
        "ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
        "RebootDBInstanceResult" => { "DBInstance" => server }
      }
      response

    end
  else
    raise Fog::AWS::RDS::NotFound.new("DBInstance #{instance_identifier} not found")
  end
end