com.amazonaws.services.kinesis.model.ListTagsForStreamRequest Java Examples

The following examples show how to use com.amazonaws.services.kinesis.model.ListTagsForStreamRequest. 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: MockKinesisClient.java    From presto with Apache License 2.0 4 votes vote down vote up
@Override
public ListTagsForStreamResult listTagsForStream(ListTagsForStreamRequest listTagsForStreamRequest)
        throws AmazonClientException
{
    return null;
}
 
Example #2
Source File: KinesisInventoryUtil.java    From pacbot with Apache License 2.0 4 votes vote down vote up
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 #3
Source File: KinesisInventoryUtil.java    From pacbot with Apache License 2.0 4 votes vote down vote up
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 #4
Source File: AmazonKinesisMock.java    From beam with Apache License 2.0 4 votes vote down vote up
@Override
public ListTagsForStreamResult listTagsForStream(
    ListTagsForStreamRequest listTagsForStreamRequest) {
  throw new RuntimeException("Not implemented");
}
 
Example #5
Source File: MockKinesisClient.java    From presto-kinesis with Apache License 2.0 4 votes vote down vote up
@Override
public ListTagsForStreamResult listTagsForStream(ListTagsForStreamRequest listTagsForStreamRequest) throws AmazonServiceException, AmazonClientException
{
    return null;
}