summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2019-09-05 10:03:00 +0200
committerMartin Polden <mpolden@mpolden.no>2019-09-05 13:11:32 +0200
commit5c3885c99f97bd4ab03e5e82087696fac193ccd0 (patch)
tree3bda6f740066557ff799ac8764562a7900e71284 /controller-api
parent26842f3a79578c35d74c9f83526a02c3f665fd8b (diff)
Move CostReportConsumer to ServiceRegistry
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java3
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumer.java16
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceAllocation.java5
3 files changed, 24 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java
index 73a4f56efcf..d74dbe13acb 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java
@@ -10,6 +10,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueHandl
import com.yahoo.vespa.hosted.controller.api.integration.organization.DeploymentIssues;
import com.yahoo.vespa.hosted.controller.api.integration.organization.Mailer;
import com.yahoo.vespa.hosted.controller.api.integration.organization.OwnershipIssues;
+import com.yahoo.vespa.hosted.controller.api.integration.resource.CostReportConsumer;
import com.yahoo.vespa.hosted.controller.api.integration.resource.MeteringClient;
import com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService;
import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator;
@@ -47,4 +48,6 @@ public interface ServiceRegistry {
EntityService entityService();
+ CostReportConsumer costReportConsumer();
+
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumer.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumer.java
new file mode 100644
index 00000000000..5c4bfcf219d
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumer.java
@@ -0,0 +1,16 @@
+package com.yahoo.vespa.hosted.controller.api.integration.resource;
+
+import com.yahoo.vespa.hosted.controller.api.identifiers.Property;
+
+import java.util.Map;
+
+/**
+ * @author ldalves
+ */
+public interface CostReportConsumer {
+
+ void consume(String csv);
+
+ Map<Property, ResourceAllocation> fixedAllocations();
+
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceAllocation.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceAllocation.java
index e30d2d55f77..bea34567752 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceAllocation.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceAllocation.java
@@ -41,5 +41,10 @@ public class ResourceAllocation {
return new ResourceAllocation(cpuCores + allocation.cpuCores, memoryGb + allocation.memoryGb, diskGb + allocation.diskGb);
}
+ /** Returns a copy of this with each resource multiplied by given factor */
+ public ResourceAllocation multiply(double multiplicand) {
+ return new ResourceAllocation(cpuCores * multiplicand, memoryGb * multiplicand, diskGb * multiplicand);
+ }
+
}