Interface StorageRpc (2.45.0)

public interface StorageRpc extends ServiceRpc

Implements

com.google.cloud.ServiceRpc

Methods

compose(Iterable<StorageObject> sources, StorageObject target, Map<StorageRpc.Option,?> targetOptions)

public abstract StorageObject compose(Iterable<StorageObject> sources, StorageObject target, Map<StorageRpc.Option,?> targetOptions)

Sends a compose request.

Parameters
Name Description
sources Iterable<com.google.api.services.storage.model.StorageObject>
target com.google.api.services.storage.model.StorageObject
targetOptions Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.StorageObject

continueRewrite(StorageRpc.RewriteResponse previousResponse)

public abstract StorageRpc.RewriteResponse continueRewrite(StorageRpc.RewriteResponse previousResponse)

Continues rewriting on an already open rewrite channel.

Parameter
Name Description
previousResponse StorageRpc.RewriteResponse
Returns
Type Description
StorageRpc.RewriteResponse

create(Bucket bucket, Map<StorageRpc.Option,?> options)

public abstract Bucket create(Bucket bucket, Map<StorageRpc.Option,?> options)

Creates a new bucket.

Parameters
Name Description
bucket com.google.api.services.storage.model.Bucket
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.Bucket

create(StorageObject object, InputStream content, Map<StorageRpc.Option,?> options)

public abstract StorageObject create(StorageObject object, InputStream content, Map<StorageRpc.Option,?> options)

Creates a new storage object.

Parameters
Name Description
object com.google.api.services.storage.model.StorageObject
content InputStream
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.StorageObject

createAcl(BucketAccessControl acl, Map<StorageRpc.Option,?> options)

public abstract BucketAccessControl createAcl(BucketAccessControl acl, Map<StorageRpc.Option,?> options)

Creates a new ACL entry on the specified bucket.

Parameters
Name Description
acl com.google.api.services.storage.model.BucketAccessControl
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.BucketAccessControl

createAcl(ObjectAccessControl acl)

public abstract ObjectAccessControl createAcl(ObjectAccessControl acl)

Creates a new ACL entry on the specified object.

Parameter
Name Description
acl com.google.api.services.storage.model.ObjectAccessControl
Returns
Type Description
com.google.api.services.storage.model.ObjectAccessControl

createBatch()

public abstract RpcBatch createBatch()

Creates an empty batch.

Returns
Type Description
RpcBatch

createDefaultAcl(ObjectAccessControl acl)

public abstract ObjectAccessControl createDefaultAcl(ObjectAccessControl acl)

Creates a new default object ACL entry on the specified bucket.

Parameter
Name Description
acl com.google.api.services.storage.model.ObjectAccessControl
Returns
Type Description
com.google.api.services.storage.model.ObjectAccessControl

createHmacKey(String serviceAccountEmail, Map<StorageRpc.Option,?> options)

public abstract HmacKey createHmacKey(String serviceAccountEmail, Map<StorageRpc.Option,?> options)

Creates a new HMAC key for the provided service account email.

Parameters
Name Description
serviceAccountEmail String
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.HmacKey

createNotification(String bucket, Notification notification)

public abstract Notification createNotification(String bucket, Notification notification)

Creates the notification for a given bucket.

Parameters
Name Description
bucket String
notification com.google.api.services.storage.model.Notification
Returns
Type Description
com.google.api.services.storage.model.Notification

the created notification.

delete(Bucket bucket, Map<StorageRpc.Option,?> options)

public abstract boolean delete(Bucket bucket, Map<StorageRpc.Option,?> options)

Deletes the requested bucket.

Parameters
Name Description
bucket com.google.api.services.storage.model.Bucket
options Map<Option,?>
Returns
Type Description
boolean

true if the bucket was deleted, false if it was not found

delete(StorageObject object, Map<StorageRpc.Option,?> options)

public abstract boolean delete(StorageObject object, Map<StorageRpc.Option,?> options)

Deletes the requested storage object.

Parameters
Name Description
object com.google.api.services.storage.model.StorageObject
options Map<Option,?>
Returns
Type Description
boolean

true if the storage object was deleted, false if it was not found

deleteAcl(String bucket, String object, Long generation, String entity)

public abstract boolean deleteAcl(String bucket, String object, Long generation, String entity)

Deletes the ACL entry for the specified entity on the specified object.

Parameters
Name Description
bucket String
object String
generation Long
entity String
Returns
Type Description
boolean

true if the ACL was deleted, false if it was not found

deleteAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)

public abstract boolean deleteAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)

Deletes the ACL entry for the specified entity on the specified bucket.

Parameters
Name Description
bucket String
entity String
options Map<Option,?>
Returns
Type Description
boolean

true if the ACL was deleted, false if it was not found

deleteDefaultAcl(String bucket, String entity)

public abstract boolean deleteDefaultAcl(String bucket, String entity)

Deletes the default object ACL entry for the specified entity on the specified bucket.

Parameters
Name Description
bucket String
entity String
Returns
Type Description
boolean

true if the ACL was deleted, false if it was not found

deleteHmacKey(HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option,?> options)

public abstract void deleteHmacKey(HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option,?> options)

Deletes the HMAC key associated with the provided metadata object.

Parameters
Name Description
hmacKeyMetadata com.google.api.services.storage.model.HmacKeyMetadata
options Map<Option,?>

deleteNotification(String bucket, String id)

public abstract boolean deleteNotification(String bucket, String id)

Deletes the notification with the specified id on the bucket.

Parameters
Name Description
bucket String
id String
Returns
Type Description
boolean

true if the notification has been deleted, false if not found

get(Bucket bucket, Map<StorageRpc.Option,?> options)

public abstract Bucket get(Bucket bucket, Map<StorageRpc.Option,?> options)

Returns the requested bucket or null if not found.

Parameters
Name Description
bucket com.google.api.services.storage.model.Bucket
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.Bucket

get(StorageObject object, Map<StorageRpc.Option,?> options)

public abstract StorageObject get(StorageObject object, Map<StorageRpc.Option,?> options)

Returns the requested storage object or null if not found.

Parameters
Name Description
object com.google.api.services.storage.model.StorageObject
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.StorageObject

getAcl(String bucket, String object, Long generation, String entity)

public abstract ObjectAccessControl getAcl(String bucket, String object, Long generation, String entity)

Returns the ACL entry for the specified entity on the specified object or null if not found.

Parameters
Name Description
bucket String
object String
generation Long
entity String
Returns
Type Description
com.google.api.services.storage.model.ObjectAccessControl

getAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)

public abstract BucketAccessControl getAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)

Returns the ACL entry for the specified entity on the specified bucket or null if not found.

Parameters
Name Description
bucket String
entity String
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.BucketAccessControl

getCurrentUploadOffset(String uploadId)

public abstract long getCurrentUploadOffset(String uploadId)

Requests current byte offset from Cloud Storage API. Used to recover from a failure in some bytes were committed successfully to the open resumable session.

Parameter
Name Description
uploadId String

resumable upload ID URL

Returns
Type Description
long

getDefaultAcl(String bucket, String entity)

public abstract ObjectAccessControl getDefaultAcl(String bucket, String entity)

Returns the default object ACL entry for the specified entity on the specified bucket or null if not found.

Parameters
Name Description
bucket String
entity String
Returns
Type Description
com.google.api.services.storage.model.ObjectAccessControl

getHmacKey(String accessId, Map<StorageRpc.Option,?> options)

public abstract HmacKeyMetadata getHmacKey(String accessId, Map<StorageRpc.Option,?> options)

Returns the HMAC key associated with the provided access id.

Parameters
Name Description
accessId String
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.HmacKeyMetadata

getIamPolicy(String bucket, Map<StorageRpc.Option,?> options)

public abstract Policy getIamPolicy(String bucket, Map<StorageRpc.Option,?> options)

Returns the IAM policy for the specified bucket.

Parameters
Name Description
bucket String
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.Policy

getNotification(String bucket, String id)

public abstract Notification getNotification(String bucket, String id)

Gets the notification with the specified id.

Parameters
Name Description
bucket String
id String
Returns
Type Description
com.google.api.services.storage.model.Notification

the Notification object with the given id or null if not found

getServiceAccount(String projectId)

public abstract ServiceAccount getServiceAccount(String projectId)

Returns the service account associated with the given project.

Parameter
Name Description
projectId String
Returns
Type Description
com.google.api.services.storage.model.ServiceAccount

the ID of the project to fetch the service account for.

getStorage()

public abstract Storage getStorage()
Returns
Type Description
com.google.api.services.storage.Storage

list(String bucket, Map<StorageRpc.Option,?> options)

public abstract Tuple<String,Iterable<StorageObject>> list(String bucket, Map<StorageRpc.Option,?> options)

Lists the bucket's blobs.

Parameters
Name Description
bucket String
options Map<Option,?>
Returns
Type Description
com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.StorageObject>>

list(Map<StorageRpc.Option,?> options)

public abstract Tuple<String,Iterable<Bucket>> list(Map<StorageRpc.Option,?> options)

Lists the project's buckets.

Parameter
Name Description
options Map<Option,?>
Returns
Type Description
com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.Bucket>>

listAcls(String bucket, String object, Long generation)

public abstract List<ObjectAccessControl> listAcls(String bucket, String object, Long generation)

Lists the ACL entries for the provided object.

Parameters
Name Description
bucket String
object String
generation Long
Returns
Type Description
List<com.google.api.services.storage.model.ObjectAccessControl>

listAcls(String bucket, Map<StorageRpc.Option,?> options)

public abstract List<BucketAccessControl> listAcls(String bucket, Map<StorageRpc.Option,?> options)

Lists the ACL entries for the provided bucket.

Parameters
Name Description
bucket String
options Map<Option,?>
Returns
Type Description
List<com.google.api.services.storage.model.BucketAccessControl>

listDefaultAcls(String bucket)

public abstract List<ObjectAccessControl> listDefaultAcls(String bucket)

Lists the default object ACL entries for the provided bucket.

Parameter
Name Description
bucket String
Returns
Type Description
List<com.google.api.services.storage.model.ObjectAccessControl>

listHmacKeys(Map<StorageRpc.Option,?> options)

public abstract Tuple<String,Iterable<HmacKeyMetadata>> listHmacKeys(Map<StorageRpc.Option,?> options)

Lists the HMAC keys for the provided service account email.

Parameter
Name Description
options Map<Option,?>
Returns
Type Description
com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.HmacKeyMetadata>>

listNotifications(String bucket)

public abstract List<Notification> listNotifications(String bucket)

Retrieves the list of notifications associated with the bucket.

Parameter
Name Description
bucket String
Returns
Type Description
List<com.google.api.services.storage.model.Notification>

a list of Notification objects that exist on the bucket.

load(StorageObject storageObject, Map<StorageRpc.Option,?> options)

public abstract byte[] load(StorageObject storageObject, Map<StorageRpc.Option,?> options)

Reads all the bytes from a storage object.

Parameters
Name Description
storageObject com.google.api.services.storage.model.StorageObject
options Map<Option,?>
Returns
Type Description
byte[]

lockRetentionPolicy(Bucket bucket, Map<StorageRpc.Option,?> options)

public abstract Bucket lockRetentionPolicy(Bucket bucket, Map<StorageRpc.Option,?> options)

Lock retention policy for the provided bucket.

Parameters
Name Description
bucket com.google.api.services.storage.model.Bucket
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.Bucket

a Bucket object of the locked bucket

open(StorageObject object, Map<StorageRpc.Option,?> options)

public abstract String open(StorageObject object, Map<StorageRpc.Option,?> options)

Opens a resumable upload channel for a given storage object.

Parameters
Name Description
object com.google.api.services.storage.model.StorageObject
options Map<Option,?>
Returns
Type Description
String

open(String signedURL)

public abstract String open(String signedURL)

Opens a resumable upload channel for a given signedURL.

Parameter
Name Description
signedURL String
Returns
Type Description
String

openRewrite(StorageRpc.RewriteRequest rewriteRequest)

public abstract StorageRpc.RewriteResponse openRewrite(StorageRpc.RewriteRequest rewriteRequest)

Sends a rewrite request to open a rewrite channel.

Parameter
Name Description
rewriteRequest StorageRpc.RewriteRequest
Returns
Type Description
StorageRpc.RewriteResponse

patch(Bucket bucket, Map<StorageRpc.Option,?> options)

public abstract Bucket patch(Bucket bucket, Map<StorageRpc.Option,?> options)

Updates bucket information.

Parameters
Name Description
bucket com.google.api.services.storage.model.Bucket
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.Bucket

patch(StorageObject storageObject, Map<StorageRpc.Option,?> options)

public abstract StorageObject patch(StorageObject storageObject, Map<StorageRpc.Option,?> options)

Updates the storage object's information. Original metadata are merged with metadata in the provided storageObject.

Parameters
Name Description
storageObject com.google.api.services.storage.model.StorageObject
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.StorageObject

patchAcl(BucketAccessControl acl, Map<StorageRpc.Option,?> options)

public abstract BucketAccessControl patchAcl(BucketAccessControl acl, Map<StorageRpc.Option,?> options)

Updates an ACL entry on the specified bucket.

Parameters
Name Description
acl com.google.api.services.storage.model.BucketAccessControl
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.BucketAccessControl

patchAcl(ObjectAccessControl acl)

public abstract ObjectAccessControl patchAcl(ObjectAccessControl acl)

Updates an ACL entry on the specified object.

Parameter
Name Description
acl com.google.api.services.storage.model.ObjectAccessControl
Returns
Type Description
com.google.api.services.storage.model.ObjectAccessControl

patchDefaultAcl(ObjectAccessControl acl)

public abstract ObjectAccessControl patchDefaultAcl(ObjectAccessControl acl)

Updates a default object ACL entry on the specified bucket.

Parameter
Name Description
acl com.google.api.services.storage.model.ObjectAccessControl
Returns
Type Description
com.google.api.services.storage.model.ObjectAccessControl

queryCompletedResumableUpload(String uploadId, long totalBytes)

public abstract StorageObject queryCompletedResumableUpload(String uploadId, long totalBytes)

Attempts to retrieve the StorageObject from a completed resumable upload. When a resumable upload completes, the response will be the up-to-date StorageObject metadata. This up-to-date metadata can then be used to validate the total size of the object along with new generation and other information.

If for any reason, the response to the final PUT to a resumable upload is not received, this method can be used to query for the up-to-date StorageObject. If the upload is complete, this method can be used to access the StorageObject independently from any other liveness or conditional criteria requirements that are otherwise applicable when using #get(StorageObject, Map).

Parameters
Name Description
uploadId String

resumable upload ID URL

totalBytes long

the total number of bytes that should have been written.

Returns
Type Description
com.google.api.services.storage.model.StorageObject

read(StorageObject from, Map<StorageRpc.Option,?> options, long position, int bytes)

public abstract Tuple<String,byte[]> read(StorageObject from, Map<StorageRpc.Option,?> options, long position, int bytes)

Reads the given amount of bytes from a storage object at the given position.

Parameters
Name Description
from com.google.api.services.storage.model.StorageObject
options Map<Option,?>
position long
bytes int
Returns
Type Description
com.google.cloud.Tuple<String,byte[]>

read(StorageObject from, Map<StorageRpc.Option,?> options, long position, OutputStream outputStream)

public abstract long read(StorageObject from, Map<StorageRpc.Option,?> options, long position, OutputStream outputStream)

Reads all the bytes from a storage object at the given position in to outputstream using direct download.

Parameters
Name Description
from com.google.api.services.storage.model.StorageObject
options Map<Option,?>
position long
outputStream OutputStream
Returns
Type Description
long

number of bytes downloaded, returns 0 if position higher than length.

restore(StorageObject object, Map<StorageRpc.Option,?> options)

public abstract StorageObject restore(StorageObject object, Map<StorageRpc.Option,?> options)

If an object has been soft-deleted, restores it and returns the restored object.j

Parameters
Name Description
object com.google.api.services.storage.model.StorageObject
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.StorageObject

setIamPolicy(String bucket, Policy policy, Map<StorageRpc.Option,?> options)

public abstract Policy setIamPolicy(String bucket, Policy policy, Map<StorageRpc.Option,?> options)

Updates the IAM policy for the specified bucket.

Parameters
Name Description
bucket String
policy com.google.api.services.storage.model.Policy
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.Policy

testIamPermissions(String bucket, List<String> permissions, Map<StorageRpc.Option,?> options)

public abstract TestIamPermissionsResponse testIamPermissions(String bucket, List<String> permissions, Map<StorageRpc.Option,?> options)

Tests whether the caller holds the specified permissions for the specified bucket.

Parameters
Name Description
bucket String
permissions List<String>
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.TestIamPermissionsResponse

updateHmacKey(HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option,?> options)

public abstract HmacKeyMetadata updateHmacKey(HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option,?> options)

Updates an HMAC key for the provided metadata object and returns the updated object. Only updates the State field.

Parameters
Name Description
hmacKeyMetadata com.google.api.services.storage.model.HmacKeyMetadata
options Map<Option,?>
Returns
Type Description
com.google.api.services.storage.model.HmacKeyMetadata

write(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last)

public abstract void write(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last)

Writes the provided bytes to a storage object at the provided location.

Parameters
Name Description
uploadId String
toWrite byte[]
toWriteOffset int
destOffset long
length int
last boolean

writeWithResponse(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last)

public abstract StorageObject writeWithResponse(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last)

Writes the provided bytes to a storage object at the provided location. If last=true returns metadata of the updated object, otherwise returns null.

Parameters
Name Description
uploadId String

resumable upload ID

toWrite byte[]

a portion of the content

toWriteOffset int

starting position in the toWrite array

destOffset long

starting position in the destination data

length int

the number of bytes to be uploaded

last boolean

true, if toWrite is the final content portion

Returns
Type Description
com.google.api.services.storage.model.StorageObject