Index
Storage
(interface)DeleteObjectRequest
(message)GetObjectRequest
(message)ListObjectsRequest
(message)ListObjectsResponse
(message)QueryWriteStatusRequest
(message)QueryWriteStatusResponse
(message)ReadObjectRequest
(message)ReadObjectResponse
(message)RestoreObjectRequest
(message)StartResumableWriteRequest
(message)StartResumableWriteResponse
(message)WriteObjectRequest
(message)WriteObjectResponse
(message)WriteObjectSpec
(message)
Storage
API Overview and Naming Syntax
The Cloud Storage RPC API allows applications to read and write data through the abstractions of buckets and objects. For a description of these abstractions see https://cloud.google.com/storage/docs.
Resources are named as follows:
- Projects are referred to as they are defined by the Resource Manager API, using strings like
projects/123456
orprojects/my-string-id
. - Buckets are named using string names of the form:
projects/{project}/buckets/{bucket}
For globally unique buckets,_
may be substituted for the project. - Objects are uniquely identified by their name along with the name of the bucket they belong to, as separate strings in this API. For example:
ReadObjectRequest { bucket: 'projects/_/buckets/my-bucket' object: 'my-object' }
Note that object names can contain
/
characters, which are treated as any other character (no special directory semantics).
DeleteObject |
---|
Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used, or if soft delete is not enabled for the bucket. When this API is used to delete an object from a bucket that has soft delete policy enabled, the object becomes soft deleted, and the You can use the IAM Permissions: Requires
|
GetObject |
---|
Retrieves object metadata. IAM Permissions: Requires
|
ListObjects |
---|
Retrieves a list of objects matching the criteria. IAM Permissions: The authenticated user requires
|
QueryWriteStatus |
---|
Determines the If the object does not exist, meaning if it was deleted, or the first This method is useful for clients that buffer data and need to know which data can be safely evicted. The client can call
|
ReadObject |
---|
Retrieves object data. IAM Permissions: Requires
|
RestoreObject |
---|
Restores a soft-deleted object.
|
StartResumableWrite |
---|
Starts a resumable write operation. This method is part of the Resumable upload feature. This allows you to upload large objects in multiple chunks, which is more resilient to network interruptions than a single upload. The validity duration of the write operation, and the consequences of it becoming invalid, are service-dependent. IAM Permissions: Requires
|
WriteObject |
---|
Stores a new object and metadata. An object can be written either in a single message stream or in a resumable sequence of message streams. To write using a single stream, the client should include in the first message of the stream an For a resumable write, the client should instead call The service will not view the object as complete until the client has sent a Attempting to resume an already finalized object will result in an OK status, with a IAM Permissions: Requires
|
CommonObjectRequestParams
Parameters that can be passed to any object request.
Fields | |
---|---|
encryption_ |
Encryption algorithm used with the Customer-Supplied Encryption Keys feature. |
encryption_ |
Encryption key used with the Customer-Supplied Encryption Keys feature. In raw bytes format (not base64-encoded). |
encryption_ |
SHA256 hash of encryption key used with the Customer-Supplied Encryption Keys feature. |
DeleteObjectRequest
Message for deleting an object. bucket
and object
must be set.
Fields | |
---|---|
bucket |
Required. Name of the bucket in which the object resides. |
object |
Required. The name of the finalized object to delete. For information about how to URL encode object names to be path safe, see Encoding URI path parts. Note: If you want to delete an unfinalized resumable upload please use |
generation |
If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default). |
common_ |
A set of parameters common to Storage API requests concerning an object. |
if_ |
Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object. |
if_ |
Makes the operation conditional on whether the object's live generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object. |
if_ |
Makes the operation conditional on whether the object's current metageneration matches the given value. |
if_ |
Makes the operation conditional on whether the object's current metageneration does not match the given value. |
GetObjectRequest
Request message for GetObject.
Fields | |
---|---|
bucket |
Required. Name of the bucket in which the object resides. |
object |
Required. Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI path parts. |
generation |
If present, selects a specific revision of this object (as opposed to the latest version, the default). If |
common_ |
A set of parameters common to Storage API requests concerning an object. |
restore_ |
Optional. Restore token used to differentiate soft-deleted objects with the same name and generation. Only applicable for hierarchical namespace buckets and if soft_deleted is set to true. This parameter is optional, and is only required in the rare case when there are multiple soft-deleted objects with the same name and generation. |
soft_ |
If true, returns the metadata of the soft-deleted object. |
if_ |
Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object. |
if_ |
Makes the operation conditional on whether the object's live generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object. |
if_ |
Makes the operation conditional on whether the object's current metageneration matches the given value. |
if_ |
Makes the operation conditional on whether the object's current metageneration does not match the given value. |
read_ |
Mask specifying which fields to read. If no mask is specified, will default to all fields except metadata.acl and metadata.owner. * may be used to mean "all fields". |
ListObjectsRequest
Request message for ListObjects.
Fields | |
---|---|
parent |
Required. Name of the bucket in which the objects are located. |
page_ |
Maximum number of |
page_ |
If you start a listing and then create an object in the bucket before using a |
delimiter |
If set, returns results in a directory-like mode. |
include_ |
If true, objects that end in exactly one instance of delimiter have their metadata included in |
prefix |
Filter results to include only objects whose names begin with this prefix. When prefix is set, the names of the objects returned in the response are relative to the root of the bucket. |
versions |
If |
lexicographic_ |
Optional. Filter results to objects whose names are lexicographically equal to or after lexicographic_start. If lexicographic_end is also set, the objects listed have names between lexicographic_start (inclusive) and lexicographic_end (exclusive). |
lexicographic_ |
Optional. Filter results to objects whose names are lexicographically before lexicographic_end. If lexicographic_start is also set, the objects listed have names between lexicographic_start (inclusive) and lexicographic_end (exclusive). |
soft_ |
Optional. If true, only list all soft-deleted versions of the object. Soft delete policy is required to set this option. |
include_ |
Optional. If true, will also include folders and managed folders (besides objects) in the returned |
match_ |
Optional. Filter results to objects and prefixes that match this glob pattern. See List Objects Using Glob for the full syntax. |
read_ |
Mask specifying which fields to read from each result. If no mask is specified, will default to all fields except items.acl and items.owner. * may be used to mean "all fields". |
ListObjectsResponse
The result of a call to Objects.ListObjects
Fields | |
---|---|
objects[] |
The list of items. |
prefixes[] |
The list of prefixes of objects matching-but-not-listed up to and including the requested delimiter. |
next_ |
The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results. |
Object
An object.
Fields | |
---|---|
name |
Immutable. The name of this object. Nearly any sequence of unicode characters is valid. See Guidelines. Example: |
bucket |
Immutable. The name of the bucket containing this object. |
etag |
The etag of the object. If included in the metadata of an update or delete request message, the operation will only be performed if the etag matches that of the live object. |
generation |
Immutable. The content generation of this object. Used for object versioning. |
metageneration |
Output only. The version of the metadata for this generation of this object. Used for preconditions and for detecting changes in metadata. A metageneration number is only meaningful in the context of a particular generation of a particular object. |
storage_ |
Storage class of the object. |
size |
Output only. Content-Length of the object data in bytes, matching [https://tools.ietf.org/html/rfc7230#section-3.3.2][RFC 7230 §3.3.2]. |
content_ |
Content-Encoding of the object data, matching [https://tools.ietf.org/html/rfc7231#section-3.1.2.2][RFC 7231 §3.1.2.2] |
content_ |
Content-Disposition of the object data, matching [https://tools.ietf.org/html/rfc6266][RFC 6266]. |
cache_ |
Cache-Control directive for the object data, matching [https://tools.ietf.org/html/rfc7234#section-5.2"][RFC 7234 §5.2]. If omitted, and the object is accessible to all anonymous users, the default will be |
acl[] |
Access controls on the object. If iam_config.uniform_bucket_level_access is enabled on the parent bucket, requests to set, read, or modify acl is an error. |
content_ |
Content-Language of the object data, matching [https://tools.ietf.org/html/rfc7231#section-3.1.3.2][RFC 7231 §3.1.3.2]. |
delete_ |
Output only. If this object is noncurrent, this is the time when the object became noncurrent. |
content_ |
Content-Type of the object data, matching [https://tools.ietf.org/html/rfc7231#section-3.1.1.5][RFC 7231 §3.1.1.5]. If an object is stored without a Content-Type, it is served as |
create_ |
Output only. The creation time of the object. |
component_ |
Output only. Number of underlying components that make up this object. Components are accumulated by compose operations. |
checksums |
Output only. Hashes for the data part of this object. This field is used for output only and will be silently ignored if provided in requests. The checksums of the complete object regardless of data range. If the object is downloaded in full, the client should compute one of these checksums over the downloaded object and compare it against the value provided here. |
update_ |
Output only. The modification time of the object metadata. Set initially to object creation time and then updated whenever any metadata of the object changes. This includes changes made by a requester, such as modifying custom metadata, as well as changes made by Cloud Storage on behalf of a requester, such as changing the storage class based on an Object Lifecycle Configuration. |
kms_ |
Cloud KMS Key used to encrypt this object, if the object is encrypted by such a key. |
update_ |
Output only. The time at which the object's storage class was last changed. When the object is initially created, it will be set to time_created. |
temporary_ |
Whether an object is under temporary hold. While this flag is set to true, the object is protected against deletion and overwrites. A common use case of this flag is regulatory investigations where objects need to be retained while the investigation is ongoing. Note that unlike event-based hold, temporary hold does not impact retention expiration time of an object. |
retention_ |
A server-determined value that specifies the earliest time that the object's retention period expires. Note 1: This field is not provided for objects with an active event-based hold, since retention expiration is unknown until the hold is removed. Note 2: This value can be provided even when temporary hold is set (so that the user can reason about policy without having to first unset the temporary hold). |
metadata |
User-provided metadata, in key/value pairs. |
owner |
Output only. The owner of the object. This will always be the uploader of the object. |
customer_ |
Metadata of Customer-Supplied Encryption Key, if the object is encrypted by such a key. |
custom_ |
A user-specified timestamp set on an object. |
restore_ |
Output only. Restore token used to differentiate deleted objects with the same name and generation. This field is output only, and only set for deleted objects in HNS buckets. |
event_ |
Whether an object is under event-based hold. An event-based hold is a way to force the retention of an object until after some event occurs. Once the hold is released by explicitly setting this field to false, the object will become subject to any bucket-level retention policy, except that the retention duration will be calculated from the time the event based hold was lifted, rather than the time the object was created. In a WriteObject request, not setting this field implies that the value should be taken from the parent bucket's "default_event_based_hold" field. In a response, this field will always be set to true or false. |
soft_ |
Output only. This is the time when the object became soft-deleted. Soft-deleted objects are only accessible if a soft_delete_policy is enabled. Also see hard_delete_time. |
hard_ |
Output only. The time when the object will be permanently deleted. Only set when an object becomes soft-deleted with a soft_delete_policy. Otherwise, the object will not be accessible. |
QueryWriteStatusRequest
Request object for QueryWriteStatus
.
Fields | |
---|---|
upload_ |
Required. The name of the resume token for the object whose write status is being requested. |
common_ |
A set of parameters common to Storage API requests concerning an object. |
QueryWriteStatusResponse
Response object for QueryWriteStatus
.
Fields | |
---|---|
Union field write_status . The response will set one of the following. write_status can be only one of the following: |
|
persisted_ |
The total number of bytes that have been processed for the given object from all |
resource |
A resource containing the metadata for the uploaded object. Only set if the upload has finalized. |
ReadObjectRequest
Request message for ReadObject.
Fields | |
---|---|
bucket |
Required. The name of the bucket containing the object to read. |
object |
Required. The name of the object to read. |
generation |
If present, selects a specific revision of this object (as opposed to the latest version, the default). |
read_ |
The offset for the first byte to return in the read, relative to the start of the object. A negative |
read_ |
The maximum number of If the stream returns fewer bytes than allowed by the |
common_ |
A set of parameters common to Storage API requests concerning an object. |
if_ |
Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object. |
if_ |
Makes the operation conditional on whether the object's live generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object. |
if_ |
Makes the operation conditional on whether the object's current metageneration matches the given value. |
if_ |
Makes the operation conditional on whether the object's current metageneration does not match the given value. |
read_ |
Mask specifying which fields to read. The checksummed_data field and its children will always be present. If no mask is specified, will default to all fields except metadata.owner and metadata.acl. * may be used to mean "all fields". |
ReadObjectResponse
Response message for ReadObject.
Fields | |
---|---|
checksummed_ |
A portion of the data for the object. The service may leave |
object_ |
The checksums of the complete object. If the object is downloaded in full, the client should compute one of these checksums over the downloaded object and compare it against the value provided here. |
content_ |
If read_offset and or read_limit was specified on the ReadObjectRequest, ContentRange will be populated on the first ReadObjectResponse message of the read stream. |
metadata |
Metadata of the object whose media is being returned. Only populated in the first response in the stream. |
RestoreObjectRequest
Message for restoring an object. bucket
, object
, and generation
must be set.
Fields | |
---|---|
bucket |
Required. Name of the bucket in which the object resides. |
object |
Required. The name of the object to restore. |
generation |
Required. The specific revision of the object to restore. |
restore_ |
Optional. Restore token used to differentiate soft-deleted objects with the same name and generation. Only applicable for hierarchical namespace buckets. This parameter is optional, and is only required in the rare case when there are multiple soft-deleted objects with the same name and generation. |
common_ |
A set of parameters common to Storage API requests concerning an object. |
if_ |
Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object. |
if_ |
Makes the operation conditional on whether the object's live generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object. |
if_ |
Makes the operation conditional on whether the object's current metageneration matches the given value. |
if_ |
Makes the operation conditional on whether the object's current metageneration does not match the given value. |
copy_ |
If false or unset, the bucket's default object ACL will be used. If true, copy the source object's access controls. Return an error if bucket has UBLA enabled. |
StartResumableWriteRequest
Request message StartResumableWrite.
Fields | |
---|---|
write_ |
Required. The destination bucket, object, and metadata, as well as any preconditions. |
common_ |
A set of parameters common to Storage API requests concerning an object. |
object_ |
The checksums of the complete object. This will be used to validate the uploaded object. For each upload, object_checksums can be provided with either StartResumableWriteRequest or the WriteObjectRequest with finish_write set to |
StartResumableWriteResponse
Response object for StartResumableWrite
.
Fields | |
---|---|
upload_ |
The upload_id of the newly started resumable write operation. This value should be copied into the |
WriteObjectRequest
Request message for WriteObject.
Fields | |
---|---|
write_ |
Required. The offset from the beginning of the object at which the data should be written. In the first On subsequent calls, this value must be no larger than the sum of the first An incorrect value causes an error. |
object_ |
Checksums for the complete object. If the checksums computed by the service don't match the specified checksums the call will fail. May only be provided in the first or last request (either with first_message, or finish_write set). |
finish_ |
If |
common_ |
A set of parameters common to Storage API requests concerning an object. |
Union field first_message . The first message of each stream should set one of the following. first_message can be only one of the following: |
|
upload_ |
For resumable uploads. This should be the |
write_ |
For non-resumable uploads. Describes the overall upload, including the destination bucket and object name, preconditions, etc. |
Union field data . A portion of the data for the object. data can be only one of the following: |
|
checksummed_ |
The data to insert. If a crc32c checksum is provided that doesn't match the checksum computed by the service, the request will fail. |
WriteObjectResponse
Response message for WriteObject.
Fields | |
---|---|
Union field write_status . The response will set one of the following. write_status can be only one of the following: |
|
persisted_ |
The total number of bytes that have been processed for the given object from all |
resource |
A resource containing the metadata for the uploaded object. Only set if the upload has finalized. |
WriteObjectSpec
Describes an attempt to insert an object, possibly over multiple requests.
Fields | |
---|---|
resource |
Required. Destination object, including its name and its metadata. |
predefined_ |
Apply a predefined set of access controls to this object. Valid values are "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", or "publicRead". |
if_ |
Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object. |
if_ |
Makes the operation conditional on whether the object's live generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object. |
if_ |
Makes the operation conditional on whether the object's current metageneration matches the given value. |
if_ |
Makes the operation conditional on whether the object's current metageneration does not match the given value. |
object_ |
The expected final object size being uploaded. If this value is set, closing the stream after writing fewer or more than This situation is considered a client error, and if such an error occurs you must start the upload over from scratch, this time sending the correct number of bytes. |