Sha256: 5371bac5f6fedd0414cea43470a21dd4a4f38aa584eee031925d5b4c84500692

Contents?: true

Size: 1.65 KB

Versions: 14

Compression:

Stored size: 1.65 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 self.data[:servers][instance_identifier]
            if self.data[:servers][instance_identifier]["DBInstanceStatus"] != "available"
              raise Fog::AWS::RDS::NotFound.new("DBInstance #{instance_identifier} not available for rebooting")
            else
              self.data[:servers][instance_identifier]["DBInstanceStatus"] = 'rebooting'
              response.status = 200
              response.body = {
                "ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
                "RebootDBInstanceResult" => { "DBInstance" => self.data[:servers][instance_identifier] }
              }
              response
              
            end
          else
            raise Fog::AWS::RDS::NotFound.new("DBInstance #{instance_identifier} not found")
          end
        end

      end
    end
  end
end

Version data entries

14 entries across 14 versions & 5 rubygems

Version Path
fog-1.5.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-1.4.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/rds/reboot_db_instance.rb
michiels-fog-1.3.1 lib/fog/aws/requests/rds/reboot_db_instance.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/requests/rds/reboot_db_instance.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-1.3.1 lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-1.3.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/rds/reboot_db_instance.rb
fog-1.2.0 lib/fog/aws/requests/rds/reboot_db_instance.rb
ktheory-fog-1.1.2 lib/fog/aws/requests/rds/reboot_db_instance.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/rds/reboot_db_instance.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/rds/reboot_db_instance.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/rds/reboot_db_instance.rb