S3 / Paginator / ListObjectVersions

ListObjectVersions#

class S3.Paginator.ListObjectVersions#
paginator = client.get_paginator('list_object_versions')
paginate(**kwargs)#

Creates an iterator that will paginate through responses from S3.Client.list_object_versions().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    Bucket='string',
    Delimiter='string',
    EncodingType='url',
    Prefix='string',
    ExpectedBucketOwner='string',
    RequestPayer='requester',
    OptionalObjectAttributes=[
        'RestoreStatus',
    ],
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters:
  • Bucket (string) –

    [REQUIRED]

    The bucket name that contains the objects.

  • 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.

  • EncodingType (string) – Requests Amazon S3 to encode the object keys in the response and specifies the encoding method to use. An object key can contain any Unicode character; however, the XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that Amazon S3 encode the keys in the response.

  • 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.

  • ExpectedBucketOwner (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).

  • RequestPayer (string) –

    Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see Downloading Objects in Requester Pays Buckets in the Amazon S3 User Guide.

    Note

    This functionality is not supported for directory buckets.

  • OptionalObjectAttributes (list) –

    Specifies the optional fields that you want returned in the response. Fields that you do not specify are not returned.

    • (string) –

  • PaginationConfig (dict) –

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) –

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) –

      The size of each page.

    • StartingToken (string) –

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type:

dict

Returns:

Response Syntax

{
    'IsTruncated': True|False,
    'KeyMarker': 'string',
    'VersionIdMarker': 'string',
    'Versions': [
        {
            'ETag': 'string',
            'ChecksumAlgorithm': [
                'CRC32'|'CRC32C'|'SHA1'|'SHA256',
            ],
            'Size': 123,
            'StorageClass': 'STANDARD',
            'Key': 'string',
            'VersionId': 'string',
            'IsLatest': True|False,
            'LastModified': datetime(2015, 1, 1),
            'Owner': {
                'DisplayName': 'string',
                'ID': 'string'
            },
            'RestoreStatus': {
                'IsRestoreInProgress': True|False,
                'RestoreExpiryDate': datetime(2015, 1, 1)
            }
        },
    ],
    'DeleteMarkers': [
        {
            'Owner': {
                'DisplayName': 'string',
                'ID': 'string'
            },
            'Key': 'string',
            'VersionId': 'string',
            'IsLatest': True|False,
            'LastModified': datetime(2015, 1, 1)
        },
    ],
    'Name': 'string',
    'Prefix': 'string',
    'Delimiter': 'string',
    'MaxKeys': 123,
    'CommonPrefixes': [
        {
            'Prefix': 'string'
        },
    ],
    'EncodingType': 'url',
    'RequestCharged': 'requester',
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • IsTruncated (boolean) –

      A flag that indicates whether Amazon S3 returned all of the results that satisfied the search criteria. If your results were truncated, you can make a follow-up paginated request by using the NextKeyMarker and NextVersionIdMarker response parameters as a starting place in another request to return the rest of the results.

    • KeyMarker (string) –

      Marks the last key returned in a truncated response.

    • VersionIdMarker (string) –

      Marks the last version of the key returned in a truncated response.

    • Versions (list) –

      Container for version information.

      • (dict) –

        The version of an object.

        • ETag (string) –

          The entity tag is an MD5 hash of that version of the object.

        • ChecksumAlgorithm (list) –

          The algorithm that was used to create a checksum of the object.

          • (string) –

        • Size (integer) –

          Size in bytes of the object.

        • StorageClass (string) –

          The class of storage used to store the object.

        • Key (string) –

          The object key.

        • VersionId (string) –

          Version ID of an object.

        • IsLatest (boolean) –

          Specifies whether the object is (true) or is not (false) the latest version of an object.

        • LastModified (datetime) –

          Date and time when the object was last modified.

        • Owner (dict) –

          Specifies the owner of the object.

          • DisplayName (string) –

            Container for the display name of the owner. This value is only supported in the following Amazon Web Services Regions:

            • US East (N. Virginia)

            • US West (N. California)

            • US West (Oregon)

            • Asia Pacific (Singapore)

            • Asia Pacific (Sydney)

            • Asia Pacific (Tokyo)

            • Europe (Ireland)

            • South America (São Paulo)

            Note

            This functionality is not supported for directory buckets.

          • ID (string) –

            Container for the ID of the owner.

        • RestoreStatus (dict) –

          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.

          • IsRestoreInProgress (boolean) –

            Specifies whether the object is currently being restored. If the object restoration is in progress, the header returns the value TRUE. For example:

            x-amz-optional-object-attributes: IsRestoreInProgress="true"

            If the object restoration has completed, the header returns the value FALSE. For example:

            x-amz-optional-object-attributes: IsRestoreInProgress="false", RestoreExpiryDate="2012-12-21T00:00:00.000Z"

            If the object hasn’t been restored, there is no header response.

          • RestoreExpiryDate (datetime) –

            Indicates when the restored copy will expire. This value is populated only if the object has already been restored. For example:

            x-amz-optional-object-attributes: IsRestoreInProgress="false", RestoreExpiryDate="2012-12-21T00:00:00.000Z"

    • DeleteMarkers (list) –

      Container for an object that is a delete marker.

      • (dict) –

        Information about the delete marker.

        • Owner (dict) –

          The account that created the delete marker.>

          • DisplayName (string) –

            Container for the display name of the owner. This value is only supported in the following Amazon Web Services Regions:

            • US East (N. Virginia)

            • US West (N. California)

            • US West (Oregon)

            • Asia Pacific (Singapore)

            • Asia Pacific (Sydney)

            • Asia Pacific (Tokyo)

            • Europe (Ireland)

            • South America (São Paulo)

            Note

            This functionality is not supported for directory buckets.

          • ID (string) –

            Container for the ID of the owner.

        • Key (string) –

          The object key.

        • VersionId (string) –

          Version ID of an object.

        • IsLatest (boolean) –

          Specifies whether the object is (true) or is not (false) the latest version of an object.

        • LastModified (datetime) –

          Date and time when the object was last modified.

    • Name (string) –

      The bucket name.

    • Prefix (string) –

      Selects objects that start with the value supplied by this parameter.

    • Delimiter (string) –

      The delimiter grouping the included keys. 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.

    • MaxKeys (integer) –

      Specifies the maximum number of objects to return.

    • CommonPrefixes (list) –

      All of the keys rolled up into a common prefix count as a single return when calculating the number of returns.

      • (dict) –

        Container for all (if there are any) keys between Prefix and the next occurrence of the string specified by a delimiter. CommonPrefixes lists keys that act like subdirectories in the directory specified by Prefix. For example, if the prefix is notes/ and the delimiter is a slash (/) as in notes/summer/july, the common prefix is notes/summer/.

        • Prefix (string) –

          Container for the specified common prefix.

    • EncodingType (string) –

      Encoding type used by Amazon S3 to encode object key names in the XML response.

      If you specify the encoding-type request parameter, Amazon S3 includes this element in the response, and returns encoded key name values in the following response elements:

      KeyMarker, NextKeyMarker, Prefix, Key, and Delimiter.

    • RequestCharged (string) –

      If present, indicates that the requester was successfully charged for the request.

      Note

      This functionality is not supported for directory buckets.

    • NextToken (string) –

      A token to resume pagination.