Sha256: c4701cd2b3e7a9c101f435406c43265eb0dcaae702cae8ca252e492358c70329

Contents?: true

Size: 1.42 KB

Versions: 24

Compression:

Stored size: 1.42 KB

Contents

unless Fog.mocking?

  module Fog
    module AWS
      class S3

        # List information about S3 buckets for authorized user
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'Buckets'<~Hash>:
        #       * 'Name'<~String> - Name of bucket
        #       * 'CreationTime'<~Time> - Timestamp of bucket creation
        #     * 'Owner'<~Hash>:
        #       * 'DisplayName'<~String> - Display name of bucket owner
        #       * 'ID'<~String> - Id of bucket owner
        def get_service
          request({
            :expects  => 200,
            :headers  => {},
            :host     => @host,
            :idempotent => true,
            :method   => 'GET',
            :parser   => Fog::Parsers::AWS::S3::GetService.new,
            :url      => @host
          })
        end

      end
    end
  end

else

  module Fog
    module AWS
      class S3

        def get_service
          response = Excon::Response.new
          response.headers['Status'] = 200
          buckets = Fog::AWS::S3.data[:buckets].values.map do |bucket|
            bucket.reject do |key, value|
              !['CreationDate', 'Name'].include?(key)
            end
          end
          response.body = {
            'Buckets' => buckets,
            'Owner'   => { 'DisplayName' => 'owner', 'ID' => 'some_id'}
          }
          response
        end

      end
    end
  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
fog-0.0.56 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.55 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.54 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.53 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.52 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.51 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.50 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.49 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.48 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.47 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.46 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.45 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.44 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.43 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.42 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.41 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.40 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.39 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.38 lib/fog/aws/requests/s3/get_service.rb
fog-0.0.37 lib/fog/aws/requests/s3/get_service.rb