-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·30 lines (25 loc) · 778 Bytes
/
run.sh
File metadata and controls
executable file
·30 lines (25 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env sh
echo "Copying file into bucket"
aws s3 cp some-log-file.log s3://your-bucket-name/ --endpoint-url http://localhost:4566
sleep 1
echo "SQS notification record:"
MESSAGE=$(aws sqs receive-message --queue-url http://localhost:4566/000000000000/s3-event-notification-queue --endpoint-url http://localhost:4566 | jq -r '.Messages[0].Body')
validate_json() {
echo "$1" | jq -e '
.Service and
.Event and
.Time and
.Bucket and
.RequestId and
.HostId and
(.Service == "Amazon S3") and
(.Event == "s3:TestEvent")
' > /dev/null
}
if validate_json "$MESSAGE"; then
echo "Test passed: Received valid message."
else
echo "Test failed: Message does not match expected structure or values."
echo "Received: $MESSAGE"
exit 1
fi