diff options
Diffstat (limited to 'controller-api/src')
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Invoice.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Invoice.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Invoice.java index c474fa1f4df..39d974378b4 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Invoice.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Invoice.java @@ -104,6 +104,12 @@ public class Invoice { return sumResourceValues(LineItem::getDiskCost); } + public BigDecimal sumAdditionalCost() { + // anything that is not covered by the cost for resources is "additional" costs + var resourceCosts = sumCpuCost().add(sumMemoryCost()).add(sumDiskCost()); + return sum().subtract(resourceCosts); + } + private BigDecimal sumResourceValues(Function<LineItem, Optional<BigDecimal>> f) { return lineItems.stream().flatMap(li -> f.apply(li).stream()).reduce(SCALED_ZERO, BigDecimal::add); } |