ObjectManager¶
- class ltdconveyor.s3.ObjectManager(session, bucket_name, bucket_root)¶
Bases:
object
Manage objects existing in a bucket under a specific
bucket_root
.The ObjectManager maintains information about objects that exist in the bucket, and can delete objects that no longer exist in the source.
- Parameters:
session (
boto3.session.Session
) – A boto3 session instance provisioned with the correct identities.bucket_name (
str
) – Name of the S3 bucket.bucket_root (
str
) – The version slug is the name root directory in the bucket where documentation is stored.
Methods Summary
delete_directory
(dirname)Delete a directory (and contents) from the bucket.
delete_file
(filename)Delete a file from the bucket.
list_dirnames_in_directory
(dirname)List all names of directories that exist at the root of this bucket directory.
list_filenames_in_directory
(dirname)List all file-type object names that exist at the root of this bucket directory.
Methods Documentation
- delete_directory(dirname)¶
Delete a directory (and contents) from the bucket.
- Parameters:
dirname (
str
) – Name of the directory, relative tobucket_root/
.- Raises:
RuntimeError – Raised when there are no objects to delete (directory does not exist).
- Return type:
- delete_file(filename)¶
Delete a file from the bucket.
- list_dirnames_in_directory(dirname)¶
List all names of directories that exist at the root of this bucket directory.
Note that directories don’t exist in S3; rather directories are inferred from path names.
- list_filenames_in_directory(dirname)¶
List all file-type object names that exist at the root of this bucket directory.