@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListTopicsResult == false) return false; ListTopicsResult other = (ListTopicsResult) obj; if (other.getTopics() == null ^ this.getTopics() == null) return false; if (other.getTopics() != null && other.getTopics().equals(this.getTopics()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == 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 (getTopics() != null) sb.append("Topics: ").append(getTopics()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()); sb.append("}"); return sb.toString(); }
String topicArn = null; for ( Topic topic : listTopicsResult.getTopics() ) { String arn = topic.getTopicArn();
/** * <p> * A list of topic ARNs. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param topics <p> * A list of topic ARNs. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public ListTopicsResult withTopics(Topic... topics) { if (getTopics() == null) { this.topics = new java.util.ArrayList<Topic>(topics.length); } for (Topic value : topics) { this.topics.add(value); } return this; }
/** * 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 (getTopics() != null) sb.append("Topics: " + getTopics() + ","); if (getNextToken() != null) sb.append("NextToken: " + getNextToken()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListTopicsResult == false) return false; ListTopicsResult other = (ListTopicsResult) obj; if (other.getTopics() == null ^ this.getTopics() == null) return false; if (other.getTopics() != null && other.getTopics().equals(this.getTopics()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; return true; } }
/** * <p> * A list of topic ARNs. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param topics <p> * A list of topic ARNs. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public ListTopicsResult withTopics(Topic... topics) { if (getTopics() == null) { this.topics = new java.util.ArrayList<Topic>(topics.length); } for (Topic value : topics) { this.topics.add(value); } return this; }
/** * 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 (getTopics() != null) sb.append("Topics: " + getTopics() + ","); if (getNextToken() != null) sb.append("NextToken: " + getNextToken()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListTopicsResult == false) return false; ListTopicsResult other = (ListTopicsResult) obj; if (other.getTopics() == null ^ this.getTopics() == null) return false; if (other.getTopics() != null && other.getTopics().equals(this.getTopics()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; return true; } }
@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; }
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 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 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 + "'"); } } }
@Override protected void doScan() { rateLimit(); ListTopicsResult result = getClient().listTopics(); String token = null; do { token = result.getNextToken(); for (Topic topic : result.getTopics()) { try { projectTopic(topic); scanSubscriptions(topic); } catch (RuntimeException e) { maybeThrow(e); } } result = getClient().listTopics(token); } while (tokenHasNext(token)); }