IPWorks S3 2020 Python Edition

Questions / Feedback?

object_prefix Property

A prefix used to restrict the results returned when listing objects.

Syntax

def get_object_prefix() -> str: ...
def set_object_prefix(value: str) -> None: ...

object_prefix = property(get_object_prefix, set_object_prefix)

Default Value

""

Remarks

This property, if non-empty, is used to restrict the results returned by list_objects (or list_versions) to only the objects (or object versions) whose names begin with the given value.

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 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]