Example of getting a blob of a specific in the bucket. + * + *
{@code + * String blobName = "my_blob_name"; + * long generation = 42; + * Blob blob = bucket.get(blobName, generation); + * }+ * + * @param blob name of the requested blob + * @param generation the generation to get + * @param options blob search options + * @throws StorageException upon failure + */ + @TransportCompatibility({Transport.HTTP, Transport.GRPC}) + public Blob get(String blob, Long generation, BlobGetOption... options) { + return storage.get(BlobId.of(getName(), blob, generation), options); + } + /** * Returns a list of requested blobs in this bucket. Blobs that do not exist are null. * diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java index af3e4436e..323555922 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java @@ -120,6 +120,8 @@ public class BucketInfo implements Serializable { private final ObjectRetention objectRetention; private final HierarchicalNamespace hierarchicalNamespace; + private final SoftDeletePolicy softDeletePolicy; + private final transient ImmutableSet
Example of restoring an object. + * + *
{@code + * String bucketName = "my-unique-bucket"; + * String blobName = "my-blob-name"; + * long generation = 42; + * BlobId blobId = BlobId.of(bucketName, blobName, gen); + * Blob blob = storage.restore(blobId); + * }+ */ + @TransportCompatibility({Transport.HTTP, Transport.GRPC}) + Blob restore(BlobId blob, BlobRestoreOption... options); + /** * Lists the project's buckets. * diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java index 9af54fee2..a5df68b83 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java @@ -341,6 +341,24 @@ public Blob get(BlobId blob) { return get(blob, new BlobGetOption[0]); } + @Override + public Blob restore(BlobId blob, BlobRestoreOption... options) { + ImmutableMap