summaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2023-10-05 16:15:32 +0200
committerHarald Musum <musum@yahooinc.com>2023-10-05 16:15:32 +0200
commit66ec036c11d7459ab9d9ab48b385eb594df7d690 (patch)
treee6ed73220c37e606cc8225b687fa2aae016a0911 /controller-api/src/main/java
parent706284c6878b3758cf6d95b3d26bf1c4d0352469 (diff)
parent477f973cb7153cda021d428889fc4d3ae1eef84d (diff)
Merge branch 'master' into hmusum/add-pricing-info-and-controller
Diffstat (limited to 'controller-api/src/main/java')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java2
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/EndpointCertificate.java20
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java10
3 files changed, 19 insertions, 13 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java
index eb20126304e..6855e1b0559 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java
@@ -28,7 +28,7 @@ public class MockBillingController implements BillingController {
Map<TenantName, PlanId> plans = new HashMap<>();
Map<TenantName, PaymentInstrument> activeInstruments = new HashMap<>();
Map<TenantName, List<Bill>> committedBills = new HashMap<>();
- Map<TenantName, Bill> uncommittedBills = new HashMap<>();
+ public Map<TenantName, Bill> uncommittedBills = new HashMap<>();
Map<TenantName, List<Bill.LineItem>> unusedLineItems = new HashMap<>();
Map<TenantName, CollectionMethod> collectionMethod = new HashMap<>();
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/EndpointCertificate.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/EndpointCertificate.java
index 53d807b0139..6f056edd226 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/EndpointCertificate.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/EndpointCertificate.java
@@ -13,9 +13,9 @@ public record EndpointCertificate(String keyName, String certName, int version,
String rootRequestId, // The id of the first request made for this certificate. Should not change.
Optional<String> leafRequestId, // The id of the last known request made for this certificate. Changes on refresh, may be outdated!
List<String> requestedDnsSans, String issuer, Optional<Long> expiry,
- Optional<Long> lastRefreshed, Optional<String> randomizedId) {
+ Optional<Long> lastRefreshed, Optional<String> generatedId) {
- public EndpointCertificate withRandomizedId(String randomizedId) {
+ public EndpointCertificate withGeneratedId(String generatedId) {
return new EndpointCertificate(
this.keyName,
this.certName,
@@ -27,7 +27,7 @@ public record EndpointCertificate(String keyName, String certName, int version,
this.issuer,
this.expiry,
this.lastRefreshed,
- Optional.of(randomizedId));
+ Optional.of(generatedId));
}
public EndpointCertificate withKeyName(String keyName) {
@@ -42,7 +42,7 @@ public record EndpointCertificate(String keyName, String certName, int version,
this.issuer,
this.expiry,
this.lastRefreshed,
- this.randomizedId);
+ this.generatedId);
}
public EndpointCertificate withCertName(String certName) {
@@ -57,7 +57,7 @@ public record EndpointCertificate(String keyName, String certName, int version,
this.issuer,
this.expiry,
this.lastRefreshed,
- this.randomizedId);
+ this.generatedId);
}
public EndpointCertificate withVersion(int version) {
@@ -72,7 +72,7 @@ public record EndpointCertificate(String keyName, String certName, int version,
this.issuer,
this.expiry,
this.lastRefreshed,
- this.randomizedId);
+ this.generatedId);
}
public EndpointCertificate withLastRequested(long lastRequested) {
@@ -87,7 +87,7 @@ public record EndpointCertificate(String keyName, String certName, int version,
this.issuer,
this.expiry,
this.lastRefreshed,
- this.randomizedId);
+ this.generatedId);
}
public EndpointCertificate withLastRefreshed(long lastRefreshed) {
@@ -102,7 +102,7 @@ public record EndpointCertificate(String keyName, String certName, int version,
this.issuer,
this.expiry,
Optional.of(lastRefreshed),
- this.randomizedId);
+ this.generatedId);
}
public EndpointCertificate withRootRequestId(String rootRequestId) {
@@ -117,7 +117,7 @@ public record EndpointCertificate(String keyName, String certName, int version,
this.issuer,
this.expiry,
this.lastRefreshed,
- this.randomizedId);
+ this.generatedId);
}
public EndpointCertificate withLeafRequestId(Optional<String> leafRequestId) {
@@ -132,7 +132,7 @@ public record EndpointCertificate(String keyName, String certName, int version,
this.issuer,
this.expiry,
this.lastRefreshed,
- this.randomizedId);
+ this.generatedId);
}
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java
index 173d3e1950e..44a46195989 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.tenant;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import com.yahoo.config.provision.TenantName;
+import com.yahoo.vespa.hosted.controller.api.integration.billing.PlanId;
import com.yahoo.vespa.hosted.controller.api.integration.secrets.TenantSecretStore;
import com.yahoo.vespa.hosted.controller.api.role.SimplePrincipal;
@@ -28,13 +29,15 @@ public class CloudTenant extends Tenant {
private final ArchiveAccess archiveAccess;
private final Optional<Instant> invalidateUserSessionsBefore;
private final Optional<BillingReference> billingReference;
+ private final PlanId planId;
/** Public for the serialization layer — do not use! */
public CloudTenant(TenantName name, Instant createdAt, LastLoginInfo lastLoginInfo, Optional<SimplePrincipal> creator,
BiMap<PublicKey, SimplePrincipal> developerKeys, TenantInfo info,
List<TenantSecretStore> tenantSecretStores, ArchiveAccess archiveAccess,
Optional<Instant> invalidateUserSessionsBefore, Instant tenantRoleLastMaintained,
- List<CloudAccountInfo> cloudAccounts, Optional<BillingReference> billingReference) {
+ List<CloudAccountInfo> cloudAccounts, Optional<BillingReference> billingReference,
+ PlanId planId) {
super(name, createdAt, lastLoginInfo, Optional.empty(), tenantRoleLastMaintained, cloudAccounts);
this.creator = creator;
this.developerKeys = developerKeys;
@@ -43,6 +46,7 @@ public class CloudTenant extends Tenant {
this.archiveAccess = Objects.requireNonNull(archiveAccess);
this.invalidateUserSessionsBefore = invalidateUserSessionsBefore;
this.billingReference = Objects.requireNonNull(billingReference);
+ this.planId = Objects.requireNonNull(planId);
}
/** Creates a tenant with the given name, provided it passes validation. */
@@ -52,7 +56,7 @@ public class CloudTenant extends Tenant {
LastLoginInfo.EMPTY,
Optional.ofNullable(creator).map(SimplePrincipal::of),
ImmutableBiMap.of(), TenantInfo.empty(), List.of(), new ArchiveAccess(), Optional.empty(),
- Instant.EPOCH, List.of(), Optional.empty());
+ Instant.EPOCH, List.of(), Optional.empty(), PlanId.from("none"));
}
/** The user that created the tenant */
@@ -92,6 +96,8 @@ public class CloudTenant extends Tenant {
return billingReference;
}
+ public PlanId planId() { return planId; }
+
@Override
public Type type() {
return Type.cloud;