s3-resource-simple/assets/check

18 lines
498 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)
2021-03-25 01:57:12 +01:00
aws_options=$(echo "$payload" | jq -r '.source.aws_options // [] | join(" ")')
export_aws_vars
# Consider the most recent LastModified timestamp as the most recent version.
2021-03-25 01:57:12 +01:00
timestamps=$(aws $aws_options s3api list-objects --bucket $bucket --prefix "$prefix" --query 'Contents[].{LastModified: LastModified}')
recent="$(echo $timestamps | jq -r 'max_by(.LastModified)')"
echo "[$recent]"