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 Classes
    Modifier and Type
    Interface
    Description
    static enum 
     
    static class 
     
    static class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    Continues rewriting on an already open rewrite channel.
    com.google.api.services.storage.model.Bucket
    create(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option,?> options)
    Creates a new bucket.
    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.
    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.
    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.
    Creates an empty batch.
    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.
    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.
    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.
    boolean
    delete(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option,?> options)
    Deletes the requested bucket.
    boolean
    delete(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option,?> options)
    Deletes the requested storage object.
    boolean
    deleteAcl(String bucket, String object, Long generation, String entity)
    Deletes the ACL entry for the specified entity on the specified object.
    boolean
    deleteAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)
    Deletes the ACL entry for the specified entity on the specified bucket.
    boolean
    deleteDefaultAcl(String bucket, String entity)
    Deletes the default object ACL entry for the specified entity on the specified bucket.
    void
    deleteHmacKey(com.google.api.services.storage.model.HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option,?> options)
    Deletes the HMAC key associated with the provided metadata object.
    boolean
    Deletes the notification with the specified id on the bucket.
    com.google.api.services.storage.model.Bucket
    get(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option,?> options)
    Returns the requested bucket or null if not found.
    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 or null if not found.
    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 or null if not found.
    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 or null if not found.
    long
    Requests current byte offset from Cloud Storage API.
    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 or null if not found.
    com.google.api.services.storage.model.HmacKeyMetadata
    getHmacKey(String accessId, Map<StorageRpc.Option,?> options)
    Returns the HMAC key associated with the provided access id.
    com.google.api.services.storage.model.Policy
    Returns the IAM policy for the specified bucket.
    com.google.api.services.storage.model.Notification
    Gets the notification with the specified id.
    com.google.api.services.storage.model.ServiceAccount
    Returns the service account associated with the given project.
    com.google.api.services.storage.Storage
     
    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.
    com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.Bucket>>
    Lists the project's buckets.
    List<com.google.api.services.storage.model.ObjectAccessControl>
    listAcls(String bucket, String object, Long generation)
    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>
    Lists the default object ACL entries for the provided bucket.
    com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.HmacKeyMetadata>>
    Lists the HMAC keys for the provided service account email.
    List<com.google.api.services.storage.model.Notification>
    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.Bucket
    lockRetentionPolicy(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option,?> options)
    Lock retention policy for the provided bucket.
    open(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option,?> options)
    Opens a resumable upload channel for a given storage object.
    open(String signedURL)
    Opens a resumable upload channel for a given signedURL.
    Sends a rewrite request to open a rewrite channel.
    com.google.api.services.storage.model.Bucket
    patch(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option,?> options)
    Updates bucket information.
    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.
    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.
    com.google.api.services.storage.model.ObjectAccessControl
    patchAcl(com.google.api.services.storage.model.ObjectAccessControl acl)
    Updates an ACL entry on the specified object.
    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.
    com.google.api.services.storage.model.StorageObject
    queryCompletedResumableUpload(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.
    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.
    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
    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.
    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.
    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.
    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.
    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.
  • 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 or null if 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 or null if 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 provided storageObject.
      Throws:
      StorageException - upon failure
    • delete

      boolean delete(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option,?> options)
      Deletes the requested bucket.
      Returns:
      true if the bucket was deleted, false if 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:
      true if the storage object was deleted, false if 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

      String open(String signedURL)
      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

      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.
      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 URL
      totalBytes - 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. If last=true returns metadata of the updated object, otherwise returns null.
      Parameters:
      uploadId - resumable upload ID
      toWrite - a portion of the content
      toWriteOffset - starting position in the toWrite array
      destOffset - starting position in the destination data
      length - the number of bytes to be uploaded
      last - true, if toWrite is the final content portion
      Returns:
      Throws:
      StorageException - upon failure
    • openRewrite

      Sends a rewrite request to open a rewrite channel.
      Throws:
      StorageException - upon failure
    • continueRewrite

      StorageRpc.RewriteResponse continueRewrite(StorageRpc.RewriteResponse previousResponse)
      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 or null if not found.
      Throws:
      StorageException - upon failure
    • deleteAcl

      boolean deleteAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)
      Deletes the ACL entry for the specified entity on the specified bucket.
      Returns:
      true if the ACL was deleted, false if 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 or null if not found.
      Throws:
      StorageException - upon failure
    • deleteDefaultAcl

      boolean deleteDefaultAcl(String bucket, String entity)
      Deletes the default object ACL entry for the specified entity on the specified bucket.
      Returns:
      true if the ACL was deleted, false if 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

      List<com.google.api.services.storage.model.ObjectAccessControl> listDefaultAcls(String bucket)
      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 or null if not found.
      Throws:
      StorageException - upon failure
    • deleteAcl

      boolean deleteAcl(String bucket, String object, Long generation, String entity)
      Deletes the ACL entry for the specified entity on the specified object.
      Returns:
      true if the ACL was deleted, false if 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

      boolean deleteNotification(String bucket, String id)
      Deletes the notification with the specified id on the bucket.
      Returns:
      true if the notification has been deleted, false if not found
      Throws:
      StorageException - upon failure
    • listNotifications

      List<com.google.api.services.storage.model.Notification> listNotifications(String bucket)
      Retrieves the list of notifications associated with the bucket.
      Returns:
      a list of Notification objects 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

      com.google.api.services.storage.model.Notification getNotification(String bucket, String id)
      Gets the notification with the specified id.
      Returns:
      the Notification object with the given id or null if 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 Bucket object of the locked bucket
      Throws:
      StorageException - upon failure
    • getServiceAccount

      com.google.api.services.storage.model.ServiceAccount getServiceAccount(String projectId)
      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()