Class: Fog::AWS::S3::Bucket
- Inherits:
-
Model
- Object
- Model
- Fog::AWS::S3::Bucket
show all
- Defined in:
- lib/fog/aws/models/s3/bucket.rb
Instance Attribute Summary
Attributes inherited from Model
#connection
Instance Method Summary
collapse
Methods inherited from Model
#_dump, _load, aliases, attribute, attributes, #attributes, #collection, identity, #identity, #initialize, #inspect, #merge_attributes, #new_record?, #reload, #requires, #wait_for
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
12
13
14
15
16
17
18
19
|
# File 'lib/fog/aws/models/s3/bucket.rb', line 12
def destroy
requires :name
connection.delete_bucket(@name)
true
rescue Excon::Errors::NotFound
false
end
|
21
22
23
24
25
26
|
# File 'lib/fog/aws/models/s3/bucket.rb', line 21
def location
requires :name
data = connection.get_bucket_location(@name)
data.body['LocationConstraint']
end
|
#location=(new_location) ⇒ Object
28
29
30
|
# File 'lib/fog/aws/models/s3/bucket.rb', line 28
def location=(new_location)
@location = new_location
end
|
32
33
34
35
36
37
38
39
|
# File 'lib/fog/aws/models/s3/bucket.rb', line 32
def objects
@objects ||= begin
Fog::AWS::S3::Objects.new(
:bucket => self,
:connection => connection
)
end
end
|
41
42
43
44
45
46
|
# File 'lib/fog/aws/models/s3/bucket.rb', line 41
def payer
requires :name
data = connection.get_request_payment(@name)
data.body['Payer']
end
|
#payer=(new_payer) ⇒ Object
48
49
50
51
52
53
|
# File 'lib/fog/aws/models/s3/bucket.rb', line 48
def payer=(new_payer)
requires :name
connection.put_request_payment(@name, new_payer)
@payer = new_payer
end
|
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/fog/aws/models/s3/bucket.rb', line 55
def save
requires :name
options = {}
if @location
options['LocationConstraint'] = @location
end
connection.put_bucket(@name, options)
true
end
|