Cloud Storage
Java api reference - https://googleapis.dev/java/google-cloud-storage/latest/index.html

Usages
static Storage storage = StorageOptions.getDefaultInstance().getService();
@Value("${google.storage.bucket}")
private String bucketname;
BlobInfo blobInfo = storage.create(BlobInfo.newBuilder(bucketname, fileName).setContentType(file.getContentType()).setAcl(new ArrayList<>(
Arrays.asList(Acl.of(Acl.User.ofAllUsers(),
Acl.Role.READER)))).build(), file.getInputStream());
Access control lists
JSON API
XML API/gsutil
Description
private
private
Gives the bucket or object owner OWNER
permission for a bucket or object.
bucketOwnerRead
bucket-owner-read
Gives the object owner OWNER
permission, and gives the bucket owner READER
permission. This is used only with objects.
.https://cloud.google.com/storage/docs/access-control/lists#predefined-acl
Avoid setting ACLs that result in inaccessible objects.
An inaccessible object is an object that cannot be downloaded (read) and can only be deleted. This can happen when the owner of an object leaves a project without granting anyone else
OWNER
orREADER
permission on the object. To avoid this problem, you can use thebucket-owner-read
orbucket-owner-full-control
predefined ACLs when you or anyone else uploads objects to your buckets.
Roles
.https://cloud.google.com/storage/docs/access-control/iam-permissions
set permissions with cloud console - https://cloud.google.com/storage/docs/cloud-console#_bucketpermission
Last updated
Was this helpful?