IPWorks S3 2020 Python Edition

Questions / Feedback?

list_versions Method

Lists the object versions in a bucket.

Syntax

def list_versions() -> None: ...

Remarks

This method lists the object versions in the bucket currently selected by bucket.

Before calling this method, the object_prefix property may be set in order to restrict the results to only the object versions whose names begin with a given string. The object_delimiter property can also be used to further tune the results returned. The MaxObjects configuration setting may be used to limit the number of results returned.

Calling this method will fire the on_object_list event once for each object version, and will also populate the Objects* properties. It may also fire the on_prefix_list event, and populate the PrefixCount and Prefix[i] configuration settings, depending on how the properties discussed above are set.

If there are still more object versions available to list when this method returns, the version_marker property will be populated. Continue to call this method until version_marker is empty to accumulate all pages of results in the Objects* properties.

Object Hierarchy Traversal

By using the object_delimiter and object_prefix properties in tandem, applications can effectively "traverse" a virtual hierarchy of objects (or object versions) as if it were a filesystem. For example, assume that objects with the following names exist within a bucket:

  • MyCompany/
  • MyCompany/Department1/
  • MyCompany/Department2/
  • MyCompany/Department2/EmployeeA
  • MyCompany/Department2/EmployeeB

With object_delimiter set to /, we can set object_prefix to successively "deeper" values before calling list_objects or on_list_versions for the following effect:

object_prefix Value object_delimiter Value Objects Returned Prefixes Returned
(empty) /(none) MyCompany/
MyCompany/ /MyCompany/ MyCompany/Department1/
MyCompany/Department2/
MyCompany/Department2/ /MyCompany/Department2/
MyCompany/Department2/EmployeeA
MyCompany/Department2/EmployeeB
(none)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks S3 2020 Python Edition - Version 20.0 [Build 8164]