Example usage for com.amazonaws.http HttpResponse HttpResponse

List of usage examples for com.amazonaws.http HttpResponse HttpResponse

Introduction

In this page you can find the example usage for com.amazonaws.http HttpResponse HttpResponse.

Prototype

public HttpResponse(Request<?> request, HttpRequestBase httpRequest) 

Source Link

Document

Constructs a new HttpResponse associated with the specified request.

Usage

From source file:org.apache.beam.sdk.io.kinesis.AmazonKinesisMock.java

License:Apache License

@Override
public DescribeStreamResult describeStream(String streamName, String exclusiveStartShardId) {
    int nextShardId = 0;
    if (exclusiveStartShardId != null) {
        nextShardId = parseInt(exclusiveStartShardId) + 1;
    }//from  w  w  w .  ja  v  a2  s  . c  o  m
    boolean hasMoreShards = nextShardId + 1 < shardedData.size();

    List<Shard> shards = new ArrayList<>();
    if (nextShardId < shardedData.size()) {
        shards.add(new Shard().withShardId(Integer.toString(nextShardId)));
    }

    HttpResponse response = new HttpResponse(null, null);
    response.setStatusCode(200);
    DescribeStreamResult result = new DescribeStreamResult();
    result.setSdkHttpMetadata(SdkHttpMetadata.from(response));
    result.withStreamDescription(new StreamDescription().withHasMoreShards(hasMoreShards).withShards(shards)
            .withStreamName(streamName));
    return result;
}