diff options
Diffstat (limited to 'controller-api')
3 files changed, 11 insertions, 66 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/AwsLimitsFetcher.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/AwsLimitsFetcher.java deleted file mode 100644 index 4e76f67e7cf..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/AwsLimitsFetcher.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.controller.api.integration.aws; - -/** - * @author freva - */ -public interface AwsLimitsFetcher { - - /** Returns the AWS EC2 instance limits in the given AWS region */ - Ec2InstanceCounts getEc2InstanceLimits(String awsRegion); - - /** Returns the current usage of AWS EC2 instances in the given AWS region */ - Ec2InstanceCounts getEc2InstanceUsage(String awsRegion); -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/Ec2InstanceCounts.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/Ec2InstanceCounts.java deleted file mode 100644 index 044789f14e4..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/Ec2InstanceCounts.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.controller.api.integration.aws; - -import java.util.Map; -import java.util.Objects; - -/** - * @author freva - */ -public class Ec2InstanceCounts { - private final int totalCount; - private final Map<String, Integer> instanceCounts; - - public Ec2InstanceCounts(int totalCount, Map<String, Integer> instanceCounts) { - this.totalCount = totalCount; - this.instanceCounts = Map.copyOf(instanceCounts); - } - - public int getTotalCount() { - return totalCount; - } - - /** Returns map of counts by instance type, e.g. 'r5.2xlarge' */ - public Map<String, Integer> getInstanceCounts() { - return instanceCounts; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Ec2InstanceCounts that = (Ec2InstanceCounts) o; - return totalCount == that.totalCount && - instanceCounts.equals(that.instanceCounts); - } - - @Override - public int hashCode() { - return Objects.hash(totalCount, instanceCounts); - } - - @Override - public String toString() { - return "Ec2InstanceLimits{" + - "totalLimit=" + totalCount + - ", instanceCounts=" + instanceCounts + - '}'; - } -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java index a378bcb63bd..5ee6df9f034 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java @@ -2,6 +2,7 @@ package com.yahoo.vespa.hosted.controller.api.integration.resource; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node; import java.time.Instant; @@ -17,14 +18,16 @@ public class ResourceSnapshot { private final ApplicationId applicationId; private final ResourceAllocation resourceAllocation; private final Instant timestamp; + private final ZoneId zoneId; - public ResourceSnapshot(ApplicationId applicationId, double cpuCores, double memoryGb, double diskGb, Instant timestamp) { + public ResourceSnapshot(ApplicationId applicationId, double cpuCores, double memoryGb, double diskGb, Instant timestamp, ZoneId zoneId) { this.applicationId = applicationId; this.resourceAllocation = new ResourceAllocation(cpuCores, memoryGb, diskGb); this.timestamp = timestamp; + this.zoneId = zoneId; } - public static ResourceSnapshot from(List<Node> nodes, Instant timestamp) { + public static ResourceSnapshot from(List<Node> nodes, Instant timestamp, ZoneId zoneId) { Set<ApplicationId> applicationIds = nodes.stream() .filter(node -> node.owner().isPresent()) .map(node -> node.owner().get()) @@ -37,7 +40,8 @@ public class ResourceSnapshot { nodes.stream().mapToDouble(Node::vcpu).sum(), nodes.stream().mapToDouble(Node::memoryGb).sum(), nodes.stream().mapToDouble(Node::diskGb).sum(), - timestamp + timestamp, + zoneId ); } @@ -61,4 +65,8 @@ public class ResourceSnapshot { return timestamp; } + public ZoneId getZoneId() { + return zoneId; + } + } |