use of org.ligoj.app.plugin.prov.model.ProvStorageOptimized in project plugin-prov by ligoj.
the class ProvQuoteStorageResource method lookup.
private List<QuoteStorageLoopup> lookup(final ProvQuote configuration, final int size, final Rate latency, final Integer instance, final ProvStorageOptimized optimized, final String location) {
// Get the attached node and check the security on this subscription
final String node = configuration.getSubscription().getNode().getRefined().getId();
final ProvQuoteInstance qi = checkInstance(node, instance);
// The the right location from instance first, then the request one
String iLocation = Optional.ofNullable(qi).map(qiResource::getLocation).map(ProvLocation::getName).orElse(location);
iLocation = ObjectUtils.defaultIfNull(iLocation, configuration.getLocation().getName());
if (location != null && !location.equals(iLocation)) {
// Not compatible locations
return Collections.emptyList();
}
return spRepository.findLowestPrice(node, size, latency, instance, optimized, iLocation, PageRequest.of(0, 10)).stream().map(spx -> (ProvStoragePrice) spx[0]).map(sp -> newPrice(sp, size, getCost(sp, size))).collect(Collectors.toList());
}
Aggregations