Search in sources :

Example 6 with SnsClient

use of software.amazon.awssdk.services.sns.SnsClient in project aws-doc-sdk-examples by awsdocs.

the class CreateTopic method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "   <topicName>\n\n" + "Where:\n" + "   topicName - the name of the topic to create (for example, mytopic).\n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String topicName = args[0];
    System.out.println("Creating a topic with name: " + topicName);
    SnsClient snsClient = SnsClient.builder().region(Region.US_WEST_2).build();
    String arnVal = createSNSTopic(snsClient, topicName);
    System.out.println("The topic ARN is" + arnVal);
    snsClient.close();
}
Also used : SnsClient(software.amazon.awssdk.services.sns.SnsClient)

Example 7 with SnsClient

use of software.amazon.awssdk.services.sns.SnsClient in project aws-doc-sdk-examples by awsdocs.

the class DeleteTopic method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "    <topicArn>\n\n" + "Where:\n" + "   topicArn - the ARN of the topic to delete.\n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String topicArn = args[0];
    SnsClient snsClient = SnsClient.builder().region(Region.US_WEST_2).build();
    System.out.println("Deleting a topic with name: " + topicArn);
    deleteSNSTopic(snsClient, topicArn);
    snsClient.close();
}
Also used : SnsClient(software.amazon.awssdk.services.sns.SnsClient)

Example 8 with SnsClient

use of software.amazon.awssdk.services.sns.SnsClient in project aws-doc-sdk-examples by awsdocs.

the class GetTopicAttributes method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "   <topicArn>\n\n" + "Where:\n" + "   topicArn - the ARN of the topic to look up.\n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String topicArn = args[0];
    SnsClient snsClient = SnsClient.builder().region(Region.US_WEST_2).build();
    System.out.println("Getting attributes for a topic with name: " + topicArn);
    getSNSTopicAttributes(snsClient, topicArn);
    snsClient.close();
}
Also used : SnsClient(software.amazon.awssdk.services.sns.SnsClient)

Example 9 with SnsClient

use of software.amazon.awssdk.services.sns.SnsClient in project aws-doc-sdk-examples by awsdocs.

the class ListSubscriptions method main.

public static void main(String[] args) {
    SnsClient snsClient = SnsClient.builder().region(Region.US_WEST_2).build();
    listSNSSubscriptions(snsClient);
    snsClient.close();
}
Also used : SnsClient(software.amazon.awssdk.services.sns.SnsClient)

Example 10 with SnsClient

use of software.amazon.awssdk.services.sns.SnsClient in project aws-doc-sdk-examples by awsdocs.

the class ListTopics method main.

public static void main(String[] args) {
    SnsClient snsClient = SnsClient.builder().region(Region.US_WEST_2).build();
    listSNSTopics(snsClient);
    snsClient.close();
}
Also used : SnsClient(software.amazon.awssdk.services.sns.SnsClient)

Aggregations

SnsClient (software.amazon.awssdk.services.sns.SnsClient)31 Region (software.amazon.awssdk.regions.Region)3 ListSubscriptionsByTopicRequest (software.amazon.awssdk.services.sns.model.ListSubscriptionsByTopicRequest)2 PublishRequest (software.amazon.awssdk.services.sns.model.PublishRequest)2 SnsException (software.amazon.awssdk.services.sns.model.SnsException)2 StringReader (java.io.StringReader)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Document (org.jdom2.Document)1 SAXBuilder (org.jdom2.input.SAXBuilder)1 InputSource (org.xml.sax.InputSource)1 TranslateClient (software.amazon.awssdk.services.translate.TranslateClient)1 TranslateTextRequest (software.amazon.awssdk.services.translate.model.TranslateTextRequest)1 TranslateTextResponse (software.amazon.awssdk.services.translate.model.TranslateTextResponse)1