Package com.google.cloud.storage.spi.v1
Class HttpStorageRpc
java.lang.Object
com.google.cloud.storage.spi.v1.HttpStorageRpc
- All Implemented Interfaces:
com.google.cloud.ServiceRpc,StorageRpc
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.cloud.storage.spi.v1.StorageRpc
StorageRpc.Option, StorageRpc.RewriteRequest, StorageRpc.RewriteResponse -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHttpStorageRpc(StorageOptions options) HttpStorageRpc(StorageOptions options, com.google.api.client.json.JsonFactory jsonFactory) -
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 storageObject, 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 blob, 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 notification) 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 notification) 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 from, 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.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.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.
-
Field Details
-
DEFAULT_PROJECTION
- See Also:
-
NO_ACL_PROJECTION
- See Also:
-
-
Constructor Details
-
HttpStorageRpc
-
HttpStorageRpc
-
-
Method Details
-
getStorage
public com.google.api.services.storage.Storage getStorage()- Specified by:
getStoragein interfaceStorageRpc
-
create
public com.google.api.services.storage.model.Bucket create(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcCreates a new bucket.- Specified by:
createin interfaceStorageRpc
-
create
public com.google.api.services.storage.model.StorageObject create(com.google.api.services.storage.model.StorageObject storageObject, InputStream content, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcCreates a new storage object.- Specified by:
createin interfaceStorageRpc
-
list
public com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.Bucket>> list(Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcLists the project's buckets.- Specified by:
listin interfaceStorageRpc
-
list
public com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.StorageObject>> list(String bucket, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcLists the bucket's blobs.- Specified by:
listin interfaceStorageRpc
-
get
public com.google.api.services.storage.model.Bucket get(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcReturns the requested bucket ornullif not found.- Specified by:
getin interfaceStorageRpc
-
get
public com.google.api.services.storage.model.StorageObject get(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcReturns the requested storage object ornullif not found.- Specified by:
getin interfaceStorageRpc
-
patch
public com.google.api.services.storage.model.Bucket patch(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcUpdates bucket information.- Specified by:
patchin interfaceStorageRpc
-
patch
public com.google.api.services.storage.model.StorageObject patch(com.google.api.services.storage.model.StorageObject storageObject, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcUpdates the storage object's information. Original metadata are merged with metadata in the providedstorageObject.- Specified by:
patchin interfaceStorageRpc
-
delete
public boolean delete(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcDeletes the requested bucket.- Specified by:
deletein interfaceStorageRpc- Returns:
trueif the bucket was deleted,falseif it was not found
-
delete
public boolean delete(com.google.api.services.storage.model.StorageObject blob, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcDeletes the requested storage object.- Specified by:
deletein interfaceStorageRpc- Returns:
trueif the storage object was deleted,falseif it was not found
-
compose
public 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) Description copied from interface:StorageRpcSends a compose request.- Specified by:
composein interfaceStorageRpc
-
load
public byte[] load(com.google.api.services.storage.model.StorageObject from, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcReads all the bytes from a storage object.- Specified by:
loadin interfaceStorageRpc
-
createBatch
Description copied from interface:StorageRpcCreates an empty batch.- Specified by:
createBatchin interfaceStorageRpc
-
read
public long read(com.google.api.services.storage.model.StorageObject from, Map<StorageRpc.Option, ?> options, long position, OutputStream outputStream) Description copied from interface:StorageRpcReads all the bytes from a storage object at the given position in to outputstream using direct download.- Specified by:
readin interfaceStorageRpc- Returns:
- number of bytes downloaded, returns 0 if position higher than length.
-
read
public com.google.cloud.Tuple<String,byte[]> read(com.google.api.services.storage.model.StorageObject from, Map<StorageRpc.Option, ?> options, long position, int bytes) Description copied from interface:StorageRpcReads the given amount of bytes from a storage object at the given position.- Specified by:
readin interfaceStorageRpc
-
write
public void write(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last) Description copied from interface:StorageRpcWrites the provided bytes to a storage object at the provided location.- Specified by:
writein interfaceStorageRpc
-
getCurrentUploadOffset
Description copied from interface:StorageRpcRequests current byte offset from Cloud Storage API. Used to recover from a failure in some bytes were committed successfully to the open resumable session.- Specified by:
getCurrentUploadOffsetin interfaceStorageRpc- Parameters:
uploadId- resumable upload ID URL
-
queryCompletedResumableUpload
public com.google.api.services.storage.model.StorageObject queryCompletedResumableUpload(String uploadId, long totalBytes) Description copied from interface:StorageRpcAttempts 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
StorageRpc.get(StorageObject, Map).- Specified by:
queryCompletedResumableUploadin interfaceStorageRpc- Parameters:
uploadId- resumable upload ID URLtotalBytes- the total number of bytes that should have been written.
-
writeWithResponse
public com.google.api.services.storage.model.StorageObject writeWithResponse(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last) Description copied from interface:StorageRpcWrites the provided bytes to a storage object at the provided location. Iflast=truereturns metadata of the updated object, otherwise returns null.- Specified by:
writeWithResponsein interfaceStorageRpc- 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:
-
open
public String open(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcOpens a resumable upload channel for a given storage object.- Specified by:
openin interfaceStorageRpc
-
open
Description copied from interface:StorageRpcOpens a resumable upload channel for a given signedURL.- Specified by:
openin interfaceStorageRpc
-
openRewrite
Description copied from interface:StorageRpcSends a rewrite request to open a rewrite channel.- Specified by:
openRewritein interfaceStorageRpc
-
continueRewrite
Description copied from interface:StorageRpcContinues rewriting on an already open rewrite channel.- Specified by:
continueRewritein interfaceStorageRpc
-
getAcl
public com.google.api.services.storage.model.BucketAccessControl getAcl(String bucket, String entity, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcReturns the ACL entry for the specified entity on the specified bucket ornullif not found.- Specified by:
getAclin interfaceStorageRpc
-
deleteAcl
Description copied from interface:StorageRpcDeletes the ACL entry for the specified entity on the specified bucket.- Specified by:
deleteAclin interfaceStorageRpc- Returns:
trueif the ACL was deleted,falseif it was not found
-
createAcl
public com.google.api.services.storage.model.BucketAccessControl createAcl(com.google.api.services.storage.model.BucketAccessControl acl, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcCreates a new ACL entry on the specified bucket.- Specified by:
createAclin interfaceStorageRpc
-
patchAcl
public com.google.api.services.storage.model.BucketAccessControl patchAcl(com.google.api.services.storage.model.BucketAccessControl acl, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcUpdates an ACL entry on the specified bucket.- Specified by:
patchAclin interfaceStorageRpc
-
listAcls
public List<com.google.api.services.storage.model.BucketAccessControl> listAcls(String bucket, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcLists the ACL entries for the provided bucket.- Specified by:
listAclsin interfaceStorageRpc
-
getDefaultAcl
public com.google.api.services.storage.model.ObjectAccessControl getDefaultAcl(String bucket, String entity) Description copied from interface:StorageRpcReturns the default object ACL entry for the specified entity on the specified bucket ornullif not found.- Specified by:
getDefaultAclin interfaceStorageRpc
-
deleteDefaultAcl
Description copied from interface:StorageRpcDeletes the default object ACL entry for the specified entity on the specified bucket.- Specified by:
deleteDefaultAclin interfaceStorageRpc- Returns:
trueif the ACL was deleted,falseif it was not found
-
createDefaultAcl
public com.google.api.services.storage.model.ObjectAccessControl createDefaultAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Description copied from interface:StorageRpcCreates a new default object ACL entry on the specified bucket.- Specified by:
createDefaultAclin interfaceStorageRpc
-
patchDefaultAcl
public com.google.api.services.storage.model.ObjectAccessControl patchDefaultAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Description copied from interface:StorageRpcUpdates a default object ACL entry on the specified bucket.- Specified by:
patchDefaultAclin interfaceStorageRpc
-
listDefaultAcls
public List<com.google.api.services.storage.model.ObjectAccessControl> listDefaultAcls(String bucket) Description copied from interface:StorageRpcLists the default object ACL entries for the provided bucket.- Specified by:
listDefaultAclsin interfaceStorageRpc
-
getAcl
public com.google.api.services.storage.model.ObjectAccessControl getAcl(String bucket, String object, Long generation, String entity) Description copied from interface:StorageRpcReturns the ACL entry for the specified entity on the specified object ornullif not found.- Specified by:
getAclin interfaceStorageRpc
-
deleteAcl
Description copied from interface:StorageRpcDeletes the ACL entry for the specified entity on the specified object.- Specified by:
deleteAclin interfaceStorageRpc- Returns:
trueif the ACL was deleted,falseif it was not found
-
createAcl
public com.google.api.services.storage.model.ObjectAccessControl createAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Description copied from interface:StorageRpcCreates a new ACL entry on the specified object.- Specified by:
createAclin interfaceStorageRpc
-
patchAcl
public com.google.api.services.storage.model.ObjectAccessControl patchAcl(com.google.api.services.storage.model.ObjectAccessControl acl) Description copied from interface:StorageRpcUpdates an ACL entry on the specified object.- Specified by:
patchAclin interfaceStorageRpc
-
listAcls
public List<com.google.api.services.storage.model.ObjectAccessControl> listAcls(String bucket, String object, Long generation) Description copied from interface:StorageRpcLists the ACL entries for the provided object.- Specified by:
listAclsin interfaceStorageRpc
-
createHmacKey
public com.google.api.services.storage.model.HmacKey createHmacKey(String serviceAccountEmail, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcCreates a new HMAC key for the provided service account email.- Specified by:
createHmacKeyin interfaceStorageRpc
-
listHmacKeys
public com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.HmacKeyMetadata>> listHmacKeys(Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcLists the HMAC keys for the provided service account email.- Specified by:
listHmacKeysin interfaceStorageRpc
-
getHmacKey
public com.google.api.services.storage.model.HmacKeyMetadata getHmacKey(String accessId, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcReturns the HMAC key associated with the provided access id.- Specified by:
getHmacKeyin interfaceStorageRpc
-
updateHmacKey
public com.google.api.services.storage.model.HmacKeyMetadata updateHmacKey(com.google.api.services.storage.model.HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcUpdates an HMAC key for the provided metadata object and returns the updated object. Only updates the State field.- Specified by:
updateHmacKeyin interfaceStorageRpc
-
deleteHmacKey
public void deleteHmacKey(com.google.api.services.storage.model.HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcDeletes the HMAC key associated with the provided metadata object.- Specified by:
deleteHmacKeyin interfaceStorageRpc
-
getIamPolicy
public com.google.api.services.storage.model.Policy getIamPolicy(String bucket, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcReturns the IAM policy for the specified bucket.- Specified by:
getIamPolicyin interfaceStorageRpc
-
setIamPolicy
public com.google.api.services.storage.model.Policy setIamPolicy(String bucket, com.google.api.services.storage.model.Policy policy, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcUpdates the IAM policy for the specified bucket.- Specified by:
setIamPolicyin interfaceStorageRpc
-
testIamPermissions
public com.google.api.services.storage.model.TestIamPermissionsResponse testIamPermissions(String bucket, List<String> permissions, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcTests whether the caller holds the specified permissions for the specified bucket.- Specified by:
testIamPermissionsin interfaceStorageRpc
-
deleteNotification
Description copied from interface:StorageRpcDeletes the notification with the specified id on the bucket.- Specified by:
deleteNotificationin interfaceStorageRpc- Returns:
trueif the notification has been deleted,falseif not found
-
listNotifications
Description copied from interface:StorageRpcRetrieves the list of notifications associated with the bucket.- Specified by:
listNotificationsin interfaceStorageRpc- Returns:
- a list of
Notificationobjects that exist on the bucket.
-
createNotification
public com.google.api.services.storage.model.Notification createNotification(String bucket, com.google.api.services.storage.model.Notification notification) Description copied from interface:StorageRpcCreates the notification for a given bucket.- Specified by:
createNotificationin interfaceStorageRpc- Returns:
- the created notification.
-
getNotification
public com.google.api.services.storage.model.Notification getNotification(String bucket, String notification) Description copied from interface:StorageRpcGets the notification with the specified id.- Specified by:
getNotificationin interfaceStorageRpc- Returns:
- the
Notificationobject with the given id ornullif not found
-
lockRetentionPolicy
public com.google.api.services.storage.model.Bucket lockRetentionPolicy(com.google.api.services.storage.model.Bucket bucket, Map<StorageRpc.Option, ?> options) Description copied from interface:StorageRpcLock retention policy for the provided bucket.- Specified by:
lockRetentionPolicyin interfaceStorageRpc- Returns:
- a
Bucketobject of the locked bucket
-
getServiceAccount
Description copied from interface:StorageRpcReturns the service account associated with the given project.- Specified by:
getServiceAccountin interfaceStorageRpc- Returns:
- the ID of the project to fetch the service account for.
-