Class: Fog::AWS::S3::Directory

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/s3/directory.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

#destroyObject



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

def destroy
  requires :name
  connection.delete_bucket(@name)
  true
rescue Excon::Errors::NotFound
  false
end

#filesObject



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

def files
  @files ||= begin
    Fog::AWS::S3::Files.new(
      :directory    => self,
      :connection   => connection
    )
  end
end

#locationObject



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

def location
  requires :name
  data = connection.get_bucket_location(@name)
  data.body['LocationConstraint']
end

#location=(new_location) ⇒ Object



25
26
27
# File 'lib/fog/aws/models/s3/directory.rb', line 25

def location=(new_location)
  @location = new_location
end

#payerObject



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

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

#payer=(new_payer) ⇒ Object



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

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

#saveObject



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

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