s3-resource-simple/assets/check

17 lines
406 B
Text
Raw Normal View History

#!/bin/sh
set -e
source "$(dirname $0)/common.sh"
payload=`cat`
bucket=$(get_bucket)
2018-10-30 01:56:37 +01:00
prefix=$(get_prefix)
export_aws_vars
# Consider the most recent LastModified timestamp as the most recent version.
timestamps=$(aws s3api list-objects --bucket $bucket --prefix "$prefix" --query 'Contents[].{LastModified: LastModified}')
recent="$(echo $timestamps | jq -r 'max_by(.LastModified)')"
echo "[$recent]"