objects
Creates, updates, deletes, gets or lists a objects
resource.
Overview
Name | objects |
Type | Resource |
Id | google.storage.objects |
Fields
Name | Datatype | Description |
---|---|---|
id | string | The ID of the object, including the bucket name, object name, and generation number. |
name | string | The name of the object. Required if not specified by URL parameter. |
acl | array | Access controls on the object. |
bucket | string | The name of the bucket containing this object. |
cacheControl | string | Cache-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. |
componentCount | integer | Number of underlying components that make up this object. Components are accumulated by compose operations. |
contentDisposition | string | Content-Disposition of the object data. |
contentEncoding | string | Content-Encoding of the object data. |
contentLanguage | string | Content-Language of the object data. |
contentType | string | Content-Type of the object data. If an object is stored without a Content-Type, it is served as application/octet-stream. |
crc32c | string | CRC32c 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. |
customTime | string | A timestamp in RFC 3339 format specified by the user for an object. |
customerEncryption | object | Metadata of customer-supplied encryption key, if the object is encrypted by such a key. |
etag | string | HTTP 1.1 Entity tag for the object. |
eventBasedHold | boolean | Whether 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. |
generation | string | The content generation of this object. Used for object versioning. |
hardDeleteTime | string | This 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. |
kind | string | The kind of item this is. For objects, this is always storage#object. |
kmsKeyName | string | Not currently supported. Specifying the parameter causes the request to fail with status code 400 - Bad Request. |
md5Hash | string | MD5 hash of the data; encoded using base64. For more information about using the MD5 hash, see Data Validation and Change Detection. |
mediaLink | string | Media download link. |
metadata | object | User-provided metadata, in key/value pairs. |
metageneration | string | The 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. |
owner | object | The owner of the object. This will always be the uploader of the object. |
retention | object | A collection of object level retention parameters. |
retentionExpirationTime | string | A 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). |
selfLink | string | The link to this object. |
size | string | Content-Length of the data in bytes. |
softDeleteTime | string | The time at which the object became soft-deleted in RFC 3339 format. |
storageClass | string | Storage class of the object. |
temporaryHold | boolean | 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. |
timeCreated | string | The creation time of the object in RFC 3339 format. |
timeDeleted | string | The 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. |
timeStorageClassUpdated | string | The time at which the object's storage class was last changed. When the object is initially created, it will be set to timeCreated. |
updated | string | The 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
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | bucket, object | Retrieves an object or its metadata. |
list | SELECT | bucket | Retrieves a list of objects matching the criteria. |
insert | INSERT | bucket | Stores a new object and metadata. |
delete | DELETE | bucket, object | Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used. |
patch | UPDATE | bucket, object | Patches an object's metadata. |
update | REPLACE | bucket, object | Updates an object's metadata. |
bulk_restore | EXEC | bucket | Initiates a long-running bulk restore operation on the specified bucket. |
compose | EXEC | destinationBucket, destinationObject | Concatenates a list of existing objects into a new object in the same bucket. |
copy | EXEC | destinationBucket, destinationObject, sourceBucket, sourceObject | Copies a source object to a destination object. Optionally overrides metadata. |
restore | EXEC | bucket, generation, object | Restores a soft-deleted object. |
rewrite | EXEC | destinationBucket, destinationObject, sourceBucket, sourceObject | Rewrites a source object to a destination object. Optionally overrides metadata. |
watch_all | EXEC | bucket | Watch 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.
- All Properties
- Manifest
/*+ 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 }}'
;
- name: your_resource_model_name
props:
- name: acl
value:
- - name: bucket
value: string
- name: domain
value: string
- name: email
value: string
- name: entity
value: string
- name: entityId
value: string
- name: etag
value: string
- name: generation
value: string
- name: id
value: string
- name: kind
value: string
- name: object
value: string
- name: projectTeam
value:
- name: projectNumber
value: string
- name: team
value: string
- name: role
value: string
- name: selfLink
value: string
- name: bucket
value: string
- name: cacheControl
value: string
- name: componentCount
value: integer
- name: contentDisposition
value: string
- name: contentEncoding
value: string
- name: contentLanguage
value: string
- name: contentType
value: string
- name: crc32c
value: string
- name: customTime
value: string
- name: customerEncryption
value:
- name: encryptionAlgorithm
value: string
- name: keySha256
value: string
- name: etag
value: string
- name: eventBasedHold
value: boolean
- name: generation
value: string
- name: id
value: string
- name: kind
value: string
- name: kmsKeyName
value: string
- name: md5Hash
value: string
- name: mediaLink
value: string
- name: metadata
value: object
- name: metageneration
value: string
- name: name
value: string
- name: owner
value:
- name: entity
value: string
- name: entityId
value: string
- name: retentionExpirationTime
value: string
- name: retention
value:
- name: retainUntilTime
value: string
- name: mode
value: string
- name: selfLink
value: string
- name: size
value: string
- name: storageClass
value: string
- name: temporaryHold
value: boolean
- name: timeCreated
value: string
- name: timeDeleted
value: string
- name: softDeleteTime
value: string
- name: hardDeleteTime
value: string
- name: timeStorageClassUpdated
value: string
- name: updated
value: string
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 }}';