Package com.google.cloud.storage.spi.v1
Interface StorageRpc
- All Superinterfaces:
com.google.cloud.ServiceRpc
- All Known Implementing Classes:
HttpStorageRpc,StorageRpcTestBase
@InternalApi
public interface StorageRpc
extends com.google.cloud.ServiceRpc
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic classstatic class -
Method Summary
Modifier and TypeMethodDescriptioncom.google.api.services.storage.model.StorageObjectcompose(Iterable<com.google.api.services.storage.model.StorageObject> sources, com.google.api.services.storage.model.StorageObject target, Map<StorageRpc.Option, ?> targetOptions) Sends a compose request.continueRewrite(StorageRpc.RewriteResponse previousResponse) Continues rewriting on an already open rewrite channel.com.google.api.services.storage.model.Bucketcreate(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Creates a new bucket.com.google.api.services.storage.model.StorageObjectcreate(com.google.api.services.storage.model.StorageObject object, InputStream content, Map<StorageRpc.Option, ?> options) Creates a new storage object.com.google.api.services.storage.model.BucketAccessControlcreateAcl(com.google.api.services.storage.model.BucketAccessControl acl, Map<StorageRpc.Option, ?> options) Creates a new ACL entry on the specified bucket.com.google.api.services.storage.model.ObjectAccessControlcreateAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Creates a new ACL entry on the specified object.Creates an empty batch.com.google.api.services.storage.model.ObjectAccessControlcreateDefaultAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Creates a new default object ACL entry on the specified bucket.com.google.api.services.storage.model.HmacKeycreateHmacKey(String serviceAccountEmail, Map<StorageRpc.Option, ?> options) Creates a new HMAC key for the provided service account email.com.google.api.services.storage.model.NotificationcreateNotification(String bucket, com.google.api.services.storage.model.Notification notification) Creates the notification for a given bucket.booleandelete(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Deletes the requested bucket.booleandelete(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option, ?> options) Deletes the requested storage object.booleanDeletes the ACL entry for the specified entity on the specified object.booleandeleteAcl(String bucket, String entity, Map<StorageRpc.Option, ?> options) Deletes the ACL entry for the specified entity on the specified bucket.booleandeleteDefaultAcl(String bucket, String entity) Deletes the default object ACL entry for the specified entity on the specified bucket.voiddeleteHmacKey(com.google.api.services.storage.model.HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option, ?> options) Deletes the HMAC key associated with the provided metadata object.booleandeleteNotification(String bucket, String id) Deletes the notification with the specified id on the bucket.com.google.api.services.storage.model.Bucketget(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Returns the requested bucket ornullif not found.com.google.api.services.storage.model.StorageObjectget(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option, ?> options) Returns the requested storage object ornullif not found.com.google.api.services.storage.model.ObjectAccessControlReturns the ACL entry for the specified entity on the specified object ornullif not found.com.google.api.services.storage.model.BucketAccessControlgetAcl(String bucket, String entity, Map<StorageRpc.Option, ?> options) Returns the ACL entry for the specified entity on the specified bucket ornullif not found.longgetCurrentUploadOffset(String uploadId) Requests current byte offset from Cloud Storage API.com.google.api.services.storage.model.ObjectAccessControlgetDefaultAcl(String bucket, String entity) Returns the default object ACL entry for the specified entity on the specified bucket ornullif not found.com.google.api.services.storage.model.HmacKeyMetadatagetHmacKey(String accessId, Map<StorageRpc.Option, ?> options) Returns the HMAC key associated with the provided access id.com.google.api.services.storage.model.PolicygetIamPolicy(String bucket, Map<StorageRpc.Option, ?> options) Returns the IAM policy for the specified bucket.com.google.api.services.storage.model.NotificationgetNotification(String bucket, String id) Gets the notification with the specified id.com.google.api.services.storage.model.ServiceAccountgetServiceAccount(String projectId) Returns the service account associated with the given project.com.google.api.services.storage.Storagelist(String bucket, Map<StorageRpc.Option, ?> options) Lists the bucket's blobs.list(Map<StorageRpc.Option, ?> options) Lists the project's buckets.List<com.google.api.services.storage.model.ObjectAccessControl>Lists the ACL entries for the provided object.List<com.google.api.services.storage.model.BucketAccessControl>listAcls(String bucket, Map<StorageRpc.Option, ?> options) Lists the ACL entries for the provided bucket.List<com.google.api.services.storage.model.ObjectAccessControl>listDefaultAcls(String bucket) Lists the default object ACL entries for the provided bucket.listHmacKeys(Map<StorageRpc.Option, ?> options) Lists the HMAC keys for the provided service account email.List<com.google.api.services.storage.model.Notification>listNotifications(String bucket) Retrieves the list of notifications associated with the bucket.byte[]load(com.google.api.services.storage.model.StorageObject storageObject, Map<StorageRpc.Option, ?> options) Reads all the bytes from a storage object.com.google.api.services.storage.model.BucketlockRetentionPolicy(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Lock retention policy for the provided bucket.com.google.api.services.storage.model.StorageObjectmoveObject(String bucket, String sourceObject, String destinationObject, Map<StorageRpc.Option, ?> sourceOptions, Map<StorageRpc.Option, ?> targetOptions) open(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option, ?> options) Opens a resumable upload channel for a given storage object.Opens a resumable upload channel for a given signedURL.openRewrite(StorageRpc.RewriteRequest rewriteRequest) Sends a rewrite request to open a rewrite channel.com.google.api.services.storage.model.Bucketpatch(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Updates bucket information.com.google.api.services.storage.model.StorageObjectpatch(com.google.api.services.storage.model.StorageObject storageObject, Map<StorageRpc.Option, ?> options) Updates the storage object's information.com.google.api.services.storage.model.BucketAccessControlpatchAcl(com.google.api.services.storage.model.BucketAccessControl acl, Map<StorageRpc.Option, ?> options) Updates an ACL entry on the specified bucket.com.google.api.services.storage.model.ObjectAccessControlpatchAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Updates an ACL entry on the specified object.com.google.api.services.storage.model.ObjectAccessControlpatchDefaultAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Updates a default object ACL entry on the specified bucket.com.google.api.services.storage.model.StorageObjectqueryCompletedResumableUpload(String uploadId, long totalBytes) Attempts to retrieve the StorageObject from a completed resumable upload.com.google.cloud.Tuple<String,byte[]> read(com.google.api.services.storage.model.StorageObject from, Map<StorageRpc.Option, ?> options, long position, int bytes) Reads the given amount of bytes from a storage object at the given position.longread(com.google.api.services.storage.model.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.com.google.api.services.storage.model.StorageObjectrestore(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option, ?> options) If an object has been soft-deleted, restores it and returns the restored object.jcom.google.api.services.storage.model.PolicysetIamPolicy(String bucket, com.google.api.services.storage.model.Policy policy, Map<StorageRpc.Option, ?> options) Updates the IAM policy for the specified bucket.com.google.api.services.storage.model.TestIamPermissionsResponsetestIamPermissions(String bucket, List<String> permissions, Map<StorageRpc.Option, ?> options) Tests whether the caller holds the specified permissions for the specified bucket.com.google.api.services.storage.model.HmacKeyMetadataupdateHmacKey(com.google.api.services.storage.model.HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option, ?> options) Updates an HMAC key for the provided metadata object and returns the updated object.voidwrite(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last) Writes the provided bytes to a storage object at the provided location.com.google.api.services.storage.model.StorageObjectwriteWithResponse(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last) Writes the provided bytes to a storage object at the provided location.
-
Method Details
-
create
com.google.api.services.storage.model.Bucket create(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Creates a new bucket.- Throws:
StorageException- upon failure
-
create
com.google.api.services.storage.model.StorageObject create(com.google.api.services.storage.model.StorageObject object, InputStream content, Map<StorageRpc.Option, ?> options) Creates a new storage object.- Throws:
StorageException- upon failure
-
list
com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.Bucket>> list(Map<StorageRpc.Option, ?> options) Lists the project's buckets.- Throws:
StorageException- upon failure
-
list
com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.StorageObject>> list(String bucket, Map<StorageRpc.Option, ?> options) Lists the bucket's blobs.- Throws:
StorageException- upon failure
-
get
com.google.api.services.storage.model.Bucket get(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Returns the requested bucket ornullif not found.- Throws:
StorageException- upon failure
-
get
com.google.api.services.storage.model.StorageObject get(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option, ?> options) Returns the requested storage object ornullif not found.- Throws:
StorageException- upon failure
-
restore
com.google.api.services.storage.model.StorageObject restore(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option, ?> options) If an object has been soft-deleted, restores it and returns the restored object.j- Throws:
StorageException- upon failure
-
patch
com.google.api.services.storage.model.Bucket patch(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Updates bucket information.- Throws:
StorageException- upon failure
-
patch
com.google.api.services.storage.model.StorageObject patch(com.google.api.services.storage.model.StorageObject storageObject, Map<StorageRpc.Option, ?> options) Updates the storage object's information. Original metadata are merged with metadata in the providedstorageObject.- Throws:
StorageException- upon failure
-
delete
boolean delete(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Deletes the requested bucket.- Returns:
trueif the bucket was deleted,falseif it was not found- Throws:
StorageException- upon failure
-
delete
boolean delete(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option, ?> options) Deletes the requested storage object.- Returns:
trueif the storage object was deleted,falseif it was not found- Throws:
StorageException- upon failure
-
createBatch
RpcBatch createBatch()Creates an empty batch. -
compose
com.google.api.services.storage.model.StorageObject compose(Iterable<com.google.api.services.storage.model.StorageObject> sources, com.google.api.services.storage.model.StorageObject target, Map<StorageRpc.Option, ?> targetOptions) Sends a compose request.- Throws:
StorageException- upon failure
-
load
byte[] load(com.google.api.services.storage.model.StorageObject storageObject, Map<StorageRpc.Option, ?> options) Reads all the bytes from a storage object.- Throws:
StorageException- upon failure
-
read
com.google.cloud.Tuple<String,byte[]> read(com.google.api.services.storage.model.StorageObject from, Map<StorageRpc.Option, ?> options, long position, int bytes) Reads the given amount of bytes from a storage object at the given position.- Throws:
StorageException- upon failure
-
read
long read(com.google.api.services.storage.model.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.- Returns:
- number of bytes downloaded, returns 0 if position higher than length.
- Throws:
StorageException- upon failure
-
open
String open(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option, ?> options) Opens a resumable upload channel for a given storage object.- Throws:
StorageException- upon failure
-
open
Opens a resumable upload channel for a given signedURL.- Throws:
StorageException- upon failure
-
write
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.- Throws:
StorageException- upon failure
-
getCurrentUploadOffset
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.- Parameters:
uploadId- resumable upload ID URL- Throws:
StorageException- upon failure
-
queryCompletedResumableUpload
com.google.api.services.storage.model.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:
uploadId- resumable upload ID URLtotalBytes- the total number of bytes that should have been written.- Throws:
StorageException- if the upload is incomplete or does not exist
-
writeWithResponse
com.google.api.services.storage.model.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. Iflast=truereturns metadata of the updated object, otherwise returns null.- Parameters:
uploadId- resumable upload IDtoWrite- a portion of the contenttoWriteOffset- starting position in thetoWritearraydestOffset- starting position in the destination datalength- the number of bytes to be uploadedlast- true, iftoWriteis the final content portion- Returns:
- Throws:
StorageException- upon failure
-
moveObject
com.google.api.services.storage.model.StorageObject moveObject(String bucket, String sourceObject, String destinationObject, Map<StorageRpc.Option, ?> sourceOptions, Map<StorageRpc.Option, ?> targetOptions) -
openRewrite
Sends a rewrite request to open a rewrite channel.- Throws:
StorageException- upon failure
-
continueRewrite
Continues rewriting on an already open rewrite channel.- Throws:
StorageException- upon failure
-
getAcl
com.google.api.services.storage.model.BucketAccessControl getAcl(String bucket, String entity, Map<StorageRpc.Option, ?> options) Returns the ACL entry for the specified entity on the specified bucket ornullif not found.- Throws:
StorageException- upon failure
-
deleteAcl
Deletes the ACL entry for the specified entity on the specified bucket.- Returns:
trueif the ACL was deleted,falseif it was not found- Throws:
StorageException- upon failure
-
createAcl
com.google.api.services.storage.model.BucketAccessControl createAcl(com.google.api.services.storage.model.BucketAccessControl acl, Map<StorageRpc.Option, ?> options) Creates a new ACL entry on the specified bucket.- Throws:
StorageException- upon failure
-
patchAcl
com.google.api.services.storage.model.BucketAccessControl patchAcl(com.google.api.services.storage.model.BucketAccessControl acl, Map<StorageRpc.Option, ?> options) Updates an ACL entry on the specified bucket.- Throws:
StorageException- upon failure
-
listAcls
List<com.google.api.services.storage.model.BucketAccessControl> listAcls(String bucket, Map<StorageRpc.Option, ?> options) Lists the ACL entries for the provided bucket.- Throws:
StorageException- upon failure
-
getDefaultAcl
com.google.api.services.storage.model.ObjectAccessControl getDefaultAcl(String bucket, String entity) Returns the default object ACL entry for the specified entity on the specified bucket ornullif not found.- Throws:
StorageException- upon failure
-
deleteDefaultAcl
Deletes the default object ACL entry for the specified entity on the specified bucket.- Returns:
trueif the ACL was deleted,falseif it was not found- Throws:
StorageException- upon failure
-
createDefaultAcl
com.google.api.services.storage.model.ObjectAccessControl createDefaultAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Creates a new default object ACL entry on the specified bucket.- Throws:
StorageException- upon failure
-
patchDefaultAcl
com.google.api.services.storage.model.ObjectAccessControl patchDefaultAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Updates a default object ACL entry on the specified bucket.- Throws:
StorageException- upon failure
-
listDefaultAcls
Lists the default object ACL entries for the provided bucket.- Throws:
StorageException- upon failure
-
getAcl
com.google.api.services.storage.model.ObjectAccessControl getAcl(String bucket, String object, Long generation, String entity) Returns the ACL entry for the specified entity on the specified object ornullif not found.- Throws:
StorageException- upon failure
-
deleteAcl
Deletes the ACL entry for the specified entity on the specified object.- Returns:
trueif the ACL was deleted,falseif it was not found- Throws:
StorageException- upon failure
-
createAcl
com.google.api.services.storage.model.ObjectAccessControl createAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Creates a new ACL entry on the specified object.- Throws:
StorageException- upon failure
-
patchAcl
com.google.api.services.storage.model.ObjectAccessControl patchAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Updates an ACL entry on the specified object.- Throws:
StorageException- upon failure
-
listAcls
List<com.google.api.services.storage.model.ObjectAccessControl> listAcls(String bucket, String object, Long generation) Lists the ACL entries for the provided object.- Throws:
StorageException- upon failure
-
createHmacKey
com.google.api.services.storage.model.HmacKey createHmacKey(String serviceAccountEmail, Map<StorageRpc.Option, ?> options) Creates a new HMAC key for the provided service account email.- Throws:
StorageException- upon failure
-
listHmacKeys
com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.HmacKeyMetadata>> listHmacKeys(Map<StorageRpc.Option, ?> options) Lists the HMAC keys for the provided service account email.- Throws:
StorageException- upon failure
-
updateHmacKey
com.google.api.services.storage.model.HmacKeyMetadata updateHmacKey(com.google.api.services.storage.model.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.- Throws:
StorageException- upon failure
-
getHmacKey
com.google.api.services.storage.model.HmacKeyMetadata getHmacKey(String accessId, Map<StorageRpc.Option, ?> options) Returns the HMAC key associated with the provided access id.- Throws:
StorageException- upon failure
-
deleteHmacKey
void deleteHmacKey(com.google.api.services.storage.model.HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option, ?> options) Deletes the HMAC key associated with the provided metadata object.- Throws:
StorageException- upon failure
-
getIamPolicy
com.google.api.services.storage.model.Policy getIamPolicy(String bucket, Map<StorageRpc.Option, ?> options) Returns the IAM policy for the specified bucket.- Throws:
StorageException- upon failure
-
setIamPolicy
com.google.api.services.storage.model.Policy setIamPolicy(String bucket, com.google.api.services.storage.model.Policy policy, Map<StorageRpc.Option, ?> options) Updates the IAM policy for the specified bucket.- Throws:
StorageException- upon failure
-
testIamPermissions
com.google.api.services.storage.model.TestIamPermissionsResponse testIamPermissions(String bucket, List<String> permissions, Map<StorageRpc.Option, ?> options) Tests whether the caller holds the specified permissions for the specified bucket.- Throws:
StorageException- upon failure
-
deleteNotification
Deletes the notification with the specified id on the bucket.- Returns:
trueif the notification has been deleted,falseif not found- Throws:
StorageException- upon failure
-
listNotifications
Retrieves the list of notifications associated with the bucket.- Returns:
- a list of
Notificationobjects that exist on the bucket. - Throws:
StorageException- upon failure
-
createNotification
com.google.api.services.storage.model.Notification createNotification(String bucket, com.google.api.services.storage.model.Notification notification) Creates the notification for a given bucket.- Returns:
- the created notification.
- Throws:
StorageException- upon failure
-
getNotification
Gets the notification with the specified id.- Returns:
- the
Notificationobject with the given id ornullif not found - Throws:
StorageException- upon failure
-
lockRetentionPolicy
com.google.api.services.storage.model.Bucket lockRetentionPolicy(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Lock retention policy for the provided bucket.- Returns:
- a
Bucketobject of the locked bucket - Throws:
StorageException- upon failure
-
getServiceAccount
Returns the service account associated with the given project.- Returns:
- the ID of the project to fetch the service account for.
- Throws:
StorageException- upon failure
-
getStorage
@InternalApi com.google.api.services.storage.Storage getStorage()
-