Sha256: c7748a5d904876a374258935f6a25f58f6f3829e0f1f7efca63c0a558c6e4b56

Contents?: true

Size: 1.6 KB

Versions: 76

Compression:

Stored size: 1.6 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

76 entries across 76 versions & 11 rubygems

Version Path
fog-1.22.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-1.21.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-1.20.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-1.19.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/rds/reboot_db_instance.rb