aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@verizonmedia.com>2022-03-01 11:28:13 +0100
committerLeandro Alves <leandroalves@yahooinc.com>2022-03-14 11:01:55 +0100
commit44fb5236f8949820632bffa12feaddee75ce31d2 (patch)
tree4963855d47815bd739fd458966bc33f97803d436
parent6012cf065da30cf9baee97706d67a6ff6e77cb46 (diff)
Rename TenantInfoBillingContact -> TenantBilling
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantBilling.java (renamed from controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoBillingContact.java)20
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfo.java12
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoContacts.java28
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializer.java8
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java8
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializerTest.java4
6 files changed, 54 insertions, 26 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoBillingContact.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantBilling.java
index 2c9a0196905..53ded1983cb 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoBillingContact.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantBilling.java
@@ -6,22 +6,22 @@ import java.util.Objects;
/**
* @author smorgrav
*/
-public class TenantInfoBillingContact {
+public class TenantBilling {
private final TenantContact contact;
private final TenantAddress address;
- TenantInfoBillingContact(String name, String email, String phone, TenantAddress address) {
+ TenantBilling(String name, String email, String phone, TenantAddress address) {
this(TenantContact.from(name, email, phone), address);
}
- TenantInfoBillingContact(TenantContact contact, TenantAddress address) {
+ TenantBilling(TenantContact contact, TenantAddress address) {
this.contact = Objects.requireNonNull(contact);
this.address = Objects.requireNonNull(address);
}
- public static TenantInfoBillingContact empty() {
- return new TenantInfoBillingContact("", "", "", TenantAddress.empty());
+ public static TenantBilling empty() {
+ return new TenantBilling("", "", "", TenantAddress.empty());
}
public TenantContact contact() {
@@ -32,12 +32,12 @@ public class TenantInfoBillingContact {
return address;
}
- public TenantInfoBillingContact withContact(TenantContact updatedContact) {
- return new TenantInfoBillingContact(updatedContact, this.address);
+ public TenantBilling withContact(TenantContact updatedContact) {
+ return new TenantBilling(updatedContact, this.address);
}
- public TenantInfoBillingContact withAddress(TenantAddress updatedAddress) {
- return new TenantInfoBillingContact(this.contact, updatedAddress);
+ public TenantBilling withAddress(TenantAddress updatedAddress) {
+ return new TenantBilling(this.contact, updatedAddress);
}
public boolean isEmpty() {
@@ -48,7 +48,7 @@ public class TenantInfoBillingContact {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
- TenantInfoBillingContact that = (TenantInfoBillingContact) o;
+ TenantBilling that = (TenantBilling) o;
return Objects.equals(contact, that.contact) && Objects.equals(address, that.address);
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfo.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfo.java
index 9a295c5d19a..f658ec4ece9 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfo.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfo.java
@@ -20,14 +20,14 @@ public class TenantInfo {
private final TenantContact contact;
private final TenantAddress address;
- private final TenantInfoBillingContact billingContact;
+ private final TenantBilling billingContact;
TenantInfo(String name, String email, String website, String contactName, String contactEmail,
- TenantAddress address, TenantInfoBillingContact billingContact) {
+ TenantAddress address, TenantBilling billingContact) {
this(name, email, website, TenantContact.from(contactName, contactEmail), address, billingContact);
}
- TenantInfo(String name, String email, String website, TenantContact contact, TenantAddress address, TenantInfoBillingContact billing) {
+ TenantInfo(String name, String email, String website, TenantContact contact, TenantAddress address, TenantBilling billing) {
this.name = Objects.requireNonNull(name);
this.email = Objects.requireNonNull(email);
this.website = Objects.requireNonNull(website);
@@ -37,7 +37,7 @@ public class TenantInfo {
}
public static TenantInfo empty() {
- return new TenantInfo("", "", "", "", "", TenantAddress.empty(), TenantInfoBillingContact.empty());
+ return new TenantInfo("", "", "", "", "", TenantAddress.empty(), TenantBilling.empty());
}
public String name() {
@@ -56,7 +56,7 @@ public class TenantInfo {
public TenantAddress address() { return address; }
- public TenantInfoBillingContact billingContact() {
+ public TenantBilling billingContact() {
return billingContact;
}
@@ -84,7 +84,7 @@ public class TenantInfo {
return new TenantInfo(name, email, website, contact, address, billingContact);
}
- public TenantInfo withBilling(TenantInfoBillingContact billingContact) {
+ public TenantInfo withBilling(TenantBilling billingContact) {
return new TenantInfo(name, email, website, contact, address, billingContact);
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoContacts.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoContacts.java
new file mode 100644
index 00000000000..dddbcdd1d91
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoContacts.java
@@ -0,0 +1,28 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.tenant;
+
+import java.util.EnumMap;
+
+/**
+ * @author ogronnesby
+ */
+public class TenantInfoContacts {
+ private final EnumMap<ContactType, TenantContact> contacts;
+
+ TenantInfoContacts() {
+ this.contacts = new EnumMap<>(ContactType.class);
+ }
+
+ public enum ContactType {
+ DEFAULT("default"),
+ PRODUCT("product");
+
+ private final String value;
+
+ ContactType(String value) {
+ this.value = value;
+ }
+
+ public String value() { return value; }
+ }
+}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializer.java
index 020e9137779..d4d7a60e440 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializer.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializer.java
@@ -25,7 +25,7 @@ import com.yahoo.vespa.hosted.controller.tenant.Tenant;
import com.yahoo.vespa.hosted.controller.tenant.TenantAddress;
import com.yahoo.vespa.hosted.controller.tenant.TenantContact;
import com.yahoo.vespa.hosted.controller.tenant.TenantInfo;
-import com.yahoo.vespa.hosted.controller.tenant.TenantInfoBillingContact;
+import com.yahoo.vespa.hosted.controller.tenant.TenantBilling;
import java.net.URI;
import java.security.Principal;
@@ -216,8 +216,8 @@ public class TenantSerializer {
.withCountry(addressObject.field("country").asString());
}
- private TenantInfoBillingContact tenantInfoBillingContactFromSlime(Inspector billingObject) {
- return TenantInfoBillingContact.empty()
+ private TenantBilling tenantInfoBillingContactFromSlime(Inspector billingObject) {
+ return TenantBilling.empty()
.withContact(TenantContact.from(
billingObject.field("name").asString(),
billingObject.field("email").asString(),
@@ -271,7 +271,7 @@ public class TenantSerializer {
addressCursor.setString("country", address.country());
}
- private void toSlime(TenantInfoBillingContact billingContact, Cursor parentCursor) {
+ private void toSlime(TenantBilling billingContact, Cursor parentCursor) {
if (billingContact.isEmpty()) return;
Cursor addressCursor = parentCursor.setObject("billingContact");
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
index 954b5826317..d86da327e61 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
@@ -114,7 +114,7 @@ import com.yahoo.vespa.hosted.controller.tenant.Tenant;
import com.yahoo.vespa.hosted.controller.tenant.TenantAddress;
import com.yahoo.vespa.hosted.controller.tenant.TenantContact;
import com.yahoo.vespa.hosted.controller.tenant.TenantInfo;
-import com.yahoo.vespa.hosted.controller.tenant.TenantInfoBillingContact;
+import com.yahoo.vespa.hosted.controller.tenant.TenantBilling;
import com.yahoo.vespa.hosted.controller.versions.VersionStatus;
import com.yahoo.vespa.hosted.controller.versions.VespaVersion;
import com.yahoo.vespa.serviceview.bindings.ApplicationView;
@@ -524,7 +524,7 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
addressCursor.setString("country", address.country());
}
- private void toSlime(TenantInfoBillingContact billingContact, Cursor parentCursor) {
+ private void toSlime(TenantBilling billingContact, Cursor parentCursor) {
if (billingContact.isEmpty()) return;
Cursor addressCursor = parentCursor.setObject("billingContact");
@@ -630,10 +630,10 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
.withPhone(getString(insp.field("phone"), oldContact.phone()));
}
- private TenantInfoBillingContact updateTenantInfoBillingContact(Inspector insp, TenantInfoBillingContact oldContact) {
+ private TenantBilling updateTenantInfoBillingContact(Inspector insp, TenantBilling oldContact) {
if (!insp.valid()) return oldContact;
- return TenantInfoBillingContact.empty()
+ return TenantBilling.empty()
.withContact(updateTenantInfoContact(insp, oldContact.contact()))
.withAddress(updateTenantInfoAddress(insp.field("address"), oldContact.address()));
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializerTest.java
index 898ef957f32..6838a94119d 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/TenantSerializerTest.java
@@ -19,7 +19,7 @@ import com.yahoo.vespa.hosted.controller.tenant.LastLoginInfo;
import com.yahoo.vespa.hosted.controller.tenant.TenantAddress;
import com.yahoo.vespa.hosted.controller.tenant.TenantContact;
import com.yahoo.vespa.hosted.controller.tenant.TenantInfo;
-import com.yahoo.vespa.hosted.controller.tenant.TenantInfoBillingContact;
+import com.yahoo.vespa.hosted.controller.tenant.TenantBilling;
import org.junit.Test;
import java.net.URI;
@@ -154,7 +154,7 @@ public class TenantSerializerTest {
.withCountry("Norway")
.withCode("3510")
.withRegion("Viken"))
- .withBilling(TenantInfoBillingContact.empty()
+ .withBilling(TenantBilling.empty()
.withContact(TenantContact.from("Thomas The Tank Engine", "thomas@sodor.com", "NA"))
.withAddress(TenantAddress.empty()
.withCity("Suddery")