public class StorageRpcTestBase extends Object implements StorageRpc
StorageRpc which can be used outside of the Storage module for
testing purposes. All the methods throw an UnsupportedOperationException.StorageRpc.Option, StorageRpc.RewriteRequest, StorageRpc.RewriteResponse| Constructor and Description |
|---|
StorageRpcTestBase() |
| Modifier and Type | Method and 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.
|
StorageRpc.RewriteResponse |
continueRewrite(StorageRpc.RewriteResponse previousResponse)
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.
|
RpcBatch |
createBatch()
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 |
deleteNotification(String bucket,
String id)
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 |
getCurrentUploadOffset(String uploadId)
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 |
getIamPolicy(String bucket,
Map<StorageRpc.Option,?> options)
Returns the IAM policy for the specified bucket.
|
com.google.api.services.storage.model.Notification |
getNotification(String bucket,
String id)
Gets the notification with the specified id.
|
com.google.api.services.storage.model.ServiceAccount |
getServiceAccount(String projectId)
Returns the service account associated with the given project.
|
com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.Bucket>> |
list(Map<StorageRpc.Option,?> options)
Lists the project's buckets.
|
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.
|
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> |
listAcls(String bucket,
String object,
Long generation)
Lists the ACL entries for the provided object.
|
List<com.google.api.services.storage.model.ObjectAccessControl> |
listDefaultAcls(String bucket)
Lists the default object ACL entries for the provided bucket.
|
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.
|
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.Bucket |
lockRetentionPolicy(com.google.api.services.storage.model.Bucket bucket,
Map<StorageRpc.Option,?> options)
Lock retention policy for the provided bucket.
|
String |
open(com.google.api.services.storage.model.StorageObject object,
Map<StorageRpc.Option,?> options)
Opens a resumable upload channel for a given storage object.
|
String |
open(String signedURL)
Opens a resumable upload channel for a given signedURL.
|
StorageRpc.RewriteResponse |
openRewrite(StorageRpc.RewriteRequest rewriteRequest)
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.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.
|
public com.google.api.services.storage.model.Bucket create(com.google.api.services.storage.model.Bucket bucket,
Map<StorageRpc.Option,?> options)
StorageRpccreate in interface StorageRpcpublic com.google.api.services.storage.model.StorageObject create(com.google.api.services.storage.model.StorageObject object,
InputStream content,
Map<StorageRpc.Option,?> options)
StorageRpccreate in interface StorageRpcpublic com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.Bucket>> list(Map<StorageRpc.Option,?> options)
StorageRpclist in interface StorageRpcpublic com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.StorageObject>> list(String bucket, Map<StorageRpc.Option,?> options)
StorageRpclist in interface StorageRpcpublic com.google.api.services.storage.model.Bucket get(com.google.api.services.storage.model.Bucket bucket,
Map<StorageRpc.Option,?> options)
StorageRpcnull if not found.get in interface StorageRpcpublic com.google.api.services.storage.model.StorageObject get(com.google.api.services.storage.model.StorageObject object,
Map<StorageRpc.Option,?> options)
StorageRpcnull if not found.get in interface StorageRpcpublic com.google.api.services.storage.model.Bucket patch(com.google.api.services.storage.model.Bucket bucket,
Map<StorageRpc.Option,?> options)
StorageRpcpatch in interface StorageRpcpublic com.google.api.services.storage.model.StorageObject patch(com.google.api.services.storage.model.StorageObject storageObject,
Map<StorageRpc.Option,?> options)
StorageRpcstorageObject.patch in interface StorageRpcpublic boolean delete(com.google.api.services.storage.model.Bucket bucket,
Map<StorageRpc.Option,?> options)
StorageRpcdelete in interface StorageRpctrue if the bucket was deleted, false if it was not foundpublic boolean delete(com.google.api.services.storage.model.StorageObject object,
Map<StorageRpc.Option,?> options)
StorageRpcdelete in interface StorageRpctrue if the storage object was deleted, false if it was not foundpublic RpcBatch createBatch()
StorageRpccreateBatch in interface StorageRpcpublic 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)
StorageRpccompose in interface StorageRpcpublic byte[] load(com.google.api.services.storage.model.StorageObject storageObject,
Map<StorageRpc.Option,?> options)
StorageRpcload in interface StorageRpcpublic com.google.cloud.Tuple<String,byte[]> read(com.google.api.services.storage.model.StorageObject from, Map<StorageRpc.Option,?> options, long position, int bytes)
StorageRpcread in interface StorageRpcpublic long read(com.google.api.services.storage.model.StorageObject from,
Map<StorageRpc.Option,?> options,
long position,
OutputStream outputStream)
StorageRpcread in interface StorageRpcpublic String open(com.google.api.services.storage.model.StorageObject object, Map<StorageRpc.Option,?> options)
StorageRpcopen in interface StorageRpcpublic String open(String signedURL)
StorageRpcopen in interface StorageRpcpublic void write(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last)
StorageRpcwrite in interface StorageRpcpublic long getCurrentUploadOffset(String uploadId)
StorageRpcgetCurrentUploadOffset in interface StorageRpcuploadId - resumable upload ID URLpublic com.google.api.services.storage.model.StorageObject queryCompletedResumableUpload(String uploadId, long totalBytes)
StorageRpcIf 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).
queryCompletedResumableUpload in interface StorageRpcuploadId - resumable upload ID URLtotalBytes - the total number of bytes that should have been written.public com.google.api.services.storage.model.StorageObject writeWithResponse(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last)
StorageRpclast=true
returns metadata of the updated object, otherwise returns null.writeWithResponse in interface StorageRpcuploadId - resumable upload IDtoWrite - a portion of the contenttoWriteOffset - starting position in the toWrite arraydestOffset - starting position in the destination datalength - the number of bytes to be uploadedlast - true, if toWrite is the final content portionpublic StorageRpc.RewriteResponse openRewrite(StorageRpc.RewriteRequest rewriteRequest)
StorageRpcopenRewrite in interface StorageRpcpublic StorageRpc.RewriteResponse continueRewrite(StorageRpc.RewriteResponse previousResponse)
StorageRpccontinueRewrite in interface StorageRpcpublic com.google.api.services.storage.model.BucketAccessControl getAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)
StorageRpcnull if not
found.getAcl in interface StorageRpcpublic boolean deleteAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)
StorageRpcdeleteAcl in interface StorageRpctrue if the ACL was deleted, false if it was not foundpublic com.google.api.services.storage.model.BucketAccessControl createAcl(com.google.api.services.storage.model.BucketAccessControl acl,
Map<StorageRpc.Option,?> options)
StorageRpccreateAcl in interface StorageRpcpublic com.google.api.services.storage.model.BucketAccessControl patchAcl(com.google.api.services.storage.model.BucketAccessControl acl,
Map<StorageRpc.Option,?> options)
StorageRpcpatchAcl in interface StorageRpcpublic List<com.google.api.services.storage.model.BucketAccessControl> listAcls(String bucket, Map<StorageRpc.Option,?> options)
StorageRpclistAcls in interface StorageRpcpublic com.google.api.services.storage.model.ObjectAccessControl getDefaultAcl(String bucket, String entity)
StorageRpcnull if not found.getDefaultAcl in interface StorageRpcpublic boolean deleteDefaultAcl(String bucket, String entity)
StorageRpcdeleteDefaultAcl in interface StorageRpctrue if the ACL was deleted, false if it was not foundpublic com.google.api.services.storage.model.ObjectAccessControl createDefaultAcl(com.google.api.services.storage.model.ObjectAccessControl acl)
StorageRpccreateDefaultAcl in interface StorageRpcpublic com.google.api.services.storage.model.ObjectAccessControl patchDefaultAcl(com.google.api.services.storage.model.ObjectAccessControl acl)
StorageRpcpatchDefaultAcl in interface StorageRpcpublic List<com.google.api.services.storage.model.ObjectAccessControl> listDefaultAcls(String bucket)
StorageRpclistDefaultAcls in interface StorageRpcpublic com.google.api.services.storage.model.ObjectAccessControl getAcl(String bucket, String object, Long generation, String entity)
StorageRpcnull if not
found.getAcl in interface StorageRpcpublic boolean deleteAcl(String bucket, String object, Long generation, String entity)
StorageRpcdeleteAcl in interface StorageRpctrue if the ACL was deleted, false if it was not foundpublic com.google.api.services.storage.model.ObjectAccessControl createAcl(com.google.api.services.storage.model.ObjectAccessControl acl)
StorageRpccreateAcl in interface StorageRpcpublic com.google.api.services.storage.model.ObjectAccessControl patchAcl(com.google.api.services.storage.model.ObjectAccessControl acl)
StorageRpcpatchAcl in interface StorageRpcpublic List<com.google.api.services.storage.model.ObjectAccessControl> listAcls(String bucket, String object, Long generation)
StorageRpclistAcls in interface StorageRpcpublic com.google.api.services.storage.model.HmacKey createHmacKey(String serviceAccountEmail, Map<StorageRpc.Option,?> options)
StorageRpccreateHmacKey in interface StorageRpcpublic com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.HmacKeyMetadata>> listHmacKeys(Map<StorageRpc.Option,?> options)
StorageRpclistHmacKeys in interface StorageRpcpublic com.google.api.services.storage.model.HmacKeyMetadata updateHmacKey(com.google.api.services.storage.model.HmacKeyMetadata hmacKeyMetadata,
Map<StorageRpc.Option,?> options)
StorageRpcupdateHmacKey in interface StorageRpcpublic com.google.api.services.storage.model.HmacKeyMetadata getHmacKey(String accessId, Map<StorageRpc.Option,?> options)
StorageRpcgetHmacKey in interface StorageRpcpublic void deleteHmacKey(com.google.api.services.storage.model.HmacKeyMetadata hmacKeyMetadata,
Map<StorageRpc.Option,?> options)
StorageRpcdeleteHmacKey in interface StorageRpcpublic com.google.api.services.storage.model.Policy getIamPolicy(String bucket, Map<StorageRpc.Option,?> options)
StorageRpcgetIamPolicy in interface StorageRpcpublic com.google.api.services.storage.model.Policy setIamPolicy(String bucket, com.google.api.services.storage.model.Policy policy, Map<StorageRpc.Option,?> options)
StorageRpcsetIamPolicy in interface StorageRpcpublic com.google.api.services.storage.model.TestIamPermissionsResponse testIamPermissions(String bucket, List<String> permissions, Map<StorageRpc.Option,?> options)
StorageRpctestIamPermissions in interface StorageRpcpublic boolean deleteNotification(String bucket, String id)
StorageRpcdeleteNotification in interface StorageRpctrue if the notification has been deleted, false if not foundpublic List<com.google.api.services.storage.model.Notification> listNotifications(String bucket)
StorageRpclistNotifications in interface StorageRpcNotification objects that exist on the bucket.public com.google.api.services.storage.model.Notification createNotification(String bucket, com.google.api.services.storage.model.Notification notification)
StorageRpccreateNotification in interface StorageRpcpublic com.google.api.services.storage.model.Notification getNotification(String bucket, String id)
StorageRpcgetNotification in interface StorageRpcNotification object with the given id or null if not foundpublic com.google.api.services.storage.model.Bucket lockRetentionPolicy(com.google.api.services.storage.model.Bucket bucket,
Map<StorageRpc.Option,?> options)
StorageRpclockRetentionPolicy in interface StorageRpcBucket object of the locked bucketpublic com.google.api.services.storage.model.ServiceAccount getServiceAccount(String projectId)
StorageRpcgetServiceAccount in interface StorageRpcCopyright © 2022 Google LLC. All rights reserved.