Reputation: 864
I can create bucket but I do not find how to change bucket's acl when I create it.
I want everyone can read the objects but not write.
To create bucket :
Storage storage = new Storage(......);
storage.buckets().insert(projectName, new Bucket().setName(bucketName)).execute();
I saw that I can use :
new Bucket().setAcl(List<BucketAccessControl>)
How to use .setAcl methode ?
Thx.
Upvotes: 1
Views: 758
Reputation: 67133
I think what you want to do is set the default object ACL for the bucket. This will apply an ACL to all new objects uploaded to the bucket.
To do that, you can use the setPredefinedDefaultObjectAcl method of the Storage.Buckets.Insert operation returned from your storage.buckets().insert
call.
Take a look at the Applying a predefined ACL section of the documentation for the list of predefined ACLs. In this case, you probably want to use publicRead
.
Upvotes: 1