/*
 * Minio Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2017 Minio, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.IOException;

import java.security.NoSuchAlgorithmException;
import java.security.InvalidKeyException;

import java.util.LinkedList;
import java.util.List;

import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.messages.NotificationConfiguration;
import io.minio.messages.TopicConfiguration;
import io.minio.messages.EventType;
import io.minio.messages.Filter;

import io.minio.errors.MinioException;

public class SetBucketNotification {
  /**
   * MinioClient.setBucketNotification() example.
   */
  public static void main(String[] args)
    throws IOException, NoSuchAlgorithmException, InvalidKeyException, XmlPullParserException {
    try {
      /* play.minio.io for test and development. */
      MinioClient minioClient = new MinioClient("https://play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F",
                                                "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");

      /* Amazon S3: */
      // MinioClient minioClient = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID",
      //                                           "YOUR-SECRETACCESSKEY");

      // Get current notification configuration.
      NotificationConfiguration notificationConfiguration = minioClient.getBucketNotification("my-bucketname");

      // Add a new topic configuration.
      List<TopicConfiguration> topicConfigurationList = notificationConfiguration.topicConfigurationList();
      TopicConfiguration topicConfiguration = new TopicConfiguration();
      topicConfiguration.setTopic("arn:aws:sns:us-west-2:444455556666:sns-topic-xyz");

      List<EventType> eventList = new LinkedList<>();
      eventList.add(EventType.OBJECT_CREATED_PUT);
      eventList.add(EventType.OBJECT_CREATED_COPY);
      topicConfiguration.setEvents(eventList);

      Filter filter = new Filter();
      filter.setPrefixRule("images");
      filter.setSuffixRule("pg");
      topicConfiguration.setFilter(filter);

      topicConfigurationList.add(topicConfiguration);
      notificationConfiguration.setTopicConfigurationList(topicConfigurationList);

      // Set updated notification configuration.
      minioClient.setBucketNotification("my-bucketname", notificationConfiguration);
      System.out.println("Bucket notification is set successfully");
    } catch (MinioException e) {
      System.out.println("Error occurred: " + e);
    }
  }
}

@@ -62,16 +62,22 @@
 (C) 2017
+, 2018
  Minio, 
@@ -970,21 +970,21 @@
 essages.
-Topic
+Queue
 Configur
@@ -1355,27 +1355,25 @@
      /* 
-play.minio.
+Local Min
 io for t
@@ -1453,146 +1453,63 @@
 http
-s
 ://
-play.minio.io:9000%22, %22Q3AM3UQ867SPQQA43P2F%22,%0A                                                %22zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
+127.0.0.1:9000%22, %22YOUR-ACCESSKEYID%22, %22YOUR-SECRETKEY
 %22);%0A
@@ -1889,21 +1889,19 @@
 d a new 
-topic
+SQS
  configu
@@ -1919,21 +1919,21 @@
    List%3C
-Topic
+Queue
 Configur
@@ -1939,21 +1939,21 @@
 ration%3E 
-topic
+queue
 Configur
@@ -1990,21 +1990,21 @@
 uration.
-topic
+queue
 Configur
@@ -2022,21 +2022,21 @@
 ;%0A      
-Topic
+Queue
 Configur
@@ -2041,21 +2041,21 @@
 uration 
-topic
+queue
 Configur
@@ -2066,21 +2066,21 @@
 n = new 
-Topic
+Queue
 Configur
@@ -2086,37 +2086,37 @@
 ration();%0A      
-topic
+queue
 Configuration.se
@@ -2120,63 +2120,39 @@
 .set
-Topic
+Queue
 (%22arn:
-aws:sns:us-west-2:444455556666:sns-topic-xyz
+minio:sqs::1:webhook
 %22);%0A
@@ -2307,37 +2307,37 @@
 ED_COPY);%0A      
-topic
+queue
 Configuration.se
@@ -2467,29 +2467,29 @@
 pg%22);%0A      
-topic
+queue
 Configuratio
@@ -2494,12 +2494,9 @@
 ion.
-setF
+f
 ilte
@@ -2513,21 +2513,21 @@
 %0A%0A      
-topic
+queue
 Configur
@@ -2540,21 +2540,21 @@
 ist.add(
-topic
+queue
 Configur
@@ -2600,13 +2600,13 @@
 .set
-Topic
+Queue
 Conf
@@ -2623,13 +2623,13 @@
 ist(
-topic
+queue
 Conf

Modify example to use SQS configuration in Notification (#725)