Patrick Jackson
Patrick Jackson

Reputation: 19446

Change ACL on all objects in bucket with api

Using google cloud storage Api (json or xml, preferably json) is there a way to set the ACLs for all objects in a bucket? I know it is possible to get a list of objects and then iterate and set the ACL for each object individually, but surely there is an easier way. I know with gsutil your can use setacl -R to setacl on entire bucket. How about with the API?? I'm working in Java appengine, but can also use the restful api of course. Any help would be great!

Upvotes: 2

Views: 1132

Answers (1)

fejta
fejta

Reputation: 3121

Existing object ACLs are orthogonal to bucket acls. In order to change the acls for all the objects in a bucket you need to do one of the following:

  1. List all the objects in the bucket and update each object's acl
  2. Use a GroupByEmail or GroupByDomain grant - https://developers.google.com/storage/docs/accesscontrol
  3. Add/remove people from your project team - https://developers.google.com/storage/docs/projects

You can change the membership of your group and team without having to go back and update all your objects.

Upvotes: 5

Related Questions