Example usage for com.amazonaws.services.sns.model SetTopicAttributesRequest SetTopicAttributesRequest

List of usage examples for com.amazonaws.services.sns.model SetTopicAttributesRequest SetTopicAttributesRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.sns.model SetTopicAttributesRequest SetTopicAttributesRequest.

Prototype

public SetTopicAttributesRequest() 

Source Link

Document

Default constructor for SetTopicAttributesRequest object.

Usage

From source file:com.netflix.spinnaker.clouddriver.aws.lifecycle.InstanceTerminationLifecycleAgent.java

License:Apache License

private static String ensureTopicExists(AmazonSNS amazonSNS, ARN topicARN, List<String> allAccountIds,
        ARN queueARN) {// ww  w . j  av a  2  s. c  om
    topicARN.arn = amazonSNS.createTopic(topicARN.name).getTopicArn();

    amazonSNS.setTopicAttributes(new SetTopicAttributesRequest().withTopicArn(topicARN.arn)
            .withAttributeName("Policy").withAttributeValue(buildSNSPolicy(topicARN, allAccountIds).toJson()));

    amazonSNS.subscribe(topicARN.arn, "sqs", queueARN.arn);

    return topicARN.arn;
}

From source file:com.netflix.spinnaker.clouddriver.aws.lifecycle.LaunchFailureNotificationAgent.java

License:Apache License

/**
 * Ensure that the topic exists and has a policy granting all accounts permission to publish messages to it
 *//*from   w  w  w.  ja v a2  s .  c  o m*/
private static String ensureTopicExists(AmazonSNS amazonSNS, ARN topicARN, List<String> allAccountIds,
        ARN queueARN) {
    topicARN.arn = amazonSNS.createTopic(topicARN.name).getTopicArn();

    amazonSNS.setTopicAttributes(new SetTopicAttributesRequest().withTopicArn(topicARN.arn)
            .withAttributeName("Policy").withAttributeValue(buildSNSPolicy(topicARN, allAccountIds).toJson()));

    amazonSNS.subscribe(topicARN.arn, "sqs", queueARN.arn);

    return topicARN.arn;
}