Sha256: 52ee97a9bff9499088958cdccfa9acb1ec479515f5d9810e1c5961ff98d8533e

Contents?: true

Size: 1.59 KB

Versions: 98

Compression:

Stored size: 1.59 KB

Contents

module Fog
  module AWS
    class RDS
      class Real
        require 'fog/aws/parsers/rds/reboot_db_instance'

        # reboots a database instance
        # http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_RebootDBInstance.html
        # ==== Parameters
        # * DBInstanceIdentifier <~String> - name of the db instance to reboot
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        def reboot_db_instance(instance_identifier)
          request({
            'Action'  => 'RebootDBInstance',
            'DBInstanceIdentifier' => instance_identifier,
            :parser   => Fog::Parsers::AWS::RDS::RebootDBInstance.new,
          })
        end
      end

      class Mock
        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
      end
    end
  end
end

Version data entries

98 entries across 96 versions & 6 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.29.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.28.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.27.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.26.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.25.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.24.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.23.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.22.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.21.1 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.21.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.20.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.19.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.18.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.17.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.16.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.15.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.14.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.13.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-aws-3.12.0 lib/fog/aws/requests/rds/reboot_db_instance.rb