in src/main/java/com/amazonaws/services/kinesis/scaling/StreamScaler.java [139:152]
public ScalingOperationReport scaleDown(String streamName, int byShardCount, Integer minShards, Integer maxShards,
boolean waitForCompletion) throws Exception {
if (byShardCount <= 0) {
throw new Exception(streamName + ": Shard Count must be a positive number");
}
int currentSize = StreamScalingUtils.getOpenShardCount(kinesisClient, streamName);
if (currentSize == 1) {
throw new AlreadyOneShardException();
}
return doResize(streamName, Math.max(currentSize - byShardCount, 1), minShards, maxShards, waitForCompletion);
}