Sha256: 402a2187f0d2113d7bd99eb60d5082d4f1d18e92dc1160240eb884f55108e423

Contents?: true

Size: 1.23 KB

Versions: 34

Compression:

Stored size: 1.23 KB

Contents

module Fog
  module AWS
    module S3
      class Real

        # Get location constraint for an S3 bucket
        #
        # ==== Parameters
        # * bucket_name<~String> - name of bucket to get location constraint for
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'LocationConstraint'<~String> - Location constraint of the bucket
        def get_bucket_location(bucket_name)
          request({
            :expects  => 200,
            :headers  => {},
            :host     => "#{bucket_name}.#{@host}",
            :idempotent => true,
            :method   => 'GET',
            :parser   => Fog::Parsers::AWS::S3::GetBucketLocation.new,
            :query    => 'location'
          })
        end

      end

      class Mock

        def get_bucket_location(bucket_name)
          response = Excon::Response.new
          if bucket = @data[:buckets][bucket_name]
            response.status = 200
            response.body = {'LocationConstraint' => bucket['LocationConstraint'] }
          else
            response.status = 404
            raise(Excon::Errors.status_error({:expects => 200}, response))
          end
          response
        end

      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
fog-0.1.5 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.1.4 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.1.3 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.1.2 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.1.1 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.1.0 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.100 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.99 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.98 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.97 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.96 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.95 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.94 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.93 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.92 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.91 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.90 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.89 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.88 lib/fog/aws/requests/s3/get_bucket_location.rb
fog-0.0.87 lib/fog/aws/requests/s3/get_bucket_location.rb