List of usage examples for com.amazonaws.services.sns AmazonSNS subscribe
SubscribeResult subscribe(String topicArn, String protocol, String endpoint);
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) {//w w w. j a va2 s . c o m 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 ww .jav a 2 s. co 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; }
From source file:com.netflix.spinnaker.echo.pubsub.amazon.SQSSubscriber.java
License:Apache License
private static String subscribeToTopic(AmazonSNS amazonSNS, ARN topicARN, ARN queueARN) { amazonSNS.subscribe(topicARN.getArn(), "sqs", queueARN.getArn()); return topicARN.getArn(); }
From source file:com.netflix.spinnaker.kork.aws.pubsub.PubSubUtils.java
License:Apache License
public static String subscribeToTopic(AmazonSNS amazonSNS, ARN topicARN, ARN queueARN) { amazonSNS.subscribe(topicARN.getArn(), "sqs", queueARN.getArn()); return topicARN.getArn(); }