Example usage for com.amazonaws.http SdkHttpMetadata from

List of usage examples for com.amazonaws.http SdkHttpMetadata from

Introduction

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

Prototype

public static SdkHttpMetadata from(HttpResponse httpResponse) 

Source Link

Document

Static factory to create an SdkHttpMetadata from the details in a HttpResponse .

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 www.  ja  va 2  s .  com
    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;
}