Sha256: a872413fb395756a9e2b89f92924c820eb3afa5e2f1ae2461b6c11f9ad175fd1

Contents?: true

Size: 1.21 KB

Versions: 37

Compression:

Stored size: 1.21 KB

Contents

module Fog
  module AWS
    class Storage
      class Real
        # Delete an S3 bucket
        #
        # @param bucket_name [String] name of bucket to delete
        #
        # @return [Excon::Response] response:
        #   * status [Integer] - 204
        #
        # @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketDELETE.html

        def delete_bucket(bucket_name)
          request({
            :expects  => 204,
            :headers  => {},
            :bucket_name => bucket_name,
            :method   => 'DELETE'
          })
        end
      end

      class Mock # :nodoc:all
        def delete_bucket(bucket_name)
          response = Excon::Response.new
          if self.data[:buckets][bucket_name].nil?
            response.status = 404
            raise(Excon::Errors.status_error({:expects => 204}, response))
          elsif self.data[:buckets][bucket_name] && !self.data[:buckets][bucket_name][:objects].empty?
            response.status = 409
            raise(Excon::Errors.status_error({:expects => 204}, response))
          else
            self.data[:buckets].delete(bucket_name)
            response.status = 204
          end
          response
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

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