Skip to content

Commit

Permalink
Update StorageExample class to use new ACL methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Sep 7, 2016
1 parent 93998c7 commit a94764c
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -582,24 +582,18 @@ public void run(Storage storage, Tuple<BlobId, Acl> params) {
System.out.printf("Bucket %s does not exist%n", blobId.bucket());
return;
}
bucket.toBuilder().acl(addAcl(bucket.acl(), acl)).build().update();
acl = bucket.createAcl(acl);
System.out.printf("Added ACL %s to bucket %s%n", acl, blobId.bucket());
} else {
Blob blob = storage.get(blobId);
if (blob == null) {
System.out.printf("Blob %s does not exist%n", blobId);
return;
}
blob.toBuilder().acl(addAcl(blob.acl(), acl)).build().update();
acl = blob.createAcl(acl);
System.out.printf("Added ACL %s to blob %s%n", acl, blobId);
}
}

private static List<Acl> addAcl(List<Acl> acls, Acl newAcl) {
List<Acl> newAcls = new LinkedList<>(acls);
newAcls.add(newAcl);
return newAcls;
}
}

/**
Expand Down

0 comments on commit a94764c

Please sign in to comment.