Skip to content

Instantly share code, notes, and snippets.

@1st8
Last active June 5, 2020 12:25
Show Gist options
  • Save 1st8/65a141ab40ac90d721ce0a0b026953aa to your computer and use it in GitHub Desktop.
Save 1st8/65a141ab40ac90d721ce0a0b026953aa to your computer and use it in GitHub Desktop.
ExAws.S3 put_bucket_notification simple implementation (minio enable webhooks)
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