Module: AWS::S3::ACL::Bucket::ClassMethods

Defined in:
lib/aws/s3/acl.rb

Instance Method Summary collapse

Instance Method Details

#acl(name = nil, policy = nil) ⇒ Object

The acl method is the single point of entry for reading and writing access control list policies for a given bucket.

# Fetch the acl for the 'marcel' bucket
policy = Bucket.acl 'marcel'

# Modify the policy ...
# ...

# Send updated policy back to the S3 servers
Bucket.acl 'marcel', policy

506
507
508
509
510
511
512
513
514
515
516
# File 'lib/aws/s3/acl.rb', line 506

def acl(name = nil, policy = nil)
  if name.is_a?(ACL::Policy)
    policy = name
    name   = nil
  end

  path = path(name) << '?acl'
  respond_with ACL::Policy::Response do
    policy ? put(path, {}, policy.to_xml) : ACL::Policy.new(get(path(name) << '?acl').policy)
  end
end