0
votes

I'm creating a Google Cloud Storage bucket via the JSON API.

I can create it fine, but when I query the meta data for it I can't see any ACL specified, despite asking for "full" access. Another bucket created via the UI I can see all ACL for.

I need to see the ACL as to update a bucket a required field is the buckets ACL, which I don't quite understand why is needed, but without the same bucket giving its ACL data it means I can't update buckets I create.

I assume that I have full write access to the bucket once I create it, and have tried creating it with and without a predefinedAcl.

Is there anything I am missing on why I can't see the ACL on new buckets?

2

2 Answers

0
votes

The creator of the bucket is always an owner of that bucket, and owners of a bucket can always see the bucket's ACL. That said, the ACLs are not part of the default response to a storage.objects.get call. Try passing in the URL query parameter "projection=full", which will cause the ACLs to be included.

The "update" call always sets the absolute, full state of the bucket's metadata, including ACLs and everything else. If you're looking to simply modify some property of the bucket, the "patch" call is probably what you want to use.

0
votes

The ACL isn't returned because its just not present for the bucket. But to do updates, you can simply pass an empty list to the PATCH method and it will work, even though the acl field is still required:

PUT https://www.googleapis.com/storage/v1/b/blahblahblxxxxlifecycle?key={YOUR_API_KEY}


{
 "acl": [
 ],
 "kind": "storage#bucket",
 "id": "blahblahblxxxxlifecycle",
 "selfLink": "https://www.googleapis.com/storage/v1/b/blahblahblahffflifecycle",
 "projectNumber": "1080525199262",
 "name": "blahblahblxxxxlifecycle",
 "timeCreated": "2016-09-09T21:20:56.490Z",
 "updated": "2016-09-09T21:20:56.490Z",
 "metageneration": "1",
 "location": "US",
 "versioning": {
  "enabled": true
 },
 "storageClass": "STANDARD",
 "etag": "CAE="
}