Steps to follow:
- start vstart cluster
$ MON=1 OSD=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh -n -d
- on a separate terminal start an HTTP endpoint:
$ wget https://gist.githubusercontent.com/mdonkers/63e115cc0c79b4f6b8b3a6b797e485c7/raw/a6a1d090ac8549dac8f2bd607bd64925de997d40/server.py
$ python server.py 10900
- on a separate terminal start an HTTP endpoint:
$ wget https://gist.githubusercontent.com/mdonkers/63e115cc0c79b4f6b8b3a6b797e485c7/raw/a6a1d090ac8549dac8f2bd607bd64925de997d40/server.py
$ python server.py 10900
- create a persistent topic pointing to the above HTTP endpoint:
$ aws --endpoint-url http://localhost:8000 sns create-topic --name=fishtopic \
--attributes='{"push-endpoint": "http://localhost:10900", "persistent": "true"}'
- create a bucket:
$ aws --endpoint-url http://localhost:8000 s3 mb s3://fish
- create different notification configurations pointing to said bucket
notif-1 is triggered for all objects created or deleted not starting with key 'hello'
aws --endpoint-url http://localhost:8000 s3api put-bucket-notification-configuration --bucket fish --notification-configuration='{"TopicConfigurations": [{"Id": "notif1", "TopicArn": "arn:aws:sns:default::fishtopic", "Events": [], "Filter": {"Key": {"FilterRules": [{"Name": "prefix", "Value": "hello", "Type": "OUT"}]}}}]}'
notif-2is triggered for all objects created or deleted ending with value 'fish'
aws --endpoint-url http://localhost:8000 s3api put-bucket-notification-configuration --bucket fish --notification-configuration='{"TopicConfigurations": [{"Id": "notif1", "TopicArn": "arn:aws:sns:default::fishtopic", "Events": [], "Filter": {"Key": {"FilterRules": [{"Name": "suffix", "Value": "fish", "Type": "IN"}]}}}]}'
- make an object called 'hellofish' on the bucket -
notif2should be triggered
head -c 512 </dev/urandom > hellofish
aws --endpoint-url http://localhost:8000 s3 cp hellofish s3://fish --checksum-algorithm CRC32
- make another object called '123fish' -
notif1andnotif2should be triggered
head -c 512 </dev/urandom > 123fish
aws --endpoint-url http://localhost:8000 s3 cp 123fish s3://fish --checksum-algorithm CRC32
- make another object called 'foobar' -
notif1should be trigerred
head -c 512 </dev/urandom > foobar
aws --endpoint-url http://localhost:8000 s3 cp foobar s3://fish --checksum-algorithm CRC32
- make another object called 'helloabc' - no notification should be trigerred
head -c 512 </dev/urandom > helloabc
aws --endpoint-url http://localhost:8000 s3 cp helloabc s3://fish --checksum-algorithm CRC32