Sha256: 3768d7ea71152ab9f61face819993ceae6f2fb67a6a09f0c454a78d9194a3f1c

Contents?: true

Size: 821 Bytes

Versions: 31

Compression:

Stored size: 821 Bytes

Contents

module S3
  module BucketsExtension
    # Builds new bucket with given name
    def build(name)
      Bucket.send(:new, proxy_owner, name)
    end

    # Finds the bucket with given name (only those which exist and You have access to it)
    # return nil in case Error::NoSuchBucket or Error::ForbiddenBucket
    def find_first(name)
      bucket = build(name)
      bucket.retrieve
    rescue Error::ForbiddenBucket, Error::NoSuchBucket
      nil
    end
    alias :find :find_first

    # Finds all buckets in the service
    def find_all
      proxy_target
    end

    # Destroys all buckets in the service. Doesn't destroy non-empty
    # buckets by default, pass true to force destroy (USE WITH CARE!).
    def destroy_all(force = false)
      proxy_target.each { |bucket| bucket.destroy(force) }
    end
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
s3-0.3.29 lib/s3/buckets_extension.rb
s3-0.3.28 lib/s3/buckets_extension.rb
s3-0.3.27 lib/s3/buckets_extension.rb
s3-0.3.26 lib/s3/buckets_extension.rb
radosgw-s3-1.5 lib/s3/buckets_extension.rb
s3-0.3.25 lib/s3/buckets_extension.rb
radosgw-s3-1.0 lib/s3/buckets_extension.rb
radosgw-s3-0.11 lib/s3/buckets_extension.rb
s3-0.3.24 lib/s3/buckets_extension.rb
radosgw-s3-0.10 lib/s3/buckets_extension.rb
radosgw-s3-0.9 lib/s3/buckets_extension.rb
radosgw-s3-0.8 lib/s3/buckets_extension.rb
radosgw-s3-0.7 lib/s3/buckets_extension.rb
radosgw-s3-0.6 lib/s3/buckets_extension.rb
radosgw-s3-0.5 lib/s3/buckets_extension.rb
radosgw-s3-0.4 lib/s3/buckets_extension.rb
radosgw-s3-0.3 lib/s3/buckets_extension.rb
radosgw-s3-0.2 lib/s3/buckets_extension.rb
radosgw-s3-0.1 lib/s3/buckets_extension.rb
s3-0.3.23 lib/s3/buckets_extension.rb