Search in sources :

Example 26 with SnsClient

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

the class SetTopicAttributes method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "   <attribute> <topicArn> <value>\n\n" + "Where:\n" + "   attribute - the attribute action to use. Valid parameters are: Policy | DisplayName | DeliveryPolicy .\n" + "   topicArn - The ARN of the topic. \n" + "   value - the value for the attribute.\n\n";
    if (args.length < 3) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String attribute = args[0];
    String topicArn = args[1];
    String value = args[2];
    SnsClient snsClient = SnsClient.builder().region(Region.US_WEST_2).build();
    setTopAttr(snsClient, attribute, topicArn, value);
    snsClient.close();
}
Also used : SnsClient(software.amazon.awssdk.services.sns.SnsClient)

Example 27 with SnsClient

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

the class SubscribeLambda method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "   <topicArn> <lambdaArn>\n\n" + "Where:\n" + "   topicArn - the ARN of the topic to subscribe.\n\n" + "   lambdaArn - the ARN of an AWS Lambda function.\n\n";
    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String topicArn = args[0];
    String lambdaArn = args[1];
    SnsClient snsClient = SnsClient.builder().region(Region.US_WEST_2).build();
    String arnValue = subLambda(snsClient, topicArn, lambdaArn);
    System.out.println("Subscription ARN: " + arnValue);
    snsClient.close();
}
Also used : SnsClient(software.amazon.awssdk.services.sns.SnsClient)

Example 28 with SnsClient

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

the class SubscribeTextSMS method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "   <topicArn> <phoneNumber>\n\n" + "Where:\n" + "   topicArn - the ARN of the topic to subscribe.\n\n" + "   phoneNumber - a mobile phone number that receives notifications (for example, +1XXX5550100).\n\n";
    if (args.length < 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String topicArn = args[0];
    String phoneNumber = args[1];
    SnsClient snsClient = SnsClient.builder().region(Region.US_WEST_2).build();
    subTextSNS(snsClient, topicArn, phoneNumber);
    snsClient.close();
}
Also used : SnsClient(software.amazon.awssdk.services.sns.SnsClient)

Example 29 with SnsClient

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

the class UseMessageFilterPolicy method main.

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

Example 30 with SnsClient

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

the class CheckOptOut method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "   <phoneNumber>\n\n" + "Where:\n" + "   phoneNumber - the mobile phone number to look up (for example, +1XXX5550100).\n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String phoneNumber = args[0];
    SnsClient snsClient = SnsClient.builder().region(Region.US_EAST_1).build();
    checkPhone(snsClient, phoneNumber);
    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