com.amazonaws.services.dynamodbv2.model.DescribeStreamRequest Java Examples

The following examples show how to use com.amazonaws.services.dynamodbv2.model.DescribeStreamRequest. 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: DynamoDBConnectorUtilities.java    From dynamodb-cross-region-library with Apache License 2.0 5 votes vote down vote up
/**
 * Check whether Streams is enabled on the given argument with the given stream view type
 * 
 * @param streamsClient 
 *            streams client used to access the given stream
 * @param streamArn
 *            the stream ARN to check against
 * @param viewType
 *            the stream view type to check against
 * @return a boolean indicating whether the given stream is enabled and matches the given stream view type
 */
public static boolean isStreamsEnabled(AmazonDynamoDBStreams streamsClient, String streamArn,
                                       StreamViewType viewType) {
    // Get and check stream description
    StreamDescription result = streamsClient.describeStream(new DescribeStreamRequest().withStreamArn(streamArn))
        .getStreamDescription();
    if (result.getStreamStatus().equalsIgnoreCase(DynamoDBConnectorConstants.ENABLED_STRING)
        && result.getStreamViewType().equalsIgnoreCase(viewType.toString())) {
        return true;
    }
    log.error(DynamoDBConnectorConstants.STREAM_NOT_READY + " StreamARN: " + streamArn);
    return false;
}