summaryrefslogtreecommitdiffstats
path: root/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java')
-rw-r--r--config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java46
1 files changed, 44 insertions, 2 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java b/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java
index 349faf90cb0..8d0a68b47f5 100644
--- a/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java
+++ b/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java
@@ -44,7 +44,8 @@ public class DeploymentSpec {
Collections.emptyList(),
"<deployment version='1.0'/>",
Optional.empty(),
- Optional.empty());
+ Optional.empty(),
+ Notifications.none());
private final Optional<String> globalServiceId;
private final UpgradePolicy upgradePolicy;
@@ -54,10 +55,11 @@ public class DeploymentSpec {
private final String xmlForm;
private final Optional<AthenzDomain> athenzDomain;
private final Optional<AthenzService> athenzService;
+ private final Notifications notifications;
public DeploymentSpec(Optional<String> globalServiceId, UpgradePolicy upgradePolicy, Optional<Integer> majorVersion,
List<ChangeBlocker> changeBlockers, List<Step> steps, String xmlForm,
- Optional<AthenzDomain> athenzDomain, Optional<AthenzService> athenzService) {
+ Optional<AthenzDomain> athenzDomain, Optional<AthenzService> athenzService, Notifications notifications) {
validateTotalDelay(steps);
this.globalServiceId = globalServiceId;
this.upgradePolicy = upgradePolicy;
@@ -67,6 +69,7 @@ public class DeploymentSpec {
this.xmlForm = xmlForm;
this.athenzDomain = athenzDomain;
this.athenzService = athenzService;
+ this.notifications = notifications;
validateZones(this.steps);
validateAthenz();
}
@@ -192,6 +195,9 @@ public class DeploymentSpec {
.collect(Collectors.toList());
}
+ /** Returns the notification configuration */
+ public Notifications notifications() { return notifications; }
+
/** Returns the XML form of this spec, or null if it was not created by fromXml, nor is empty */
public String xmlForm() { return xmlForm; }
@@ -448,4 +454,40 @@ public class DeploymentSpec {
}
+
+ /**
+ * Configuration of notifications for deployment jobs.
+ *
+ * Supports a list of email recipients, and a flag for whether to send to the commit author.
+ */
+ public static class Notifications {
+
+ private static final Notifications none = of(Collections.emptyList(), false);
+ public static Notifications none() { return none; }
+
+ private final List<String> staticEmails;
+ private final boolean includeAuthor;
+
+ private Notifications(List<String> staticEmails, boolean includeAuthor) {
+ this.staticEmails = ImmutableList.copyOf(staticEmails);
+ this.includeAuthor = includeAuthor;
+ }
+
+ public static Notifications of(List<String> staticEmails, boolean includeAuthor) {
+ if (staticEmails.isEmpty() && ! includeAuthor)
+ return none;
+
+ return new Notifications(staticEmails, includeAuthor);
+ }
+
+ public List<String> staticEmails() {
+ return staticEmails;
+ }
+
+ public boolean includeAuthor() {
+ return includeAuthor;
+ }
+
+ }
+
}