Skip to content

Instantly share code, notes, and snippets.

@deekoder
Created October 17, 2017 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deekoder/1519163f1891e70d1106ed5e97cf833c to your computer and use it in GitHub Desktop.
Save deekoder/1519163f1891e70d1106ed5e97cf833c to your computer and use it in GitHub Desktop.
Sets up a bucket notification to Postgres
func setUp() {
minioClient, err := minio.New("192.168.1.15:9000", "minio", "minio123", false)
if err != nil {
log.Fatalln(err)
}
queueArn := minio.NewArn("minio", "sqs", "", "1", "postgresql")
queueConfig := minio.NewNotificationConfig(queueArn)
queueConfig.AddEvents(minio.ObjectCreatedAll, minio.ObjectRemovedAll)
bucketNotification := minio.BucketNotification{}
bucketNotification.AddQueue(queueConfig)
err = minioClient.SetBucketNotification("barcodes", bucketNotification)
if err != nil {
fmt.Println("Unable to set the bucket notification: ", err)
}
fmt.Println("Set Bucket Notification successfully")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment