summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@verizonmedia.com>2020-09-25 11:27:15 +0200
committerGitHub <noreply@github.com>2020-09-25 11:27:15 +0200
commit376aa6a4b20f32985c2933cfc2ad8c3f2469224a (patch)
tree2ab60e0a49429f180e7e8fa87b464584fb1539d3 /controller-api
parent313cb5f4c9d0fe2df84858d48f40f1ddb1b97b40 (diff)
parent0b2ded054339ef1a55645aa3cc770e52dc686518 (diff)
Merge pull request #14551 from vespa-engine/ogronnesby/quota-calculator
Add static utilities for unlimited and zero quota
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Quota.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Quota.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Quota.java
index cae768afc90..9348e7dcbdb 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Quota.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Quota.java
@@ -1,3 +1,4 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.billing;
import java.util.Objects;
@@ -5,8 +6,13 @@ import java.util.Optional;
/**
* Quota information transmitted to the configserver on deploy.
+ *
+ * @author andreer
+ * @author ogronnesby
*/
public class Quota {
+ private static final Quota UNLIMITED = new Quota(Optional.empty(), Optional.empty());
+ private static final Quota ZERO = new Quota(0, 0);
private final Optional<Integer> maxClusterSize;
private final Optional<Integer> budget; // in USD/hr, as calculated by NodeResources
@@ -40,6 +46,14 @@ public class Quota {
return new Quota(maxClusterSize, Optional.of(budget));
}
+ public static Quota zero() {
+ return ZERO;
+ }
+
+ public static Quota unlimted() {
+ return UNLIMITED;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;