com.amazonaws.services.kinesis.model.ListStreamsResult Java Examples
The following examples show how to use
com.amazonaws.services.kinesis.model.ListStreamsResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KinesisUtils.java From amazon-kinesis-connectors with Apache License 2.0 | 6 votes |
/** * 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; }
Example #2
Source File: KinesisUtils.java From aws-big-data-blog with Apache License 2.0 | 6 votes |
/** * 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; }
Example #3
Source File: SpringLocalstackDockerRunnerTest.java From spring-localstack with Apache License 2.0 | 6 votes |
@Test public void testKinesis() throws Exception { AmazonKinesis kinesis = amazonDockerClientsHolder.amazonKinesis(); ListStreamsResult streamsResult = kinesis.listStreams(); assertThat(streamsResult.getStreamNames().size(), is(0)); CreateStreamRequest createStreamRequest = new CreateStreamRequest() .withStreamName("test-stream") .withShardCount(2); kinesis.createStream(createStreamRequest); streamsResult = kinesis.listStreams(); assertThat(streamsResult.getStreamNames(), hasItem("test-stream")); }
Example #4
Source File: KinesisDatasetRuntime.java From components with Apache License 2.0 | 5 votes |
@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; }
Example #5
Source File: KinesisDatastoreRuntime.java From components with Apache License 2.0 | 5 votes |
@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())); } }
Example #6
Source File: AmazonKinesisMock.java From beam with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams(String exclusiveStartStreamName) { throw new RuntimeException("Not implemented"); }
Example #7
Source File: MockKinesisClient.java From presto-kinesis with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams(Integer integer, String s) throws AmazonServiceException, AmazonClientException { return null; }
Example #8
Source File: MockKinesisClient.java From presto-kinesis with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams(String s) throws AmazonServiceException, AmazonClientException { return null; }
Example #9
Source File: MockKinesisClient.java From presto-kinesis with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams() throws AmazonServiceException, AmazonClientException { return null; }
Example #10
Source File: MockKinesisClient.java From presto-kinesis with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams(ListStreamsRequest listStreamsRequest) throws AmazonServiceException, AmazonClientException { return null; }
Example #11
Source File: AmazonKinesisMock.java From beam with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams(Integer limit, String exclusiveStartStreamName) { throw new RuntimeException("Not implemented"); }
Example #12
Source File: MockKinesisClient.java From presto with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams(ListStreamsRequest listStreamsRequest) throws AmazonClientException { return null; }
Example #13
Source File: AmazonKinesisMock.java From beam with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams() { throw new RuntimeException("Not implemented"); }
Example #14
Source File: AmazonKinesisMock.java From beam with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams(ListStreamsRequest listStreamsRequest) { throw new RuntimeException("Not implemented"); }
Example #15
Source File: KinesisInventoryUtil.java From pacbot with Apache License 2.0 | 4 votes |
public static Map<String,List<VideoStreamVH>> fetchVideoStreamInfo(BasicSessionCredentials temporaryCredentials, String skipRegions,String accountId,String accountName) { Map<String,List<VideoStreamVH>> videoStream = new LinkedHashMap<>(); AmazonKinesisVideo amazonKinesisVideo; String expPrefix = InventoryConstants.ERROR_PREFIX_CODE+accountId + "\",\"Message\": \"Exception in fetching info for resource\" ,\"type\": \"videoStream\" " ; for(Region region : RegionUtils.getRegions()) { try{ if(!skipRegions.contains(region.getName()) && region.isServiceSupported(AmazonKinesisVideo.ENDPOINT_PREFIX)){ amazonKinesisVideo = AmazonKinesisVideoClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build(); List<StreamInfo> videoStreamListTemp = new ArrayList<>(); com.amazonaws.services.kinesisvideo.model.ListStreamsResult listStreamsResult; String nextToken = null; do{ listStreamsResult = amazonKinesisVideo.listStreams(new ListStreamsRequest().withNextToken(nextToken)); videoStreamListTemp.addAll(listStreamsResult.getStreamInfoList()); nextToken = listStreamsResult.getNextToken(); }while(nextToken!=null); List<VideoStreamVH> videoStreamList = new ArrayList<>(); for(StreamInfo streamInfo : videoStreamListTemp) { List<Attribute> tags = new ArrayList<>(); for(Entry<String, String> entry: amazonKinesisVideo.listTagsForStream(new com.amazonaws.services.kinesisvideo.model.ListTagsForStreamRequest() .withStreamARN(streamInfo.getStreamARN())).getTags().entrySet()) { tags.add(new Attribute(entry.getKey(), entry.getValue())); } videoStreamList.add(new VideoStreamVH(streamInfo,tags)); } if( !videoStreamList.isEmpty() ) { log.debug(InventoryConstants.ACCOUNT + accountId +" Type : VideoStream "+region.getName() + " >> "+videoStreamList.size()); videoStream.put(accountId+delimiter+accountName+delimiter+region.getName(),videoStreamList); } } } catch(Exception e){ log.warn(expPrefix+ region.getName()+InventoryConstants.ERROR_CAUSE +e.getMessage()+"\"}"); ErrorManageUtil.uploadError(accountId, region.getName(),"videoStream",e.getMessage()); } } return videoStream; }
Example #16
Source File: KinesisInventoryUtil.java From pacbot with Apache License 2.0 | 4 votes |
public static Map<String,List<DataStreamVH>> fetchDataStreamInfo(BasicSessionCredentials temporaryCredentials, String skipRegions,String accountId,String accountName) { Map<String,List<DataStreamVH>> dataStream = new LinkedHashMap<>(); AmazonKinesis amazonKinesis; String expPrefix = InventoryConstants.ERROR_PREFIX_CODE+accountId + "\",\"Message\": \"Exception in fetching info for resource\" ,\"type\": \"datastream\"" ; for(Region region : RegionUtils.getRegions()) { try{ if(!skipRegions.contains(region.getName())){ amazonKinesis = AmazonKinesisClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build(); ListStreamsResult listStreamsResult = amazonKinesis.listStreams(); List<String> streamNamesTemp = listStreamsResult.getStreamNames(); List<String> streamNames = new ArrayList<>(streamNamesTemp); while (listStreamsResult.isHasMoreStreams() && !streamNamesTemp.isEmpty()) { listStreamsResult = amazonKinesis.listStreams(streamNamesTemp.get(streamNamesTemp.size() - 1)); streamNamesTemp = listStreamsResult.getStreamNames(); streamNames.addAll(streamNamesTemp); } List<DataStreamVH> dataStreamList = new ArrayList<>(); for(String streamName : streamNames) { StreamDescription streamDescription = amazonKinesis.describeStream(new DescribeStreamRequest().withStreamName(streamName)).getStreamDescription(); ListTagsForStreamResult listTagsForStreamResult = amazonKinesis.listTagsForStream(new ListTagsForStreamRequest().withStreamName(streamName)); List<com.amazonaws.services.kinesis.model.Tag> tagsTemp = listTagsForStreamResult.getTags(); List<com.amazonaws.services.kinesis.model.Tag> tags = new ArrayList<>(tagsTemp); while (listTagsForStreamResult.isHasMoreTags() && !tagsTemp.isEmpty()) { listTagsForStreamResult = amazonKinesis.listTagsForStream(new ListTagsForStreamRequest().withExclusiveStartTagKey(tagsTemp.get(tagsTemp.size() - 1).getKey())); tagsTemp = listTagsForStreamResult.getTags(); tags.addAll(tagsTemp); } dataStreamList.add(new DataStreamVH(streamDescription, tags)); } if( !dataStreamList.isEmpty() ) { log.debug(InventoryConstants.ACCOUNT + accountId +" Type : datastream "+region.getName() + " >> "+dataStreamList.size()); dataStream.put(accountId+delimiter+accountName+delimiter+region.getName(),dataStreamList); } } } catch(Exception e){ log.warn(expPrefix+ region.getName()+InventoryConstants.ERROR_CAUSE +e.getMessage()+"\"}"); ErrorManageUtil.uploadError(accountId, region.getName(),"datastream",e.getMessage()); } } return dataStream; }
Example #17
Source File: MockKinesisClient.java From presto with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams(Integer limit, String exclusiveStartStreamName) throws AmazonServiceException, AmazonClientException { return null; }
Example #18
Source File: MockKinesisClient.java From presto with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams(String exclusiveStartStreamName) throws AmazonServiceException, AmazonClientException { return null; }
Example #19
Source File: MockKinesisClient.java From presto with Apache License 2.0 | 4 votes |
@Override public ListStreamsResult listStreams() throws AmazonServiceException, AmazonClientException { return null; }