2009-08-02 19:37:54 -04:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class S3
|
|
|
|
|
|
|
|
def buckets
|
|
|
|
Fog::AWS::S3::Buckets.new(:connection => self)
|
|
|
|
end
|
|
|
|
|
|
|
|
class Buckets < Fog::Collection
|
|
|
|
|
|
|
|
def all
|
|
|
|
data = connection.get_service.body
|
2009-08-04 13:51:54 -04:00
|
|
|
owner = Fog::AWS::S3::Owner.new(data.delete('Owner').merge!(:connection => connection))
|
2009-08-02 19:37:54 -04:00
|
|
|
buckets = []
|
|
|
|
data['Buckets'].each do |bucket|
|
|
|
|
buckets << Fog::AWS::S3::Bucket.new({
|
|
|
|
:connection => connection,
|
|
|
|
:owner => owner
|
2009-08-04 13:51:54 -04:00
|
|
|
}.merge!(bucket))
|
2009-08-02 19:37:54 -04:00
|
|
|
end
|
|
|
|
buckets
|
|
|
|
end
|
|
|
|
|
2009-08-04 01:50:52 -04:00
|
|
|
def create(attributes = {})
|
|
|
|
bucket = new(attributes)
|
|
|
|
bucket.save
|
|
|
|
bucket
|
|
|
|
end
|
|
|
|
|
|
|
|
def new(attributes = {})
|
|
|
|
Fog::AWS::S3::Bucket.new(attributes.merge!(:connection => connection))
|
|
|
|
end
|
|
|
|
|
2009-08-02 19:37:54 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|