Interface StorageRpc (2.20.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
NameDescription
sourcesIterable<com.google.api.services.storage.model.StorageObject>
targetcom.google.api.services.storage.model.StorageObject
targetOptionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
previousResponseStorageRpc.RewriteResponse
Returns
TypeDescription
StorageRpc.RewriteResponse

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

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

Creates a new bucket.

Parameters
NameDescription
bucketcom.google.api.services.storage.model.Bucket
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
objectcom.google.api.services.storage.model.StorageObject
contentInputStream
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
aclcom.google.api.services.storage.model.BucketAccessControl
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
aclcom.google.api.services.storage.model.ObjectAccessControl
Returns
TypeDescription
com.google.api.services.storage.model.ObjectAccessControl

createBatch()

public abstract RpcBatch createBatch()

Creates an empty batch.

Returns
TypeDescription
RpcBatch

createDefaultAcl(ObjectAccessControl acl)

public abstract ObjectAccessControl createDefaultAcl(ObjectAccessControl acl)

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

Parameter
NameDescription
aclcom.google.api.services.storage.model.ObjectAccessControl
Returns
TypeDescription
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
NameDescription
serviceAccountEmailString
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketString
notificationcom.google.api.services.storage.model.Notification
Returns
TypeDescription
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
NameDescription
bucketcom.google.api.services.storage.model.Bucket
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
objectcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketString
objectString
generationLong
entityString
Returns
TypeDescription
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
NameDescription
bucketString
entityString
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketString
entityString
Returns
TypeDescription
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
NameDescription
hmacKeyMetadatacom.google.api.services.storage.model.HmacKeyMetadata
optionsMap<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
NameDescription
bucketString
idString
Returns
TypeDescription
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
NameDescription
bucketcom.google.api.services.storage.model.Bucket
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
objectcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketString
objectString
generationLong
entityString
Returns
TypeDescription
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
NameDescription
bucketString
entityString
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
uploadIdString

resumable upload ID URL

Returns
TypeDescription
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
NameDescription
bucketString
entityString
Returns
TypeDescription
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
NameDescription
accessIdString
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketString
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketString
idString
Returns
TypeDescription
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
NameDescription
projectIdString
Returns
TypeDescription
com.google.api.services.storage.model.ServiceAccount

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

getStorage()

public abstract Storage getStorage()
Returns
TypeDescription
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
NameDescription
bucketString
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketString
objectString
generationLong
Returns
TypeDescription
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
NameDescription
bucketString
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketString
Returns
TypeDescription
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
NameDescription
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketString
Returns
TypeDescription
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
NameDescription
storageObjectcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketcom.google.api.services.storage.model.Bucket
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
objectcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
Returns
TypeDescription
String

open(String signedURL)

public abstract String open(String signedURL)

Opens a resumable upload channel for a given signedURL.

Parameter
NameDescription
signedURLString
Returns
TypeDescription
String

openRewrite(StorageRpc.RewriteRequest rewriteRequest)

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

Sends a rewrite request to open a rewrite channel.

Parameter
NameDescription
rewriteRequestStorageRpc.RewriteRequest
Returns
TypeDescription
StorageRpc.RewriteResponse

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

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

Updates bucket information.

Parameters
NameDescription
bucketcom.google.api.services.storage.model.Bucket
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
storageObjectcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
aclcom.google.api.services.storage.model.BucketAccessControl
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
aclcom.google.api.services.storage.model.ObjectAccessControl
Returns
TypeDescription
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
NameDescription
aclcom.google.api.services.storage.model.ObjectAccessControl
Returns
TypeDescription
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
NameDescription
uploadIdString

resumable upload ID URL

totalByteslong

the total number of bytes that should have been written.

Returns
TypeDescription
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
NameDescription
fromcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
positionlong
bytesint
Returns
TypeDescription
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
NameDescription
fromcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
positionlong
outputStreamOutputStream
Returns
TypeDescription
long

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

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
NameDescription
bucketString
policycom.google.api.services.storage.model.Policy
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
bucketString
permissionsList<String>
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
hmacKeyMetadatacom.google.api.services.storage.model.HmacKeyMetadata
optionsMap<Option,?>
Returns
TypeDescription
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
NameDescription
uploadIdString
toWritebyte[]
toWriteOffsetint
destOffsetlong
lengthint
lastboolean

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
NameDescription
uploadIdString

resumable upload ID

toWritebyte[]

a portion of the content

toWriteOffsetint

starting position in the toWrite array

destOffsetlong

starting position in the destination data

lengthint

the number of bytes to be uploaded

lastboolean

true, if toWrite is the final content portion

Returns
TypeDescription
com.google.api.services.storage.model.StorageObject