Skip to content

Commit a94764c

Browse files
committed
Update StorageExample class to use new ACL methods
1 parent 93998c7 commit a94764c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

google-cloud-examples/src/main/java/com/google/cloud/examples/storage/StorageExample.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -582,24 +582,18 @@ public void run(Storage storage, Tuple<BlobId, Acl> params) {
582582
System.out.printf("Bucket %s does not exist%n", blobId.bucket());
583583
return;
584584
}
585-
bucket.toBuilder().acl(addAcl(bucket.acl(), acl)).build().update();
585+
acl = bucket.createAcl(acl);
586586
System.out.printf("Added ACL %s to bucket %s%n", acl, blobId.bucket());
587587
} else {
588588
Blob blob = storage.get(blobId);
589589
if (blob == null) {
590590
System.out.printf("Blob %s does not exist%n", blobId);
591591
return;
592592
}
593-
blob.toBuilder().acl(addAcl(blob.acl(), acl)).build().update();
593+
acl = blob.createAcl(acl);
594594
System.out.printf("Added ACL %s to blob %s%n", acl, blobId);
595595
}
596596
}
597-
598-
private static List<Acl> addAcl(List<Acl> acls, Acl newAcl) {
599-
List<Acl> newAcls = new LinkedList<>(acls);
600-
newAcls.add(newAcl);
601-
return newAcls;
602-
}
603597
}
604598

605599
/**

0 commit comments

Comments
 (0)