Sha256: 97e214456a3f598727de23c7e0c58dfd5f9796537cc6fda2972df6f0aec759f0

Contents?: true

Size: 1.1 KB

Versions: 49

Compression:

Stored size: 1.1 KB

Contents

module Fog
  module Storage
    class AWS
      class Real
        # Get headers for an S3 bucket, used to verify if it exists and if you have permission to access it
        #
        # @param bucket_name [String] Name of bucket to read from
        #
        # @return [Excon::Response] 200 response implies it exists, 404 does not exist, 403 no permissions
        #   * body [String] Empty
        #   * headers [Hash]:
        #     * Content-Type [String] - MIME type of object
        #
        # @see http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketHEAD.html
        #
        def head_bucket(bucket_name)
          unless bucket_name
            raise ArgumentError.new('bucket_name is required')
          end
          request({
            :expects    => 200,
            :bucket_name => bucket_name,
            :idempotent => true,
            :method     => 'HEAD',
          })
        end
      end

      class Mock # :nodoc:all
        def head_bucket(bucket_name)
          response = get_bucket(bucket_name)
          response.body = nil
          response
        end
      end
    end
  end
end

Version data entries

49 entries across 47 versions & 5 rubygems

Version Path
fog-aws-3.1.0 lib/fog/aws/requests/storage/head_bucket.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/storage/head_bucket.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/storage/head_bucket.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-3.0.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-2.0.1 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-2.0.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-1.4.1 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-1.4.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-1.3.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-1.2.1 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-1.2.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-1.1.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-1.0.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-0.13.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-0.12.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-0.11.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-0.10.0 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-0.9.4 lib/fog/aws/requests/storage/head_bucket.rb
fog-aws-0.9.3 lib/fog/aws/requests/storage/head_bucket.rb