Example usage for com.amazonaws.services.kinesis.model DescribeStreamRequest getStreamName

List of usage examples for com.amazonaws.services.kinesis.model DescribeStreamRequest getStreamName

Introduction

In this page you can find the example usage for com.amazonaws.services.kinesis.model DescribeStreamRequest getStreamName.

Prototype


public String getStreamName() 

Source Link

Document

The name of the stream to describe.

Usage

From source file:com.facebook.presto.kinesis.util.MockKinesisClient.java

License:Apache License

@Override
public DescribeStreamResult describeStream(DescribeStreamRequest describeStreamRequest)
        throws AmazonServiceException, AmazonClientException {
    InternalStream theStream = this.getStream(describeStreamRequest.getStreamName());
    if (theStream != null) {
        StreamDescription desc = new StreamDescription();
        desc = desc.withStreamName(theStream.getStreamName()).withStreamStatus(theStream.getStreamStatus())
                .withStreamARN(theStream.getStreamARN());

        if (describeStreamRequest.getExclusiveStartShardId() == null
                || describeStreamRequest.getExclusiveStartShardId().isEmpty()) {
            desc.setShards(this.getShards(theStream));
            desc.setHasMoreShards(false);
        } else {//from   w  w w. j a  v a2  s .  c  o m
            // Filter from given shard Id, or may not have any more
            String startId = describeStreamRequest.getExclusiveStartShardId();
            desc.setShards(this.getShards(theStream, startId));
            desc.setHasMoreShards(false);
        }

        DescribeStreamResult result = new DescribeStreamResult();
        result = result.withStreamDescription(desc);
        return result;
    } else {
        throw new AmazonClientException("This stream does not exist!");
    }
}