Example usage for com.amazonaws.services.sns.model Subscription getOwner

List of usage examples for com.amazonaws.services.sns.model Subscription getOwner

Introduction

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

Prototype


public String getOwner() 

Source Link

Document

The subscription's owner.

Usage

From source file:org.lendingclub.mercator.aws.SNSScanner.java

License:Apache License

private void projectSubscription(Topic topic, Subscription subscription) {

    ObjectNode n = mapper.createObjectNode();
    n.put("aws_topicArn", subscription.getTopicArn());
    n.put("aws_endpoint", subscription.getEndpoint());
    n.put("aws_protocol", subscription.getProtocol());
    n.put("aws_owner", subscription.getOwner());
    n.put("aws_region", getRegion().getName());
    n.put("aws_account", getAccountId());
    String cypher = "merge (s:AwsSnsSubscription {aws_arn:{arn}}) set s+={props}, s.updateTs=timestamp()";

    getNeoRxClient().execCypher(cypher, "arn", subscription.getSubscriptionArn(), "props", n);

    cypher = "match (a:AwsSnsSubscription {aws_arn:{subscriptionArn}}), (t:AwsSnsTopic {aws_arn:{topicArn}}) MERGE (t)-[r:HAS_SUBSCRIPTION]->(a) set r.updateTs=timestamp()";

    getNeoRxClient().execCypher(cypher, "subscriptionArn", subscription.getSubscriptionArn(), "topicArn",
            topic.getTopicArn());/*from   w  w w . ja v  a 2  s  .c  o m*/

    String targetArn = subscription.getEndpoint();
    if (targetArn.startsWith("arn:aws:sqs:")) {
        cypher = "match (a:AwsSnsTopic {aws_arn:{topicArn}}),(q:AwsSqsQueue {aws_arn:{queueArn}}) MERGE (a)-[r:PUBLISHES]->(q) set r.updateTs=timestamp()";
        getNeoRxClient().execCypher(cypher, "topicArn", subscription.getTopicArn(), "queueArn", targetArn);

    }
}