From 5c3885c99f97bd4ab03e5e82087696fac193ccd0 Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Thu, 5 Sep 2019 10:03:00 +0200 Subject: Move CostReportConsumer to ServiceRegistry --- .../controller/api/integration/ServiceRegistry.java | 3 +++ .../api/integration/resource/CostReportConsumer.java | 16 ++++++++++++++++ .../api/integration/resource/ResourceAllocation.java | 5 +++++ 3 files changed, 24 insertions(+) create mode 100644 controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumer.java (limited to 'controller-api') 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 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); + } + } -- cgit v1.2.3