Sha256: 52084e72a216f0e86f07065612147f61ec6298b67c1fcd645fcb1b3ac87a0bdd

Contents?: true

Size: 1.92 KB

Versions: 22

Compression:

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

22 entries across 22 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/aws/requests/rds/delete_db_instance.rb
fog-aws-0.1.1 lib/fog/aws/requests/rds/delete_db_instance.rb
fog-aws-0.1.0 lib/fog/aws/requests/rds/delete_db_instance.rb
fog-aws-0.0.8 lib/fog/aws/requests/rds/delete_db_instance.rb
fog-aws-0.0.7 lib/fog/aws/requests/rds/delete_db_instance.rb
fog-aws-0.0.6 lib/fog/aws/requests/rds/delete_db_instance.rb
fog-aws-0.0.5 lib/fog/aws/requests/rds/delete_db_instance.rb
fog-1.26.0 lib/fog/aws/requests/rds/delete_db_instance.rb
fog-1.25.0 lib/fog/aws/requests/rds/delete_db_instance.rb
nsidc-fog-1.24.1 lib/fog/aws/requests/rds/delete_db_instance.rb
fog-1.24.0 lib/fog/aws/requests/rds/delete_db_instance.rb
ns-fog-1.22.11 lib/fog/aws/requests/rds/delete_db_instance.rb
ns-fog-1.22.10 lib/fog/aws/requests/rds/delete_db_instance.rb
ns-fog-1.22.9 lib/fog/aws/requests/rds/delete_db_instance.rb
ns-fog-1.22.8 lib/fog/aws/requests/rds/delete_db_instance.rb
ns-fog-1.22.7 lib/fog/aws/requests/rds/delete_db_instance.rb
ns-fog-1.22.6 lib/fog/aws/requests/rds/delete_db_instance.rb
fog-1.23.0 lib/fog/aws/requests/rds/delete_db_instance.rb
ns-fog-1.22.4 lib/fog/aws/requests/rds/delete_db_instance.rb
ns-fog-1.22.3 lib/fog/aws/requests/rds/delete_db_instance.rb