Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Add prefix to scripts #116

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

drags
Copy link

@drags drags commented Mar 12, 2020

Adds --prefix argument to scan_bucket.py and display_infected.py to limit the objects considered for each.

For buckets with many (>100,000) the scan_bucket.py and display_infected.py scripts can incur long running times and non-negligible API costs to iterate an entire bucket. The --prefix option passes a string to the ListObjectsV2 Prefix parameter which limits the objects to iterate and consider.

Note: the long runtime/incurred costs issue remains present in the existing --limit argument as it currently iterates the entire bucket before trimming the returned objects with a Python slice. I'm making these patches on a contract job so I don't have time to fix the pagination logic for this issue. Please advise if you'd like a separate issue to track.

Accept a prefix to filter items by in scan_bucket/display_infected
scripts. This is useful for users with large buckets who want to limit
the time/cost of running these scripts.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants