Skip to content

Commit

Permalink
Merge pull request aws-samples#7 from nicka/master
Browse files Browse the repository at this point in the history
Add startAfter support
  • Loading branch information
glez-aws authored Jul 20, 2017
2 parents 0f5cbf4 + 47c9abd commit b903c7c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ Optionally sync based on a prefix:
}
```

Optionally sync after a specific key:

```json
{
"source": "...",
"destination": "...",
"startAfter": "images/1000"
}
```

## How to uninstall

This assumes that you're still working from the sync-buckets-state-machine that you installed into in the steps above.
Expand Down
5 changes: 4 additions & 1 deletion lambda_functions/list_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
SAFETY_MARGIN = 10.0 # Percent
MAX_RESULT_LENGTH = int(MAX_DATA_SIZE * (1.0 - (SAFETY_MARGIN / 100.0)))
PREFIX = '' # Copy objects based on a provided prefix e.g. '/images/'
START_AFTER = '' # List objects after a specific key e.g. '/images/1000'


# Globals
Expand All @@ -63,11 +64,13 @@ def handler(event, context):
token = event.get('listResult', {}).get('token', '')
max_keys = event.get('maxKeys', MAX_KEYS)
prefix = event.get('prefix', PREFIX)
start_after = event.get('startAfter', START_AFTER)

args = {
'Bucket': bucket,
'MaxKeys': max_keys,
'Prefix': prefix
'Prefix': prefix,
'StartAfter': start_after
}

result = {}
Expand Down

0 comments on commit b903c7c

Please sign in to comment.