summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@yahooinc.com>2023-01-03 12:52:16 +0100
committerØyvind Grønnesby <oyving@yahooinc.com>2023-01-03 12:52:16 +0100
commit238d0194a761ba256ac75b9cad8d549bef555457 (patch)
treebfc61e532133232ba13a77aff4a7cff326526c30 /controller-server
parentf06cfb7712be14df320502decdb3251f5b39dbcc (diff)
Minor tweaks
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java30
1 files changed, 6 insertions, 24 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java
index aeae65ad9d2..fbf4c30df12 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java
@@ -34,16 +34,6 @@ import static com.yahoo.yolean.Exceptions.uncheck;
* @author enygaard
*/
public class Notifier {
- private static final String header = """
- <div style="background: #00598c; height: 55px; width: 100%">
- <img
- src="https://vespa.ai/assets/vespa-logo.png"
- style="width: auto; height: 34px; margin: 10px"
- />
- </div>
- <br>
- """;
-
private final CuratorDb curatorDb;
private final Mailer mailer;
private final FlagSource flagSource;
@@ -72,13 +62,11 @@ public class Notifier {
}
var tenant = curatorDb.readTenant(source.tenant());
tenant.stream().forEach(t -> {
- if (t instanceof CloudTenant) {
- var ct = (CloudTenant) t;
+ if (t instanceof CloudTenant ct) {
ct.info().contacts().all().stream()
.filter(c -> c.audiences().contains(TenantContacts.Audience.NOTIFICATIONS))
.collect(Collectors.groupingBy(TenantContacts.Contact::type, Collectors.toList()))
- .entrySet()
- .forEach(e -> notifications.forEach(n -> dispatch(n, e.getKey(), e.getValue())));
+ .forEach((type, contacts) -> notifications.forEach(n -> dispatch(n, type, contacts)));
}
});
}
@@ -95,22 +83,16 @@ public class Notifier {
private boolean skipSource(NotificationSource source) {
// Do not dispatch notification for dev and perf environments
- if (source.zoneId()
+ return source.zoneId()
.map(z -> z.environment())
.map(e -> e == Environment.dev || e == Environment.perf)
- .orElse(false)) {
- return true;
- }
- return false;
+ .orElse(false);
}
private void dispatch(Notification notification, TenantContacts.Type type, Collection<? extends TenantContacts.Contact> contacts) {
switch (type) {
- case EMAIL:
- dispatch(notification, contacts.stream().map(c -> (TenantContacts.EmailContact) c).toList());
- break;
- default:
- throw new IllegalArgumentException("Unknown TenantContacts type " + type.name());
+ case EMAIL -> dispatch(notification, contacts.stream().map(c -> (TenantContacts.EmailContact) c).toList());
+ default -> throw new IllegalArgumentException("Unknown TenantContacts type " + type.name());
}
}