object_versions
Creates, updates, deletes, gets or lists an object_versions resource.
Overview
| Name | object_versions |
| Type | Resource |
| Id | aws.s3.object_versions |
Fields
The following fields are returned by SELECT queries:
- list_object_versions
| Name | Datatype | Description |
|---|---|---|
checksum_algorithm | string | The algorithm that was used to create a checksum of the object. |
checksum_type | string | The checksum type that is used to calculate the object’s checksum value. For more information, see Checking object integrity in the Amazon S3 User Guide. |
e_tag | string | The entity tag is an MD5 hash of that version of the object. |
is_latest | boolean | Specifies whether the object is (true) or is not (false) the latest version of an object. |
key | string | The object key. |
last_modified | string | Date and time when the object was last modified. |
owner | string | Specifies the owner of the object. |
restore_status | string | Specifies the restoration status of an object. Objects in certain storage classes must be restored before they can be retrieved. For more information about these storage classes and how to work with archived objects, see Working with archived objects in the Amazon S3 User Guide. |
size | integer | Size in bytes of the object. |
storage_class | string | The class of storage used to store the object. |
version_id | string | Version ID of an object. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_object_versions | select | bucket, region | delimiter, encoding-type, key-marker, max-keys, prefix, version-id-marker, x-amz-expected-bucket-owner, x-amz-request-payer, x-amz-optional-object-attributes | This operation is not supported for directory buckets. Returns metadata about all versions of the objects in a bucket. You can also use request parameters as selection criteria to return metadata about a subset of all the object versions. To use this operation, you must have permission to perform the s3:ListBucketVersions action. Be aware of the name difference. A 200 OK response can contain valid or invalid XML. Make sure to design your application to parse the contents of the response and handle it appropriately. To use this operation, you must have READ access to the bucket. The following operations are related to ListObjectVersions: ListObjectsV2 GetObject PutObject DeleteObject You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
bucket | string | The bucket name that contains the objects. |
region | string | AWS region (default: us-east-1) |
delimiter | string | A delimiter is a character that you specify to group keys. All keys that contain the same string between the prefix and the first occurrence of the delimiter are grouped under a single result element in CommonPrefixes. These groups are counted as one result against the max-keys limitation. These keys are not returned elsewhere in the response. CommonPrefixes is filtered out from results if it is not lexicographically greater than the key-marker. |
encoding-type | string | |
key-marker | string | Specifies the key to start with when listing objects in a bucket. |
max-keys | integer | Sets the maximum number of keys returned in the response. By default, the action returns up to 1,000 key names. The response might contain fewer keys but will never contain more. If additional keys satisfy the search criteria, but were not returned because max-keys was exceeded, the response contains <isTruncated>true</isTruncated>. To return the additional keys, see key-marker and version-id-marker. |
prefix | string | Use this parameter to select only those keys that begin with the specified prefix. You can use prefixes to separate a bucket into different groupings of keys. (You can think of using prefix to make groups in the same way that you'd use a folder in a file system.) You can use prefix with delimiter to roll up numerous objects into a single result under CommonPrefixes. |
version-id-marker | string | Specifies the object version you want to start listing from. |
x-amz-expected-bucket-owner | string | The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied). |
x-amz-optional-object-attributes | array | Specifies the optional fields that you want returned in the response. Fields that you do not specify are not returned. |
x-amz-request-payer | string |
SELECT examples
- list_object_versions
This operation is not supported for directory buckets. Returns metadata about all versions of the objects in a bucket. You can also use request parameters as selection criteria to return metadata about a subset of all the object versions. To use this operation, you must have permission to perform the s3:ListBucketVersions action. Be aware of the name difference. A 200 OK response can contain valid or invalid XML. Make sure to design your application to parse the contents of the response and handle it appropriately. To use this operation, you must have READ access to the bucket. The following operations are related to ListObjectVersions: ListObjectsV2 GetObject PutObject DeleteObject You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt.
SELECT
checksum_algorithm,
checksum_type,
e_tag,
is_latest,
key,
last_modified,
owner,
restore_status,
size,
storage_class,
version_id
FROM aws.s3.object_versions
WHERE bucket = '{{ bucket }}' -- required
AND region = '{{ region }}' -- required
AND delimiter = '{{ delimiter }}'
AND `encoding-type` = '{{ encoding-type }}'
AND `key-marker` = '{{ key-marker }}'
AND `max-keys` = '{{ max-keys }}'
AND prefix = '{{ prefix }}'
AND `version-id-marker` = '{{ version-id-marker }}'
AND `x-amz-expected-bucket-owner` = '{{ x-amz-expected-bucket-owner }}'
AND `x-amz-request-payer` = '{{ x-amz-request-payer }}'
AND `x-amz-optional-object-attributes` = '{{ x-amz-optional-object-attributes }}'
;