Sha256: 00db14a910039f5784bec3f3ec1e59c4924c18212dc07902ac8fc13550b7713c

Contents?: true

Size: 1.95 KB

Versions: 85

Compression:

Stored size: 1.95 KB

Contents

module Fog
  module AWS
    class RDS
      class Real

        require 'fog/aws/parsers/rds/delete_db_instance'

        # delete a database instance
        # http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DeleteDBInstance.html
        # ==== Parameters
        # * DBInstanceIdentifier <~String> - The DB Instance identifier for the DB Instance to be deleted.
        # * FinalDBSnapshotIdentifier <~String> - The DBSnapshotIdentifier of the new DBSnapshot created when SkipFinalSnapshot is set to false
        # * SkipFinalSnapshot <~Boolean> - Determines whether a final DB Snapshot is created before the DB Instance is deleted
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        def delete_db_instance(identifier, snapshot_identifier, skip_snapshot = false) 
          params = {}
          params['FinalDBSnapshotIdentifier'] = snapshot_identifier if snapshot_identifier
          request({
            'Action'  => 'DeleteDBInstance',
            'DBInstanceIdentifier' => identifier,
            'SkipFinalSnapshot' => skip_snapshot,            
            :parser   => Fog::Parsers::AWS::RDS::DeleteDBInstance.new
          }.merge(params))
        end

      end

      class Mock

        def delete_db_instance(identifier, snapshot_identifier, skip_snapshot = false)
          response = Excon::Response.new
          
          unless skip_snapshot
            create_db_snapshot(identifier, snapshot_identifier)
          end
          
          if server_set = self.data[:servers].delete(identifier)
            response.status = 200
            response.body = {
              "ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
              "DeleteDBInstanceResult" => { "DBInstance" => server_set }
            }
            response
          else
            raise Fog::AWS::RDS::NotFound.new("DBInstance #{identifier} not found")
          end
        end

      end
    end
  end
end

Version data entries

85 entries across 85 versions & 15 rubygems

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