@Override public ListTopicsResult listTopics() { return listTopics(new ListTopicsRequest()); }
@Override public ListTopicsResult listTopics(String nextToken) { return listTopics(new ListTopicsRequest().withNextToken(nextToken)); }
ListTopicsResult listTopicsResult = sns.listTopics(); String topicArn = null;
/** * <p> * Returns a list of the requester's topics. Each call returns a limited * list of topics, up to 100. If there are more topics, a * <code>NextToken</code> is also returned. Use the <code>NextToken</code> * parameter in a new <code>ListTopics</code> call to get further results. * </p> * * @return listTopicsResult The response from the ListTopics service method, * as returned by Amazon Simple Notification Service. * @throws InvalidParameterException * @throws InternalErrorException * @throws AuthorizationErrorException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is * not available. * @throws AmazonServiceException If an error response is returned by Amazon * Simple Notification Service indicating either a problem with * the data in the request, or a server side issue. */ public ListTopicsResult listTopics() throws AmazonServiceException, AmazonClientException { ListTopicsRequest listTopicsRequest = new ListTopicsRequest(); return listTopics(listTopicsRequest); }
ListTopicsRequest listTopicsRequest = new ListTopicsRequest(); listTopicsRequest.setNextToken(nextToken); return listTopics(listTopicsRequest);
/** * <p> * Returns a list of the requester's topics. Each call returns a limited * list of topics, up to 100. If there are more topics, a * <code>NextToken</code> is also returned. Use the <code>NextToken</code> * parameter in a new <code>ListTopics</code> call to get further results. * </p> * * @return listTopicsResult The response from the ListTopics service method, * as returned by Amazon Simple Notification Service. * @throws InvalidParameterException * @throws InternalErrorException * @throws AuthorizationErrorException * @throws AmazonClientException If any internal errors are encountered * inside the client while attempting to make the request or * handle the response. For example if a network connection is * not available. * @throws AmazonServiceException If an error response is returned by Amazon * Simple Notification Service indicating either a problem with * the data in the request, or a server side issue. */ public ListTopicsResult listTopics() throws AmazonServiceException, AmazonClientException { ListTopicsRequest listTopicsRequest = new ListTopicsRequest(); return listTopics(listTopicsRequest); }
AmazonSNSClient snsClient = new AmazonSNSClient(credentials); ListTopicsResult listTopicsResult = snsClient.listTopics(); String nextToken = listTopicsResult.getNextToken(); List<Topic> topics = listTopicsResult.getTopics(); listTopicsResult = snsClient.listTopics(nextToken); nextToken = listTopicsResult.getNextToken(); topics.addAll(listTopicsResult.getTopics());
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();
ListTopicsRequest listTopicsRequest = new ListTopicsRequest(); listTopicsRequest.setNextToken(nextToken); return listTopics(listTopicsRequest);
ListTopicsResult listTopicResult = sns.listTopics(listTopicRequest); topics = listTopicResult.getTopics(); listTopicResult = sns.listTopics(listTopicRequest); topics = listTopicResult.getTopics();
ListTopicsResult listResult = snsClient.listTopics(); List<Topic> topics = listResult.getTopics(); listResult = snsClient.listTopics(nextToken); topics = listResult.getTopics();
@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)); }