Sha256: c437a7bb13cbf47c6a84fc6957dca530563c3f4cbf922ab8bb880886f3bba8f4
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
# Example of how to manipulate ACLs (see s3_acl.rb or rdoc for all ACL classes) require File.join(File.dirname(__FILE__), '../../lib/s33r') include S33r include S33r::S3ACL # initialise the client from a config file # (see s3.yaml in examples directory) c = Client.init('/home/ell/.s33r') # bucket whose ACL we're going to manipulate bucket = 'es-test' # get the ACL for the bucket acl = c.get_acl(bucket) # add a new grant to the ACL (allow all users read access) acl.add_grant(Grant.for_group(:all_users, :read)) # remove a grant from the ACL; # note that s33r is able to compare existing grants in # an ACL with newly-minted ones acl.remove_grant(Grant.for_group(:authenticated_users, :read)) # put the ACL back c.set_acl(acl, bucket) # get the ACL for a resource inside the bucket # and make it readable by a specific Amazon customer resource = 'test' # NB this method raises an error if the resource doesn't exist acl = c.get_acl(bucket, resource) # the email address you set here needs to be a valid Amazon customer acl.add_grant(Grant.for_amazon_customer('elliot@example.com', :read)) p c.set_acl(acl, bucket, resource) # short-hand for making a resource public # c.make_public(bucket) # c.make_public(bucket, resource)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
s33r-0.4 | examples/cli/acl_x.rb |
s33r-0.4.2 | examples/cli/acl_x.rb |
s33r-0.4.1 | examples/cli/acl_x.rb |