Skip to main content

objects

Creates, updates, deletes, gets or lists a objects resource.

Overview

Nameobjects
TypeResource
Idgoogle.storage.objects

Fields

NameDatatypeDescription
idstringThe ID of the object, including the bucket name, object name, and generation number.
namestringThe name of the object. Required if not specified by URL parameter.
aclarrayAccess controls on the object.
bucketstringThe name of the bucket containing this object.
cacheControlstringCache-Control directive for the object data. If omitted, and the object is accessible to all anonymous users, the default will be public, max-age=3600.
componentCountintegerNumber of underlying components that make up this object. Components are accumulated by compose operations.
contentDispositionstringContent-Disposition of the object data.
contentEncodingstringContent-Encoding of the object data.
contentLanguagestringContent-Language of the object data.
contentTypestringContent-Type of the object data. If an object is stored without a Content-Type, it is served as application/octet-stream.
crc32cstringCRC32c checksum, as described in RFC 4960, Appendix B; encoded using base64 in big-endian byte order. For more information about using the CRC32c checksum, see Data Validation and Change Detection.
customTimestringA timestamp in RFC 3339 format specified by the user for an object.
customerEncryptionobjectMetadata of customer-supplied encryption key, if the object is encrypted by such a key.
etagstringHTTP 1.1 Entity tag for the object.
eventBasedHoldbooleanWhether an object is under event-based hold. Event-based hold is a way to retain objects until an event occurs, which is signified by the hold's release (i.e. this value is set to false). After being released (set to false), such objects will be subject to bucket-level retention (if any). One sample use case of this flag is for banks to hold loan documents for at least 3 years after loan is paid in full. Here, bucket-level retention is 3 years and the event is the loan being paid in full. In this example, these objects will be held intact for any number of years until the event has occurred (event-based hold on the object is released) and then 3 more years after that. That means retention duration of the objects begins from the moment event-based hold transitioned from true to false.
generationstringThe content generation of this object. Used for object versioning.
hardDeleteTimestringThis is the time (in the future) when the soft-deleted object will no longer be restorable. It is equal to the soft delete time plus the current soft delete retention duration of the bucket.
kindstringThe kind of item this is. For objects, this is always storage#object.
kmsKeyNamestringNot currently supported. Specifying the parameter causes the request to fail with status code 400 - Bad Request.
md5HashstringMD5 hash of the data; encoded using base64. For more information about using the MD5 hash, see Data Validation and Change Detection.
mediaLinkstringMedia download link.
metadataobjectUser-provided metadata, in key/value pairs.
metagenerationstringThe version of the metadata for this object at this generation. 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.
ownerobjectThe owner of the object. This will always be the uploader of the object.
retentionobjectA collection of object level retention parameters.
retentionExpirationTimestringA server-determined value that specifies the earliest time that the object's retention period expires. This value is in RFC 3339 format. 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).
selfLinkstringThe link to this object.
sizestringContent-Length of the data in bytes.
softDeleteTimestringThe time at which the object became soft-deleted in RFC 3339 format.
storageClassstringStorage class of the object.
temporaryHoldbooleanWhether 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.
timeCreatedstringThe creation time of the object in RFC 3339 format.
timeDeletedstringThe time at which the object became noncurrent in RFC 3339 format. Will be returned if and only if this version of the object has been deleted.
timeStorageClassUpdatedstringThe time at which the object's storage class was last changed. When the object is initially created, it will be set to timeCreated.
updatedstringThe modification time of the object metadata in RFC 3339 format. 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.

Methods

NameAccessible byRequired ParamsDescription
getSELECTbucket, objectRetrieves an object or its metadata.
listSELECTbucketRetrieves a list of objects matching the criteria.
insertINSERTbucketStores a new object and metadata.
deleteDELETEbucket, objectDeletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.
patchUPDATEbucket, objectPatches an object's metadata.
updateREPLACEbucket, objectUpdates an object's metadata.
bulk_restoreEXECbucketInitiates a long-running bulk restore operation on the specified bucket.
composeEXECdestinationBucket, destinationObjectConcatenates a list of existing objects into a new object in the same bucket.
copyEXECdestinationBucket, destinationObject, sourceBucket, sourceObjectCopies a source object to a destination object. Optionally overrides metadata.
restoreEXECbucket, generation, objectRestores a soft-deleted object.
rewriteEXECdestinationBucket, destinationObject, sourceBucket, sourceObjectRewrites a source object to a destination object. Optionally overrides metadata.
watch_allEXECbucketWatch for changes on all objects in a bucket.

SELECT examples

Retrieves a list of objects matching the criteria.

SELECT
id,
name,
acl,
bucket,
cacheControl,
componentCount,
contentDisposition,
contentEncoding,
contentLanguage,
contentType,
crc32c,
customTime,
customerEncryption,
etag,
eventBasedHold,
generation,
hardDeleteTime,
kind,
kmsKeyName,
md5Hash,
mediaLink,
metadata,
metageneration,
owner,
retention,
retentionExpirationTime,
selfLink,
size,
softDeleteTime,
storageClass,
temporaryHold,
timeCreated,
timeDeleted,
timeStorageClassUpdated,
updated
FROM google.storage.objects
WHERE bucket = '{{ bucket }}';

INSERT example

Use the following StackQL query and manifest file to create a new objects resource.

/*+ create */
INSERT INTO google.storage.objects (
bucket,
acl,
bucket,
cacheControl,
componentCount,
contentDisposition,
contentEncoding,
contentLanguage,
contentType,
crc32c,
customTime,
customerEncryption,
etag,
eventBasedHold,
generation,
kmsKeyName,
md5Hash,
mediaLink,
metadata,
metageneration,
name,
owner,
retentionExpirationTime,
retention,
size,
storageClass,
temporaryHold,
timeCreated,
timeDeleted,
softDeleteTime,
hardDeleteTime,
timeStorageClassUpdated,
updated
)
SELECT
'{{ bucket }}',
'{{ acl }}',
'{{ bucket }}',
'{{ cacheControl }}',
'{{ componentCount }}',
'{{ contentDisposition }}',
'{{ contentEncoding }}',
'{{ contentLanguage }}',
'{{ contentType }}',
'{{ crc32c }}',
'{{ customTime }}',
'{{ customerEncryption }}',
'{{ etag }}',
{{ eventBasedHold }},
'{{ generation }}',
'{{ kmsKeyName }}',
'{{ md5Hash }}',
'{{ mediaLink }}',
'{{ metadata }}',
'{{ metageneration }}',
'{{ name }}',
'{{ owner }}',
'{{ retentionExpirationTime }}',
'{{ retention }}',
'{{ size }}',
'{{ storageClass }}',
{{ temporaryHold }},
'{{ timeCreated }}',
'{{ timeDeleted }}',
'{{ softDeleteTime }}',
'{{ hardDeleteTime }}',
'{{ timeStorageClassUpdated }}',
'{{ updated }}'
;

UPDATE example

Updates a objects resource.

/*+ update */
UPDATE google.storage.objects
SET
acl = '{{ acl }}',
bucket = '{{ bucket }}',
cacheControl = '{{ cacheControl }}',
componentCount = '{{ componentCount }}',
contentDisposition = '{{ contentDisposition }}',
contentEncoding = '{{ contentEncoding }}',
contentLanguage = '{{ contentLanguage }}',
contentType = '{{ contentType }}',
crc32c = '{{ crc32c }}',
customTime = '{{ customTime }}',
customerEncryption = '{{ customerEncryption }}',
etag = '{{ etag }}',
eventBasedHold = true|false,
generation = '{{ generation }}',
kmsKeyName = '{{ kmsKeyName }}',
md5Hash = '{{ md5Hash }}',
mediaLink = '{{ mediaLink }}',
metadata = '{{ metadata }}',
metageneration = '{{ metageneration }}',
name = '{{ name }}',
owner = '{{ owner }}',
retentionExpirationTime = '{{ retentionExpirationTime }}',
retention = '{{ retention }}',
size = '{{ size }}',
storageClass = '{{ storageClass }}',
temporaryHold = true|false,
timeCreated = '{{ timeCreated }}',
timeDeleted = '{{ timeDeleted }}',
softDeleteTime = '{{ softDeleteTime }}',
hardDeleteTime = '{{ hardDeleteTime }}',
timeStorageClassUpdated = '{{ timeStorageClassUpdated }}',
updated = '{{ updated }}'
WHERE
bucket = '{{ bucket }}'
AND object = '{{ object }}';

REPLACE example

Replaces all fields in the specified objects resource.

/*+ update */
REPLACE google.storage.objects
SET
acl = '{{ acl }}',
bucket = '{{ bucket }}',
cacheControl = '{{ cacheControl }}',
componentCount = '{{ componentCount }}',
contentDisposition = '{{ contentDisposition }}',
contentEncoding = '{{ contentEncoding }}',
contentLanguage = '{{ contentLanguage }}',
contentType = '{{ contentType }}',
crc32c = '{{ crc32c }}',
customTime = '{{ customTime }}',
customerEncryption = '{{ customerEncryption }}',
etag = '{{ etag }}',
eventBasedHold = true|false,
generation = '{{ generation }}',
kmsKeyName = '{{ kmsKeyName }}',
md5Hash = '{{ md5Hash }}',
mediaLink = '{{ mediaLink }}',
metadata = '{{ metadata }}',
metageneration = '{{ metageneration }}',
name = '{{ name }}',
owner = '{{ owner }}',
retentionExpirationTime = '{{ retentionExpirationTime }}',
retention = '{{ retention }}',
size = '{{ size }}',
storageClass = '{{ storageClass }}',
temporaryHold = true|false,
timeCreated = '{{ timeCreated }}',
timeDeleted = '{{ timeDeleted }}',
softDeleteTime = '{{ softDeleteTime }}',
hardDeleteTime = '{{ hardDeleteTime }}',
timeStorageClassUpdated = '{{ timeStorageClassUpdated }}',
updated = '{{ updated }}'
WHERE
bucket = '{{ bucket }}'
AND object = '{{ object }}';

DELETE example

Deletes the specified objects resource.

/*+ delete */
DELETE FROM google.storage.objects
WHERE bucket = '{{ bucket }}'
AND object = '{{ object }}';