summaryrefslogtreecommitdiffstats
path: root/controller-api/src
diff options
context:
space:
mode:
Diffstat (limited to 'controller-api/src')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java2
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantAddress.java98
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantBilling.java63
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantContact.java69
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantContacts.java147
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfo.java133
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoAddress.java97
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoBillingContact.java78
8 files changed, 435 insertions, 252 deletions
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 9894de86116..9a4e04ebb3a 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
@@ -53,7 +53,7 @@ public class CloudTenant extends Tenant {
createdAt,
LastLoginInfo.EMPTY,
Optional.ofNullable(creator),
- ImmutableBiMap.of(), TenantInfo.EMPTY, List.of(), Optional.empty());
+ ImmutableBiMap.of(), TenantInfo.empty(), List.of(), Optional.empty());
}
/** The user that created the tenant */
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantAddress.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantAddress.java
new file mode 100644
index 00000000000..57c4757bde0
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantAddress.java
@@ -0,0 +1,98 @@
+// 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.Objects;
+
+/**
+ * A generic address container that tries to make as few assumptions about addresses as possible.
+ * Most addresses have some of these fields, but with different names (e.g. postal code vs zip code).
+ *
+ * When consuming data from this class, do not make any assumptions about which fields have content.
+ * An address might be still valid with surprisingly little information.
+ *
+ * All fields are non-null, but might be empty strings.
+ *
+ * @author ogronnesby
+ */
+public class TenantAddress {
+ private final String address;
+ private final String code;
+ private final String city;
+ private final String region;
+ private final String country;
+
+ TenantAddress(String address, String code, String city, String region, String country) {
+ this.address = Objects.requireNonNull(address, "'address' was null");
+ this.code = Objects.requireNonNull(code, "'code' was null");
+ this.city = Objects.requireNonNull(city, "'city' was null");
+ this.region = Objects.requireNonNull(region, "'region' was null");
+ this.country = Objects.requireNonNull(country, "'country' was null");
+ }
+
+ public static TenantAddress empty() {
+ return new TenantAddress("", "", "", "", "");
+ }
+
+ /** Multi-line fields that has the contents of the street address (or similar) */
+ public String address() { return address; }
+
+ /** The ZIP or postal code part of the address */
+ public String code() { return code; }
+
+ /** The city of the address */
+ public String city() { return city; }
+
+ /** The region part of the address - e.g. a state, county, or province */
+ public String region() { return region; }
+
+ /** The country part of the address. Its name, not a code */
+ public String country() { return country; }
+
+ public boolean isEmpty() {
+ return this.equals(empty());
+ }
+
+ public TenantAddress withAddress(String address) {
+ return new TenantAddress(address, code, city, region, country);
+ }
+
+ public TenantAddress withCode(String code) {
+ return new TenantAddress(address, code, city, region, country);
+ }
+
+ public TenantAddress withCity(String city) {
+ return new TenantAddress(address, code, city, region, country);
+ }
+
+ public TenantAddress withRegion(String region) {
+ return new TenantAddress(address, code, city, region, country);
+ }
+
+ public TenantAddress withCountry(String country) {
+ return new TenantAddress(address, code, city, region, country);
+ }
+
+ @Override
+ public String toString() {
+ return "TenantAddress{" +
+ "address='" + address + '\'' +
+ ", code='" + code + '\'' +
+ ", city='" + city + '\'' +
+ ", region='" + region + '\'' +
+ ", country='" + country + '\'' +
+ '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ TenantAddress that = (TenantAddress) o;
+ return Objects.equals(address, that.address) && Objects.equals(code, that.code) && Objects.equals(city, that.city) && Objects.equals(region, that.region) && Objects.equals(country, that.country);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(address, code, city, region, country);
+ }
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantBilling.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantBilling.java
new file mode 100644
index 00000000000..61381f308ef
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantBilling.java
@@ -0,0 +1,63 @@
+// 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.Objects;
+
+/**
+ * @author smorgrav
+ */
+public class TenantBilling {
+
+ private final TenantContact contact;
+ private final TenantAddress address;
+
+ public TenantBilling(TenantContact contact, TenantAddress address) {
+ this.contact = Objects.requireNonNull(contact);
+ this.address = Objects.requireNonNull(address);
+ }
+
+ public static TenantBilling empty() {
+ return new TenantBilling(TenantContact.empty(), TenantAddress.empty());
+ }
+
+ public TenantContact contact() {
+ return contact;
+ }
+
+ public TenantAddress address() {
+ return address;
+ }
+
+ public TenantBilling withContact(TenantContact updatedContact) {
+ return new TenantBilling(updatedContact, this.address);
+ }
+
+ public TenantBilling withAddress(TenantAddress updatedAddress) {
+ return new TenantBilling(this.contact, updatedAddress);
+ }
+
+ public boolean isEmpty() {
+ return this.equals(empty());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ TenantBilling that = (TenantBilling) o;
+ return Objects.equals(contact, that.contact) && Objects.equals(address, that.address);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(contact, address);
+ }
+
+ @Override
+ public String toString() {
+ return "TenantInfoBillingContact{" +
+ "contact=" + contact +
+ ", address=" + address +
+ '}';
+ }
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantContact.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantContact.java
new file mode 100644
index 00000000000..3aa5600ed87
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantContact.java
@@ -0,0 +1,69 @@
+// 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.Objects;
+
+/**
+ * @author ogronnesby
+ */
+public class TenantContact {
+ private final String name;
+ private final String email;
+ private final String phone;
+
+ private TenantContact(String name, String email, String phone) {
+ this.name = Objects.requireNonNull(name);
+ this.email = Objects.requireNonNull(email);
+ this.phone = Objects.requireNonNull(phone);
+ }
+
+ public static TenantContact from(String name, String email, String phone) {
+ return new TenantContact(name, email, phone);
+ }
+
+ public static TenantContact from(String name, String email) {
+ return TenantContact.from(name, email, "");
+ }
+
+ public static TenantContact empty() {
+ return new TenantContact("", "", "");
+ }
+
+ public String name() { return name; }
+ public String email() { return email; }
+ public String phone() { return phone; }
+
+ public TenantContact withName(String name) {
+ return new TenantContact(name, email, phone);
+ }
+
+ public TenantContact withEmail(String email) {
+ return new TenantContact(name, email, phone);
+ }
+
+ public TenantContact withPhone(String phone) {
+ return new TenantContact(name, email, phone);
+ }
+
+ @Override
+ public String toString() {
+ return "TenantContact{" +
+ "name='" + name + '\'' +
+ ", email='" + email + '\'' +
+ ", phone='" + phone + '\'' +
+ '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ TenantContact that = (TenantContact) o;
+ return Objects.equals(name, that.name) && Objects.equals(email, that.email) && Objects.equals(phone, that.phone);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name, email, phone);
+ }
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantContacts.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantContacts.java
new file mode 100644
index 00000000000..14635a3bb30
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantContacts.java
@@ -0,0 +1,147 @@
+// 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.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * Tenant contacts are targets of the notification system. Sometimes they
+ * are a person with an email address, other times they are a Slack channel,
+ * IRC plugin, etc.
+ *
+ * @author ogronnesby
+ */
+public class TenantContacts {
+ private final List<? extends Contact> contacts;
+
+ public TenantContacts(List<? extends Contact> contacts) {
+ this.contacts = List.copyOf(contacts);
+ }
+
+ public static TenantContacts empty() {
+ return new TenantContacts(List.of());
+ }
+
+ public List<? extends Contact> all() {
+ return contacts;
+ }
+
+ public boolean isEmpty() {
+ return contacts.isEmpty();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ TenantContacts that = (TenantContacts) o;
+ return contacts.equals(that.contacts);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(contacts);
+ }
+
+ @Override
+ public String toString() {
+ return "TenantContacts{" +
+ "contacts=" + contacts +
+ '}';
+ }
+
+ public abstract static class Contact {
+ private final List<Audience> audiences;
+
+ public Contact(List<Audience> audiences) {
+ this.audiences = List.copyOf(audiences);
+ if (audiences.isEmpty()) throw new IllegalArgumentException("at least one notification activity must be enabled");
+ }
+
+ public List<Audience> audiences() { return audiences; }
+
+ public abstract Type type();
+
+ public abstract boolean equals(Object o);
+ public abstract int hashCode();
+ public abstract String toString();
+ }
+
+ public static class EmailContact extends Contact {
+ private final String email;
+
+ public EmailContact(List<Audience> audiences, String email) {
+ super(audiences);
+ this.email = email;
+ }
+
+ public String email() { return email; }
+
+ @Override
+ public Type type() {
+ return Type.EMAIL;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ EmailContact that = (EmailContact) o;
+ return email.equals(that.email);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(email);
+ }
+
+ @Override
+ public String toString() {
+ return "EmailContact{" +
+ "email='" + email + '\'' +
+ '}';
+ }
+ }
+
+ public enum Type {
+ EMAIL("email");
+
+ private final String value;
+
+ Type(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return this.value;
+ }
+
+ public static Optional<Type> from(String value) {
+ return Arrays.stream(Type.values()).filter(x -> x.value().equals(value)).findAny();
+ }
+ }
+
+ public enum Audience {
+ // tenant admin type updates about billing etc.
+ TENANT("tenant"),
+
+ // system notifications like deployment failures etc.
+ NOTIFICATIONS("notifications");
+
+ private final String value;
+
+ Audience(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ public static Optional<Audience> from(String value) {
+ return Arrays.stream(Audience.values()).filter((x -> x.value().equals(value))).findAny();
+ }
+ }
+}
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 87d4f03b090..0ca7863fbce 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
@@ -13,51 +13,34 @@ import java.util.Objects;
* @author smorgrav
*/
public class TenantInfo {
- // Editable as 'Tenant Information - Company Name'
- // Viewable in the 'Account - Profile' section as 'Company Name'
- private final String name;
- // Editable as 'Tenant Information - Email'
- // Not displayed outside of 'Edit profile'
+ private final String name;
private final String email;
-
- // Editable as 'Tenant Information - Website'
- // Viewable in the 'Account - Profile' section at bottom of 'Contact Information'
private final String website;
- // Editable as 'Contact Information - Contact Name'
- // Viewable in the 'Account - Profile' section in 'Contact Information'
- private final String contactName;
-
- // Editable as 'Contact Information - Contact Email'
- // Viewable in the 'Account - Profile' section in 'Contact Information'
- private final String contactEmail;
-
- // Not editable in the account setting
- // Not viewable.
- // TODO: Remove
- private final String invoiceEmail;
-
- // See class for more info
- private final TenantInfoAddress address;
-
- // See class for more info
- private final TenantInfoBillingContact billingContact;
+ private final TenantContact contact;
+ private final TenantAddress address;
+ private final TenantBilling billingContact;
+ private final TenantContacts contacts;
TenantInfo(String name, String email, String website, String contactName, String contactEmail,
- String invoiceEmail, TenantInfoAddress address, TenantInfoBillingContact billingContact) {
+ TenantAddress address, TenantBilling billingContact, TenantContacts contacts) {
+ this(name, email, website, TenantContact.from(contactName, contactEmail), address, billingContact, contacts);
+ }
+
+ TenantInfo(String name, String email, String website, TenantContact contact, TenantAddress address, TenantBilling billing, TenantContacts contacts) {
this.name = Objects.requireNonNull(name);
this.email = Objects.requireNonNull(email);
this.website = Objects.requireNonNull(website);
- this.contactName = Objects.requireNonNull(contactName);
- this.contactEmail = Objects.requireNonNull(contactEmail);
- this.invoiceEmail = Objects.requireNonNull(invoiceEmail);
+ this.contact = Objects.requireNonNull(contact);
this.address = Objects.requireNonNull(address);
- this.billingContact = Objects.requireNonNull(billingContact);
+ this.billingContact = Objects.requireNonNull(billing);
+ this.contacts = Objects.requireNonNull(contacts);
}
- public static final TenantInfo EMPTY = new TenantInfo("","","", "", "", "",
- TenantInfoAddress.EMPTY, TenantInfoBillingContact.EMPTY);
+ public static TenantInfo empty() {
+ return new TenantInfo("", "", "", "", "", TenantAddress.empty(), TenantBilling.empty(), TenantContacts.empty());
+ }
public String name() {
return name;
@@ -71,60 +54,46 @@ public class TenantInfo {
return website;
}
- public String contactName() {
- return contactName;
- }
-
- public String contactEmail() {
- return contactEmail;
- }
-
- public String invoiceEmail() {
- return invoiceEmail;
- }
+ public TenantContact contact() { return contact; }
- public TenantInfoAddress address() {
- return address;
- }
+ public TenantAddress address() { return address; }
- public TenantInfoBillingContact billingContact() {
+ public TenantBilling billingContact() {
return billingContact;
}
- public TenantInfo withName(String newName) {
- return new TenantInfo(newName, email, website, contactName, contactEmail, invoiceEmail, address, billingContact);
- }
+ public TenantContacts contacts() { return contacts; }
- public TenantInfo withEmail(String newEmail) {
- return new TenantInfo(name, newEmail, website, contactName, contactEmail, invoiceEmail, address, billingContact);
+ public boolean isEmpty() {
+ return this.equals(empty());
}
- public TenantInfo withWebsite(String newWebsite) {
- return new TenantInfo(name, email, newWebsite, contactName, contactEmail, invoiceEmail, address, billingContact);
+ public TenantInfo withName(String name) {
+ return new TenantInfo(name, email, website, contact, address, billingContact, contacts);
}
- public TenantInfo withContactName(String newContactName) {
- return new TenantInfo(name, email, website, newContactName, contactEmail, invoiceEmail, address, billingContact);
+ public TenantInfo withEmail(String email) {
+ return new TenantInfo(name, email, website, contact, address, billingContact, contacts);
}
- public TenantInfo withContactEmail(String newContactEmail) {
- return new TenantInfo(name, email, website, contactName, newContactEmail, invoiceEmail, address, billingContact);
+ public TenantInfo withWebsite(String website) {
+ return new TenantInfo(name, email, website, contact, address, billingContact, contacts);
}
- public TenantInfo withInvoiceEmail(String newInvoiceEmail) {
- return new TenantInfo(name, email, website, contactName, contactEmail, newInvoiceEmail, address, billingContact);
+ public TenantInfo withContact(TenantContact contact) {
+ return new TenantInfo(name, email, website, contact, address, billingContact, contacts);
}
- public TenantInfo withAddress(TenantInfoAddress newAddress) {
- return new TenantInfo(name, email, website, contactName, contactEmail, invoiceEmail, newAddress, billingContact);
+ public TenantInfo withAddress(TenantAddress address) {
+ return new TenantInfo(name, email, website, contact, address, billingContact, contacts);
}
- public TenantInfo withBillingContact(TenantInfoBillingContact newBillingContact) {
- return new TenantInfo(name, email, website, contactName, contactEmail, invoiceEmail, address, newBillingContact);
+ public TenantInfo withBilling(TenantBilling billingContact) {
+ return new TenantInfo(name, email, website, contact, address, billingContact, contacts);
}
- public boolean isEmpty() {
- return this.equals(EMPTY);
+ public TenantInfo withContacts(TenantContacts contacts) {
+ return new TenantInfo(name, email, website, contact, address, billingContact, contacts);
}
@Override
@@ -132,18 +101,30 @@ public class TenantInfo {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TenantInfo that = (TenantInfo) o;
- return name.equals(that.name) &&
- email.equals(that.email) &&
- website.equals(that.website) &&
- contactName.equals(that.contactName) &&
- contactEmail.equals(that.contactEmail) &&
- invoiceEmail.equals(that.invoiceEmail) &&
- address.equals(that.address) &&
- billingContact.equals(that.billingContact);
+ return Objects.equals(name, that.name) &&
+ Objects.equals(email, that.email) &&
+ Objects.equals(website, that.website) &&
+ Objects.equals(contact, that.contact) &&
+ Objects.equals(address, that.address) &&
+ Objects.equals(billingContact, that.billingContact) &&
+ Objects.equals(contacts, that.contacts);
}
@Override
public int hashCode() {
- return Objects.hash(name, email, website, contactName, contactEmail, invoiceEmail, address, billingContact);
+ return Objects.hash(name, email, website, contact, address, billingContact, contacts);
+ }
+
+ @Override
+ public String toString() {
+ return "TenantInfo{" +
+ "name='" + name + '\'' +
+ ", email='" + email + '\'' +
+ ", website='" + website + '\'' +
+ ", contact=" + contact +
+ ", address=" + address +
+ ", billingContact=" + billingContact +
+ ", contacts=" + contacts +
+ '}';
}
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoAddress.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoAddress.java
deleted file mode 100644
index 740adde4519..00000000000
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoAddress.java
+++ /dev/null
@@ -1,97 +0,0 @@
-// 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.Objects;
-
-/**
- * Address formats are quite diverse across the world both in therms of what fields are used, named and
- * the order of them.
- *
- * To be generic a little future proof the address fields here are a mix of free text (address lines) and fixed fields.
- * The address lines can be street address, P.O box, c/o name, apartment, suite, unit, building floor etc etc.
- *
- * All fields are mandatory but can be an empty string (ie. not null)
- *
- * @author smorgrav
- */
-public class TenantInfoAddress {
-
- // All fields are editable in 'Edit Profile - Company Address'.
- // The fields are not exposed outside the 'Edit Profile' form.
- private final String addressLines;
- private final String postalCodeOrZip;
- private final String city;
- private final String stateRegionProvince;
- private final String country;
-
- TenantInfoAddress(String addressLines, String postalCodeOrZip, String city, String country, String stateRegionProvince) {
- this.addressLines = Objects.requireNonNull(addressLines);;
- this.city = Objects.requireNonNull(city);
- this.postalCodeOrZip = Objects.requireNonNull(postalCodeOrZip);
- this.country = Objects.requireNonNull(country);
- this.stateRegionProvince = Objects.requireNonNull(stateRegionProvince);
- }
-
- public static final TenantInfoAddress EMPTY = new TenantInfoAddress("","","", "", "");
-
- public String addressLines() {
- return addressLines;
- }
-
- public String postalCodeOrZip() {
- return postalCodeOrZip;
- }
-
- public String city() {
- return city;
- }
-
- public String country() {
- return country;
- }
-
- public String stateRegionProvince() {
- return stateRegionProvince;
- }
-
- public TenantInfoAddress withAddressLines(String newAddressLines) {
- return new TenantInfoAddress(newAddressLines, postalCodeOrZip, city, country, stateRegionProvince);
- }
-
- public TenantInfoAddress withPostalCodeOrZip(String newPostalCodeOrZip) {
- return new TenantInfoAddress(addressLines, newPostalCodeOrZip, city, country, stateRegionProvince);
- }
-
- public TenantInfoAddress withCity(String newCity) {
- return new TenantInfoAddress(addressLines, postalCodeOrZip, newCity, country, stateRegionProvince);
- }
-
- public TenantInfoAddress withCountry(String newCountry) {
- return new TenantInfoAddress(addressLines, postalCodeOrZip, city, newCountry, stateRegionProvince);
- }
-
- public TenantInfoAddress withStateRegionProvince(String newStateRegionProvince) {
- return new TenantInfoAddress(addressLines, postalCodeOrZip, city, country, newStateRegionProvince);
- }
-
- public boolean isEmpty() {
- return this.equals(EMPTY);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- TenantInfoAddress that = (TenantInfoAddress) o;
- return addressLines.equals(that.addressLines) &&
- postalCodeOrZip.equals(that.postalCodeOrZip) &&
- city.equals(that.city) &&
- stateRegionProvince.equals(that.stateRegionProvince) &&
- country.equals(that.country);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(addressLines, postalCodeOrZip, city, stateRegionProvince, country);
- }
-}
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/TenantInfoBillingContact.java
deleted file mode 100644
index c875a19d57b..00000000000
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/tenant/TenantInfoBillingContact.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// 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.Objects;
-
-/**
- * @author smorgrav
- */
-public class TenantInfoBillingContact {
-
- // All fields are editable in 'Billing - Edit billing contact'
- // Only 'name' and 'email' are exposed outside the 'Edit billing contact' form.
- // All these fields are required by the billing process.
- private final String name;
- private final String email;
- private final String phone;
- private final TenantInfoAddress address;
-
- TenantInfoBillingContact(String name, String email, String phone, TenantInfoAddress address) {
- this.name = Objects.requireNonNull(name);
- this.email = Objects.requireNonNull(email);
- this.phone = Objects.requireNonNull(phone);
- this.address = Objects.requireNonNull(address);
- }
-
- public static final TenantInfoBillingContact EMPTY =
- new TenantInfoBillingContact("","", "", TenantInfoAddress.EMPTY);
-
- public String name() {
- return name;
- }
-
- public String email() { return email; }
-
- public String phone() {
- return phone;
- }
-
- public TenantInfoAddress address() {
- return address;
- }
-
- public TenantInfoBillingContact withName(String newName) {
- return new TenantInfoBillingContact(newName, email, phone, address);
- }
-
- public TenantInfoBillingContact withEmail(String newEmail) {
- return new TenantInfoBillingContact(name, newEmail, phone, address);
- }
-
- public TenantInfoBillingContact withPhone(String newPhone) {
- return new TenantInfoBillingContact(name, email, newPhone, address);
- }
-
- public TenantInfoBillingContact withAddress(TenantInfoAddress newAddress) {
- return new TenantInfoBillingContact(name, email, phone, newAddress);
- }
-
- public boolean isEmpty() {
- return this.equals(EMPTY);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- TenantInfoBillingContact that = (TenantInfoBillingContact) o;
- return name.equals(that.name) &&
- email.equals(that.email) &&
- phone.equals(that.phone) &&
- address.equals(that.address);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(name, email, phone, address);
- }
-}