@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTopicArn() == null) ? 0 : getTopicArn().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Topic == false) return false; Topic other = (Topic) obj; if (other.getTopicArn() == null ^ this.getTopicArn() == null) return false; if (other.getTopicArn() != null && other.getTopicArn().equals(this.getTopicArn()) == false) return false; return true; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getTopicArn() != null) sb.append("TopicArn: ").append(getTopicArn()); sb.append("}"); return sb.toString(); }
String arn = topic.getTopicArn();
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTopicArn() == null) ? 0 : getTopicArn().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Topic == false) return false; Topic other = (Topic) obj; if (other.getTopicArn() == null ^ this.getTopicArn() == null) return false; if (other.getTopicArn() != null && other.getTopicArn().equals(this.getTopicArn()) == false) return false; return true; } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getTopicArn() != null) sb.append("TopicArn: " + getTopicArn()); sb.append("}"); return sb.toString(); }
public void marshall(Topic _topic, Request<?> request, String _prefix) { String prefix; if (_topic.getTopicArn() != null) { prefix = _prefix + "TopicArn"; String topicArn = _topic.getTopicArn(); request.addParameter(prefix, StringUtils.fromString(topicArn)); } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTopicArn() == null) ? 0 : getTopicArn().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Topic == false) return false; Topic other = (Topic) obj; if (other.getTopicArn() == null ^ this.getTopicArn() == null) return false; if (other.getTopicArn() != null && other.getTopicArn().equals(this.getTopicArn()) == false) return false; return true; } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getTopicArn() != null) sb.append("TopicArn: " + getTopicArn()); sb.append("}"); return sb.toString(); }
public void marshall(Topic _topic, Request<?> request, String _prefix) { String prefix; if (_topic.getTopicArn() != null) { prefix = _prefix + "TopicArn"; String topicArn = _topic.getTopicArn(); request.addParameter(prefix, StringUtils.fromString(topicArn)); } }
@Override public Collection<NevadoTopic> listTopics() throws JMSException { Collection<NevadoTopic> topics; ListTopicsResult result; try { result = _amazonSNS.listTopics(); } catch (AmazonClientException e) { throw handleAWSException("Unable to list topics", e); } topics = new HashSet<NevadoTopic>(result.getTopics().size()); for(Topic topic : result.getTopics()) { topics.add(new NevadoTopic(topic.getTopicArn())); } return topics; }
private String getTopicResourceName(String marker, String topicName) { ListTopicsResult listTopicsResult = this.amazonSns.listTopics(new ListTopicsRequest(marker)); for (Topic topic : listTopicsResult.getTopics()) { AmazonResourceName resourceName = AmazonResourceName.fromString(topic.getTopicArn()); if (resourceName.getResourceType().equals(topicName)) { return topic.getTopicArn(); } } if (StringUtils.hasText(listTopicsResult.getNextToken())) { return getTopicResourceName(listTopicsResult.getNextToken(), topicName); } else { throw new IllegalArgumentException("No topic found for name :'" + topicName + "'"); } } }
private void scanSubscriptions(Topic topic) { ListSubscriptionsByTopicResult result = getClient().listSubscriptionsByTopic(topic.getTopicArn()); String token = null; do { rateLimit(); token = result.getNextToken(); for (Subscription subscription : result.getSubscriptions()) { projectSubscription(topic, subscription); } result = getClient().listSubscriptionsByTopic(topic.getTopicArn(), token); } while ((!Strings.isNullOrEmpty(token)) && (!token.equals("null"))); }
private String getTopicResourceName(String marker, String topicName) { ListTopicsResult listTopicsResult = this.amazonSns.listTopics(new ListTopicsRequest(marker)); for (Topic topic : listTopicsResult.getTopics()) { AmazonResourceName resourceName = AmazonResourceName.fromString(topic.getTopicArn()); if (resourceName.getResourceType().equals(topicName)) { return topic.getTopicArn(); } } if (StringUtils.hasText(listTopicsResult.getNextToken())) { return getTopicResourceName(listTopicsResult.getNextToken(), topicName); } else { throw new IllegalArgumentException("No topic found for name :'" + topicName + "'"); } } }
private void projectTopic(Topic topic) { String arn = topic.getTopicArn(); List<String> parts = Splitter.on(":").splitToList(arn); incrementEntityCount(); ObjectNode n = mapper.createObjectNode(); n.put("aws_account", getAccountId()); n.put("aws_region", getRegion().getName()); n.put("name", parts.get(parts.size() - 1)); String cypher = "merge (t:AwsSnsTopic {aws_arn:{arn}}) set t+={props}, t.updateTs=timestamp() return t"; getNeoRxClient().execCypher(cypher, "arn", arn, "props", n).forEach(r -> { getShadowAttributeRemover().removeTagAttributes("AwsSnsTopic", n, r); }); cypher = "match (a:AwsAccount {aws_account:{account}}), (t:AwsSnsTopic {aws_account:{account}}) MERGE (a)-[r:OWNS]->(t) set r.updateTs=timestamp()"; getNeoRxClient().execCypher(cypher, "account", getAccountId()); }
AmazonSNSClient snsClient = new AmazonSNSClient(new DefaultAWSCredentialsProviderChain()); snsClient.setRegion(Region.getRegion(Regions.US_WEST_2)); List<Topic> topicArns = new ArrayList<>(); ListTopicsResult result = snsClient.listTopics(); topicArns.addAll(result.getTopics()); while (result.getNextToken() != null) { result = snsClient.listTopics(result.getNextToken()); topicArns.addAll(result.getTopics()); } for (Topic topic : topicArns) { System.out.println(topic.getTopicArn()); } snsClient.shutdown();
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()); 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); } }
if (topic.getTopicArn().indexOf(snsControlTopicName) != -1) { snsTopicARN = topic.getTopicArn(); logger.info("Found existing SNS topic by name: "+snsControlTopicName + " @ " + snsTopicARN); break;