/** * Gets a list of all Amazon Kinesis streams * * @param kinesisClient * The {@link AmazonKinesisClient} with Amazon Kinesis read privileges * @return list of Amazon Kinesis streams */ public static List<String> listAllStreams(AmazonKinesisClient kinesisClient) { ListStreamsRequest listStreamsRequest = new ListStreamsRequest(); listStreamsRequest.setLimit(10); ListStreamsResult listStreamsResult = kinesisClient.listStreams(listStreamsRequest); List<String> streamNames = listStreamsResult.getStreamNames(); while (listStreamsResult.isHasMoreStreams()) { if (streamNames.size() > 0) { listStreamsRequest.setExclusiveStartStreamName(streamNames.get(streamNames.size() - 1)); } listStreamsResult = kinesisClient.listStreams(listStreamsRequest); streamNames.addAll(listStreamsResult.getStreamNames()); } return streamNames; }
@Override public Iterable<ValidationResult> doHealthChecks(RuntimeContainer container) { AmazonKinesis amazonKinesis = KinesisClient.create(properties); try { ListStreamsResult listStreamsResult = amazonKinesis.listStreams(); return Arrays.asList(ValidationResult.OK); } catch (Exception e) { return Arrays.asList(new ValidationResult(ValidationResult.Result.ERROR, e.getMessage())); } }
@Override public Set<String> listStreams() { AmazonKinesis amazonKinesis = KinesisClient.create(properties); ListStreamsResult listStreamsResult = amazonKinesis.listStreams(); List<String> streamNames = listStreamsResult.getStreamNames(); Set<String> streamNamesCollection = new HashSet(streamNames); while (listStreamsResult.isHasMoreStreams() && !streamNames.isEmpty()) { listStreamsResult = amazonKinesis.listStreams(streamNames.get(streamNames.size() - 1)); streamNames = listStreamsResult.getStreamNames(); streamNamesCollection.addAll(streamNames); } return streamNamesCollection; }
@Override public ListStreamsResult listStreams(ListStreamsRequest listStreamsRequest) { throw new RuntimeException("Not implemented"); }
@Override public ListStreamsResult listStreams() { throw new RuntimeException("Not implemented"); }
@Override public ListStreamsResult listStreams(String exclusiveStartStreamName) { throw new RuntimeException("Not implemented"); }
@Override public ListStreamsResult listStreams(Integer limit, String exclusiveStartStreamName) { throw new RuntimeException("Not implemented"); }
@Override public ListStreamsResult listStreams(ListStreamsRequest listStreamsRequest) throws AmazonServiceException, AmazonClientException { return null; }
@Override public ListStreamsResult listStreams() throws AmazonServiceException, AmazonClientException { return null; }
@Override public ListStreamsResult listStreams(String s) throws AmazonServiceException, AmazonClientException { return null; }
@Override public ListStreamsResult listStreams(Integer integer, String s) throws AmazonServiceException, AmazonClientException { return null; }