diff options
author | Øyvind Grønnesby <oyving@yahooinc.com> | 2023-09-14 13:18:42 +0200 |
---|---|---|
committer | Øyvind Grønnesby <oyving@yahooinc.com> | 2023-09-14 13:18:42 +0200 |
commit | 92b18097df267469eef02595520d36bc13871002 (patch) | |
tree | f3f91a173e37a6731984595cb8204383fa7b1d61 /controller-api/src/main | |
parent | 98fd22937b667e6a7bd46f42cb5bf8775a23f37d (diff) |
Support references to billing system on cloud tenants
Diffstat (limited to 'controller-api/src/main')
2 files changed, 16 insertions, 2 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/BillingReference.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/BillingReference.java new file mode 100644 index 00000000000..a1afdc511bd --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/BillingReference.java @@ -0,0 +1,6 @@ +package com.yahoo.vespa.hosted.controller.tenant; + +import java.time.Instant; + +public record BillingReference(String reference, Instant updated) { +} 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 2275f3a9bf8..4d7aee7b604 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 @@ -27,11 +27,14 @@ public class CloudTenant extends Tenant { private final List<TenantSecretStore> tenantSecretStores; private final ArchiveAccess archiveAccess; private final Optional<Instant> invalidateUserSessionsBefore; + private final Optional<BillingReference> billingReference; /** 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<TenantSecretStore> tenantSecretStores, ArchiveAccess archiveAccess, + Optional<Instant> invalidateUserSessionsBefore, Instant tenantRoleLastMaintained, + Optional<BillingReference> billingReference) { super(name, createdAt, lastLoginInfo, Optional.empty(), tenantRoleLastMaintained); this.creator = creator; this.developerKeys = developerKeys; @@ -39,6 +42,7 @@ public class CloudTenant extends Tenant { this.tenantSecretStores = tenantSecretStores; this.archiveAccess = Objects.requireNonNull(archiveAccess); this.invalidateUserSessionsBefore = invalidateUserSessionsBefore; + this.billingReference = Objects.requireNonNull(billingReference); } /** Creates a tenant with the given name, provided it passes validation. */ @@ -47,7 +51,7 @@ public class CloudTenant extends Tenant { createdAt, LastLoginInfo.EMPTY, Optional.ofNullable(creator).map(SimplePrincipal::of), - ImmutableBiMap.of(), TenantInfo.empty(), List.of(), new ArchiveAccess(), Optional.empty(), Instant.EPOCH); + ImmutableBiMap.of(), TenantInfo.empty(), List.of(), new ArchiveAccess(), Optional.empty(), Instant.EPOCH, Optional.empty()); } /** The user that created the tenant */ @@ -83,6 +87,10 @@ public class CloudTenant extends Tenant { return invalidateUserSessionsBefore; } + public Optional<BillingReference> billingReference() { + return billingReference; + } + @Override public Type type() { return Type.cloud; |