Skip to content

Commit 557a5f3

Browse files
committed
---
yaml --- r: 1735 b: refs/heads/master c: 21e68cc h: refs/heads/master i: 1733: 2f8f896 1731: 11a5a14 1727: 7ffb4e4
1 parent 1e4c0ce commit 557a5f3

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: bbe7b500a63bd7bce92e73a13cdb097265b85092
2+
refs/heads/master: 21e68cce2c133463fcc4d74e06e3114c5e25ef65
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: d1b373c30c176edc08692348167bec3a244bb823
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3

trunk/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,16 @@ public static BlobListOption recursive(boolean recursive) {
700700
return new BlobListOption(StorageRpc.Option.DELIMITER, recursive);
701701
}
702702

703+
/**
704+
* If set to {@code true}, lists all versions of a blob.
705+
* The default is {@code false}.
706+
*
707+
* @see <a href ="https://cloud.google.com/storage/docs/object-versioning">Object Versioning</a>
708+
*/
709+
public static BlobListOption versions(boolean versions) {
710+
return new BlobListOption(StorageRpc.Option.VERSIONS, versions);
711+
}
712+
703713
/**
704714
* Returns an option to specify the blob's fields to be returned by the RPC call. If this option
705715
* is not provided all blob's fields are returned. {@code BlobListOption.fields}) can be used to

trunk/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,14 @@ public class StorageImplTest {
200200
Storage.BlobListOption.prefix("prefix");
201201
private static final Storage.BlobListOption BLOB_LIST_FIELDS =
202202
Storage.BlobListOption.fields(Storage.BlobField.CONTENT_TYPE, Storage.BlobField.MD5HASH);
203+
private static final Storage.BlobListOption BLOB_LIST_VERSIONS =
204+
Storage.BlobListOption.versions(false);
203205
private static final Storage.BlobListOption BLOB_LIST_EMPTY_FIELDS =
204206
Storage.BlobListOption.fields();
205207
private static final Map<StorageRpc.Option, ?> BLOB_LIST_OPTIONS = ImmutableMap.of(
206208
StorageRpc.Option.MAX_RESULTS, BLOB_LIST_MAX_RESULT.value(),
207-
StorageRpc.Option.PREFIX, BLOB_LIST_PREFIX.value());
209+
StorageRpc.Option.PREFIX, BLOB_LIST_PREFIX.value(),
210+
StorageRpc.Option.VERSIONS, BLOB_LIST_VERSIONS.value());
208211

209212
private static final String PRIVATE_KEY_STRING = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoG"
210213
+ "BAL2xolH1zrISQ8+GzOV29BNjjzq4/HIP8Psd1+cZb81vDklSF+95wB250MSE0BDc81pvIMwj5OmIfLg1NY6uB"
@@ -650,7 +653,8 @@ public void testListBlobsWithOptions() {
650653
EasyMock.replay(storageRpcMock);
651654
initializeService();
652655
ImmutableList<Blob> blobList = ImmutableList.of(expectedBlob1, expectedBlob2);
653-
Page<Blob> page = storage.list(BUCKET_NAME1, BLOB_LIST_MAX_RESULT, BLOB_LIST_PREFIX);
656+
Page<Blob> page =
657+
storage.list(BUCKET_NAME1, BLOB_LIST_MAX_RESULT, BLOB_LIST_PREFIX, BLOB_LIST_VERSIONS);
654658
assertEquals(cursor, page.nextPageCursor());
655659
assertArrayEquals(blobList.toArray(), Iterables.toArray(page.values(), Blob.class));
656660
}

0 commit comments

Comments
 (0)