* expect any fields to be defined here. unless isReservedInstance is true, in which case reservationType
* should be populated but we will prefix "1 year " or "3 year ".
* @param optionsArray Array in which we accumulate the options.
*/
private void accumulateEC2Options(String url, boolean isReservedInstance, Tuple baseTuple, List<Tuple> optionsArray) {
JsonObject rawJson = fetchAndParse(url);
JsonObject config = rawJson.getJson("config");
for (JsonObject ec2Region : config.getArray("regions").getObjectIterable()) {
String ec2RegionName = ec2Region.getString("region");
for (JsonObject instanceType : ec2Region.getArray("instanceTypes").getObjectIterable()) {
String instanceTypeName = instanceType.getString("type");
for (JsonObject size : instanceType.getArray("sizes").getObjectIterable()) {
String sizeName = size.getString("size");
if (isReservedInstance) {
JsonObject map = columnsToMap(size.getArray("valueColumns"));
double upfront = getPrice(map, "yrTerm1"), hourly = getPrice(map, "yrTerm1Hourly");
if (upfront >= 0 && hourly >= 0) {
Tuple tuple = new Tuple(baseTuple);
parseAmazonRegion(ec2RegionName, tuple);
parseAmazonInstanceType(instanceTypeName, sizeName, tuple);