1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/aws/models/s3/bucket.rb

59 lines
1.2 KiB
Ruby
Raw Normal View History

2009-08-02 16:37:54 -07:00
module Fog
module AWS
class S3
class Bucket < Fog::Model
2009-08-14 09:19:40 -07:00
attr_accessor :creation_date,
:location,
:name,
:owner
2009-08-04 10:51:54 -07:00
def initialize(attributes = {})
remap_attributes(attributes, {
'CreationDate' => :creation_date,
'Name' => :name
})
super
end
2009-08-03 22:50:52 -07:00
def delete
connection.delete_bucket(name)
end
def location
data = s3.get_bucket_location(name)
data.body['LocationConstraint']
2009-08-03 22:50:52 -07:00
end
2009-08-12 22:48:17 -07:00
def objects
2009-08-17 17:06:25 -07:00
Fog::AWS::S3::Objects.new(
:bucket => self,
:connection => connection
)
2009-08-12 22:48:17 -07:00
end
2009-08-03 22:50:52 -07:00
def payer
data = connection.get_request_payment(name)
data.body['Payer']
2009-08-03 22:50:52 -07:00
end
def payer=(new_payer)
connection.put_request_payment(name, new_payer)
2009-08-03 22:54:34 -07:00
@payer = new_payer
2009-08-03 22:50:52 -07:00
end
def save
options = {}
if @location
options['LocationConstraint'] = @location
end
connection.put_bucket(name, options)
end
2009-08-02 16:37:54 -07:00
end
end
end
end