Class HttpStorageRpc (2.22.2)

public class HttpStorageRpc implements StorageRpc

Inheritance

java.lang.Object > HttpStorageRpc

Implements

StorageRpc

Static Fields

DEFAULT_PROJECTION

public static final String DEFAULT_PROJECTION
Field Value
TypeDescription
String

NO_ACL_PROJECTION

public static final String NO_ACL_PROJECTION
Field Value
TypeDescription
String

Constructors

HttpStorageRpc(StorageOptions options)

public HttpStorageRpc(StorageOptions options)
Parameter
NameDescription
optionsStorageOptions

HttpStorageRpc(StorageOptions options, JsonFactory jsonFactory)

public HttpStorageRpc(StorageOptions options, JsonFactory jsonFactory)
Parameters
NameDescription
optionsStorageOptions
jsonFactorycom.google.api.client.json.JsonFactory

Methods

compose(Iterable<StorageObject> sources, StorageObject target, Map<StorageRpc.Option,?> targetOptions)

public StorageObject compose(Iterable<StorageObject> sources, StorageObject target, Map<StorageRpc.Option,?> targetOptions)

Sends a compose request.

Parameters
NameDescription
sourcesIterable<com.google.api.services.storage.model.StorageObject>
targetcom.google.api.services.storage.model.StorageObject
targetOptionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.StorageObject

continueRewrite(StorageRpc.RewriteResponse previousResponse)

public StorageRpc.RewriteResponse continueRewrite(StorageRpc.RewriteResponse previousResponse)

Continues rewriting on an already open rewrite channel.

Parameter
NameDescription
previousResponseStorageRpc.RewriteResponse
Returns
TypeDescription
StorageRpc.RewriteResponse

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

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

Creates a new bucket.

Parameters
NameDescription
bucketcom.google.api.services.storage.model.Bucket
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.Bucket

create(StorageObject storageObject, InputStream content, Map<StorageRpc.Option,?> options)

public StorageObject create(StorageObject storageObject, InputStream content, Map<StorageRpc.Option,?> options)

Creates a new storage object.

Parameters
NameDescription
storageObjectcom.google.api.services.storage.model.StorageObject
contentInputStream
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.StorageObject

createAcl(BucketAccessControl acl, Map<StorageRpc.Option,?> options)

public BucketAccessControl createAcl(BucketAccessControl acl, Map<StorageRpc.Option,?> options)

Creates a new ACL entry on the specified bucket.

Parameters
NameDescription
aclcom.google.api.services.storage.model.BucketAccessControl
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.BucketAccessControl

createAcl(ObjectAccessControl acl)

public ObjectAccessControl createAcl(ObjectAccessControl acl)

Creates a new ACL entry on the specified object.

Parameter
NameDescription
aclcom.google.api.services.storage.model.ObjectAccessControl
Returns
TypeDescription
com.google.api.services.storage.model.ObjectAccessControl

createBatch()

public RpcBatch createBatch()

Creates an empty batch.

Returns
TypeDescription
RpcBatch

createDefaultAcl(ObjectAccessControl acl)

public ObjectAccessControl createDefaultAcl(ObjectAccessControl acl)

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

Parameter
NameDescription
aclcom.google.api.services.storage.model.ObjectAccessControl
Returns
TypeDescription
com.google.api.services.storage.model.ObjectAccessControl

createHmacKey(String serviceAccountEmail, Map<StorageRpc.Option,?> options)

public HmacKey createHmacKey(String serviceAccountEmail, Map<StorageRpc.Option,?> options)

Creates a new HMAC key for the provided service account email.

Parameters
NameDescription
serviceAccountEmailString
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.HmacKey

createNotification(String bucket, Notification notification)

public Notification createNotification(String bucket, Notification notification)

Creates the notification for a given bucket.

Parameters
NameDescription
bucketString
notificationcom.google.api.services.storage.model.Notification
Returns
TypeDescription
com.google.api.services.storage.model.Notification

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

public boolean delete(Bucket bucket, Map<StorageRpc.Option,?> options)

Deletes the requested bucket.

Parameters
NameDescription
bucketcom.google.api.services.storage.model.Bucket
optionsMap<Option,?>
Returns
TypeDescription
boolean

delete(StorageObject blob, Map<StorageRpc.Option,?> options)

public boolean delete(StorageObject blob, Map<StorageRpc.Option,?> options)

Deletes the requested storage object.

Parameters
NameDescription
blobcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
Returns
TypeDescription
boolean

deleteAcl(String bucket, String object, Long generation, String entity)

public boolean deleteAcl(String bucket, String object, Long generation, String entity)

Deletes the ACL entry for the specified entity on the specified object.

Parameters
NameDescription
bucketString
objectString
generationLong
entityString
Returns
TypeDescription
boolean

deleteAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)

public boolean deleteAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)

Deletes the ACL entry for the specified entity on the specified bucket.

Parameters
NameDescription
bucketString
entityString
optionsMap<Option,?>
Returns
TypeDescription
boolean

deleteDefaultAcl(String bucket, String entity)

public boolean deleteDefaultAcl(String bucket, String entity)

Deletes the default object ACL entry for the specified entity on the specified bucket.

Parameters
NameDescription
bucketString
entityString
Returns
TypeDescription
boolean

deleteHmacKey(HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option,?> options)

public void deleteHmacKey(HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option,?> options)

Deletes the HMAC key associated with the provided metadata object.

Parameters
NameDescription
hmacKeyMetadatacom.google.api.services.storage.model.HmacKeyMetadata
optionsMap<Option,?>

deleteNotification(String bucket, String notification)

public boolean deleteNotification(String bucket, String notification)

Deletes the notification with the specified id on the bucket.

Parameters
NameDescription
bucketString
notificationString
Returns
TypeDescription
boolean

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

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

Returns the requested bucket or null if not found.

Parameters
NameDescription
bucketcom.google.api.services.storage.model.Bucket
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.Bucket

get(StorageObject object, Map<StorageRpc.Option,?> options)

public StorageObject get(StorageObject object, Map<StorageRpc.Option,?> options)

Returns the requested storage object or null if not found.

Parameters
NameDescription
objectcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.StorageObject

getAcl(String bucket, String object, Long generation, String entity)

public ObjectAccessControl getAcl(String bucket, String object, Long generation, String entity)

Returns the ACL entry for the specified entity on the specified object or null if not found.

Parameters
NameDescription
bucketString
objectString
generationLong
entityString
Returns
TypeDescription
com.google.api.services.storage.model.ObjectAccessControl

getAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)

public BucketAccessControl getAcl(String bucket, String entity, Map<StorageRpc.Option,?> options)

Returns the ACL entry for the specified entity on the specified bucket or null if not found.

Parameters
NameDescription
bucketString
entityString
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.BucketAccessControl

getCurrentUploadOffset(String uploadId)

public long getCurrentUploadOffset(String uploadId)

Requests current byte offset from Cloud Storage API. Used to recover from a failure in some bytes were committed successfully to the open resumable session.

Parameter
NameDescription
uploadIdString
Returns
TypeDescription
long

getDefaultAcl(String bucket, String entity)

public ObjectAccessControl getDefaultAcl(String bucket, String entity)

Returns the default object ACL entry for the specified entity on the specified bucket or null if not found.

Parameters
NameDescription
bucketString
entityString
Returns
TypeDescription
com.google.api.services.storage.model.ObjectAccessControl

getHmacKey(String accessId, Map<StorageRpc.Option,?> options)

public HmacKeyMetadata getHmacKey(String accessId, Map<StorageRpc.Option,?> options)

Returns the HMAC key associated with the provided access id.

Parameters
NameDescription
accessIdString
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.HmacKeyMetadata

getIamPolicy(String bucket, Map<StorageRpc.Option,?> options)

public Policy getIamPolicy(String bucket, Map<StorageRpc.Option,?> options)

Returns the IAM policy for the specified bucket.

Parameters
NameDescription
bucketString
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.Policy

getNotification(String bucket, String notification)

public Notification getNotification(String bucket, String notification)

Gets the notification with the specified id.

Parameters
NameDescription
bucketString
notificationString
Returns
TypeDescription
com.google.api.services.storage.model.Notification

getServiceAccount(String projectId)

public ServiceAccount getServiceAccount(String projectId)

Returns the service account associated with the given project.

Parameter
NameDescription
projectIdString
Returns
TypeDescription
com.google.api.services.storage.model.ServiceAccount

getStorage()

public Storage getStorage()
Returns
TypeDescription
com.google.api.services.storage.Storage

list(String bucket, Map<StorageRpc.Option,?> options)

public Tuple<String,Iterable<StorageObject>> list(String bucket, Map<StorageRpc.Option,?> options)

Lists the bucket's blobs.

Parameters
NameDescription
bucketString
optionsMap<Option,?>
Returns
TypeDescription
com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.StorageObject>>

list(Map<StorageRpc.Option,?> options)

public Tuple<String,Iterable<Bucket>> list(Map<StorageRpc.Option,?> options)

Lists the project's buckets.

Parameter
NameDescription
optionsMap<Option,?>
Returns
TypeDescription
com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.Bucket>>

listAcls(String bucket, String object, Long generation)

public List<ObjectAccessControl> listAcls(String bucket, String object, Long generation)

Lists the ACL entries for the provided object.

Parameters
NameDescription
bucketString
objectString
generationLong
Returns
TypeDescription
List<com.google.api.services.storage.model.ObjectAccessControl>

listAcls(String bucket, Map<StorageRpc.Option,?> options)

public List<BucketAccessControl> listAcls(String bucket, Map<StorageRpc.Option,?> options)

Lists the ACL entries for the provided bucket.

Parameters
NameDescription
bucketString
optionsMap<Option,?>
Returns
TypeDescription
List<com.google.api.services.storage.model.BucketAccessControl>

listDefaultAcls(String bucket)

public List<ObjectAccessControl> listDefaultAcls(String bucket)

Lists the default object ACL entries for the provided bucket.

Parameter
NameDescription
bucketString
Returns
TypeDescription
List<com.google.api.services.storage.model.ObjectAccessControl>

listHmacKeys(Map<StorageRpc.Option,?> options)

public Tuple<String,Iterable<HmacKeyMetadata>> listHmacKeys(Map<StorageRpc.Option,?> options)

Lists the HMAC keys for the provided service account email.

Parameter
NameDescription
optionsMap<Option,?>
Returns
TypeDescription
com.google.cloud.Tuple<String,Iterable<com.google.api.services.storage.model.HmacKeyMetadata>>

listNotifications(String bucket)

public List<Notification> listNotifications(String bucket)

Retrieves the list of notifications associated with the bucket.

Parameter
NameDescription
bucketString
Returns
TypeDescription
List<com.google.api.services.storage.model.Notification>

load(StorageObject from, Map<StorageRpc.Option,?> options)

public byte[] load(StorageObject from, Map<StorageRpc.Option,?> options)

Reads all the bytes from a storage object.

Parameters
NameDescription
fromcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
Returns
TypeDescription
byte[]

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

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

Lock retention policy for the provided bucket.

Parameters
NameDescription
bucketcom.google.api.services.storage.model.Bucket
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.Bucket

open(StorageObject object, Map<StorageRpc.Option,?> options)

public String open(StorageObject object, Map<StorageRpc.Option,?> options)

Opens a resumable upload channel for a given storage object.

Parameters
NameDescription
objectcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
Returns
TypeDescription
String

open(String signedURL)

public String open(String signedURL)

Opens a resumable upload channel for a given signedURL.

Parameter
NameDescription
signedURLString
Returns
TypeDescription
String

openRewrite(StorageRpc.RewriteRequest rewriteRequest)

public StorageRpc.RewriteResponse openRewrite(StorageRpc.RewriteRequest rewriteRequest)

Sends a rewrite request to open a rewrite channel.

Parameter
NameDescription
rewriteRequestStorageRpc.RewriteRequest
Returns
TypeDescription
StorageRpc.RewriteResponse

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

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

Updates bucket information.

Parameters
NameDescription
bucketcom.google.api.services.storage.model.Bucket
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.Bucket

patch(StorageObject storageObject, Map<StorageRpc.Option,?> options)

public StorageObject patch(StorageObject storageObject, Map<StorageRpc.Option,?> options)

Updates the storage object's information. Original metadata are merged with metadata in the provided storageObject.

Parameters
NameDescription
storageObjectcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.StorageObject

patchAcl(BucketAccessControl acl, Map<StorageRpc.Option,?> options)

public BucketAccessControl patchAcl(BucketAccessControl acl, Map<StorageRpc.Option,?> options)

Updates an ACL entry on the specified bucket.

Parameters
NameDescription
aclcom.google.api.services.storage.model.BucketAccessControl
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.BucketAccessControl

patchAcl(ObjectAccessControl acl)

public ObjectAccessControl patchAcl(ObjectAccessControl acl)

Updates an ACL entry on the specified object.

Parameter
NameDescription
aclcom.google.api.services.storage.model.ObjectAccessControl
Returns
TypeDescription
com.google.api.services.storage.model.ObjectAccessControl

patchDefaultAcl(ObjectAccessControl acl)

public ObjectAccessControl patchDefaultAcl(ObjectAccessControl acl)

Updates a default object ACL entry on the specified bucket.

Parameter
NameDescription
aclcom.google.api.services.storage.model.ObjectAccessControl
Returns
TypeDescription
com.google.api.services.storage.model.ObjectAccessControl

queryCompletedResumableUpload(String uploadId, long totalBytes)

public StorageObject queryCompletedResumableUpload(String uploadId, long totalBytes)

Attempts to retrieve the StorageObject from a completed resumable upload. When a resumable upload completes, the response will be the up-to-date StorageObject metadata. This up-to-date metadata can then be used to validate the total size of the object along with new generation and other information.

If for any reason, the response to the final PUT to a resumable upload is not received, this method can be used to query for the up-to-date StorageObject. If the upload is complete, this method can be used to access the StorageObject independently from any other liveness or conditional criteria requirements that are otherwise applicable when using #get(StorageObject, Map).

Parameters
NameDescription
uploadIdString
totalByteslong
Returns
TypeDescription
com.google.api.services.storage.model.StorageObject

read(StorageObject from, Map<StorageRpc.Option,?> options, long position, int bytes)

public Tuple<String,byte[]> read(StorageObject from, Map<StorageRpc.Option,?> options, long position, int bytes)

Reads the given amount of bytes from a storage object at the given position.

Parameters
NameDescription
fromcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
positionlong
bytesint
Returns
TypeDescription
com.google.cloud.Tuple<String,byte[]>

read(StorageObject from, Map<StorageRpc.Option,?> options, long position, OutputStream outputStream)

public long read(StorageObject from, Map<StorageRpc.Option,?> options, long position, OutputStream outputStream)

Reads all the bytes from a storage object at the given position in to outputstream using direct download.

Parameters
NameDescription
fromcom.google.api.services.storage.model.StorageObject
optionsMap<Option,?>
positionlong
outputStreamOutputStream
Returns
TypeDescription
long

setIamPolicy(String bucket, Policy policy, Map<StorageRpc.Option,?> options)

public Policy setIamPolicy(String bucket, Policy policy, Map<StorageRpc.Option,?> options)

Updates the IAM policy for the specified bucket.

Parameters
NameDescription
bucketString
policycom.google.api.services.storage.model.Policy
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.Policy

testIamPermissions(String bucket, List<String> permissions, Map<StorageRpc.Option,?> options)

public TestIamPermissionsResponse testIamPermissions(String bucket, List<String> permissions, Map<StorageRpc.Option,?> options)

Tests whether the caller holds the specified permissions for the specified bucket.

Parameters
NameDescription
bucketString
permissionsList<String>
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.TestIamPermissionsResponse

updateHmacKey(HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option,?> options)

public HmacKeyMetadata updateHmacKey(HmacKeyMetadata hmacKeyMetadata, Map<StorageRpc.Option,?> options)

Updates an HMAC key for the provided metadata object and returns the updated object. Only updates the State field.

Parameters
NameDescription
hmacKeyMetadatacom.google.api.services.storage.model.HmacKeyMetadata
optionsMap<Option,?>
Returns
TypeDescription
com.google.api.services.storage.model.HmacKeyMetadata

write(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last)

public void write(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last)

Writes the provided bytes to a storage object at the provided location.

Parameters
NameDescription
uploadIdString
toWritebyte[]
toWriteOffsetint
destOffsetlong
lengthint
lastboolean

writeWithResponse(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last)

public StorageObject writeWithResponse(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset, int length, boolean last)

Writes the provided bytes to a storage object at the provided location. If last=true returns metadata of the updated object, otherwise returns null.

Parameters
NameDescription
uploadIdString
toWritebyte[]
toWriteOffsetint
destOffsetlong
lengthint
lastboolean
Returns
TypeDescription
com.google.api.services.storage.model.StorageObject