Last active
June 5, 2020 12:25
-
-
Save 1st8/65a141ab40ac90d721ce0a0b026953aa to your computer and use it in GitHub Desktop.
ExAws.S3 put_bucket_notification simple implementation (minio enable webhooks)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.Storage do | |
def enable_notifications(bucket) do | |
body = """ | |
<NotificationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<QueueConfiguration> | |
<Id>opencake</Id> | |
<Queue>arn:minio:sqs::_:webhook</Queue> | |
<Event>s3:ObjectCreated:*</Event> | |
<Event>s3:ObjectRemoved:*</Event> | |
</QueueConfiguration> | |
</NotificationConfiguration> | |
""" | |
%ExAws.Operation.S3{ | |
http_method: :put, | |
bucket: bucket, | |
path: "/", | |
body: body, | |
headers: %{}, | |
resource: "notification" | |
} | |
|> ExAws.request!() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment