public DescribeSpotPriceHistoryResponseType handleGet(
@Context UriInfo uriInfo) {
MultivaluedMap<String, String> form = uriInfo.getQueryParameters();
final DescribeSpotPriceHistoryType request = new DescribeSpotPriceHistoryType();
if(form != null && !form.isEmpty()){
List<String> startTime = form.remove("StartTime");
if(startTime != null && startTime.size() == 1){
String startTimeStr = startTime.get(0);
try {
Calendar startDate = convertTimeStampToCalendar(startTimeStr);
request.setStartTime(startDate);
} catch (IllegalArgumentException e) {
logger.warn("Could not convert DescribeSpotPriceHistory's " +
"start time String: " + startTimeStr, e);
}
}
List<String> endTime = form.remove("EndTime");
if(endTime != null && endTime.size() == 1){
String endTimeStr = endTime.get(0);
try {
Calendar endDate = convertTimeStampToCalendar(endTimeStr);
request.setEndTime(endDate);
} catch (IllegalArgumentException e) {
logger.warn("Could not convert DescribeSpotPriceHistory's " +
"end time String: " + endTimeStr, e);
}
}
//not used yet
form.remove("ProductDescription");
ArrayList<InstanceTypeSetItemType> itsit = new ArrayList<InstanceTypeSetItemType>();
for (Entry<String,List<String>> entrySet : form.entrySet()) {
List<String> instanceType = entrySet.getValue();
if(entrySet.getKey().startsWith(INSTANCE_TYPE_VAR) && instanceType.size() == 1) {
InstanceTypeSetItemType instType = new InstanceTypeSetItemType();
instType.setInstanceType(instanceType.get(0));
itsit.add(instType);
}
}
InstanceTypeSetType instanceTypeSet = new InstanceTypeSetType();
instanceTypeSet.setItem(itsit.toArray(new InstanceTypeSetItemType[0]));
request.setInstanceTypeSet(instanceTypeSet);
}
try {
return serviceRM.describeSpotPriceHistory(request);