Class: Fog::AWS::S3::Bucket

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/s3/bucket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#inspect, #update_attributes

Constructor Details

#initialize(attributes = {}) ⇒ Bucket

Returns a new instance of Bucket.



12
13
14
15
16
17
18
# File 'lib/fog/aws/models/s3/bucket.rb', line 12

def initialize(attributes = {})
  remap_attributes(attributes, {
    'CreationDate'  => :creation_date,
    'Name'          => :name
  })
  super
end

Instance Attribute Details

#creation_dateObject

Returns the value of attribute creation_date.



7
8
9
# File 'lib/fog/aws/models/s3/bucket.rb', line 7

def creation_date
  @creation_date
end

#locationObject

Returns the value of attribute location.



7
8
9
# File 'lib/fog/aws/models/s3/bucket.rb', line 7

def location
  @location
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/fog/aws/models/s3/bucket.rb', line 7

def name
  @name
end

#ownerObject

Returns the value of attribute owner.



7
8
9
# File 'lib/fog/aws/models/s3/bucket.rb', line 7

def owner
  @owner
end

Instance Method Details

#deleteObject



20
21
22
# File 'lib/fog/aws/models/s3/bucket.rb', line 20

def delete
  connection.delete_bucket(name)
end

#objectsObject



31
32
33
34
35
36
# File 'lib/fog/aws/models/s3/bucket.rb', line 31

def objects
  Fog::AWS::S3::Objects.new(
    :bucket       => self,
    :connection   => connection
  )
end

#payerObject



38
39
40
41
42
43
# File 'lib/fog/aws/models/s3/bucket.rb', line 38

def payer
  @payer ||= begin
    data = connection.get_request_payment(name)
    data.body['Payer']
  end
end

#payer=(new_payer) ⇒ Object



45
46
47
48
# File 'lib/fog/aws/models/s3/bucket.rb', line 45

def payer=(new_payer)
  connection.put_request_payment(name, new_payer)
  @payer = new_payer
end

#saveObject



50
51
52
53
54
55
56
# File 'lib/fog/aws/models/s3/bucket.rb', line 50

def save
  options = {}
  if @location
    options['LocationConstraint'] = @location
  end
  connection.put_bucket(name, options)
end