summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-03-17 11:11:12 +0100
committerMartin Polden <mpolden@mpolden.no>2021-03-17 11:37:43 +0100
commit80dea1dcf0b18e378b0214ec1319a38b68844910 (patch)
treec56079a4efe49151ab4b8d8807efed3084823737 /controller-api
parente91a0341b66180d8a0ac8f1a8f17b0fcd4e5a30f (diff)
Cleanup
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/CloudEvent.java21
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/MockAwsEventFetcher.java6
2 files changed, 18 insertions, 9 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/CloudEvent.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/CloudEvent.java
index defcda28a0f..849a21bebb0 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/CloudEvent.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/CloudEvent.java
@@ -5,27 +5,32 @@ import java.util.Date;
import java.util.Optional;
import java.util.Set;
-public final class CloudEvent {
+/**
+ * A maintenance event in a cloud service.
+ *
+ * @author freva
+ */
+public class CloudEvent {
+
public final String instanceEventId;
public final String code;
public final String description;
public final Optional<Date> notBefore;
public final Optional<Date> notBeforeDeadline;
public final Optional<Date> notAfter;
+ public final String awsRegionName;
+ public final Set<String> affectedInstances;
- public String awsRegionName;
- public Set<String> affectedInstances;
-
- public CloudEvent(String instanceEventId, String code, String description, Date notAfter, Date notBefore, Date notBeforeDeadline,
- String awsRegionName, Set<String> affectedInstances) {
+ public CloudEvent(String instanceEventId, String code, String description, Date notAfter, Date notBefore,
+ Date notBeforeDeadline, String awsRegionName, Set<String> affectedInstances) {
this.instanceEventId = instanceEventId;
this.code = code;
this.description = description;
this.notBefore = Optional.ofNullable(notBefore);
this.notBeforeDeadline = Optional.ofNullable(notBeforeDeadline);
this.notAfter = Optional.ofNullable(notAfter);
-
this.awsRegionName = awsRegionName;
- this.affectedInstances = affectedInstances;
+ this.affectedInstances = Set.copyOf(affectedInstances);
}
+
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/MockAwsEventFetcher.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/MockAwsEventFetcher.java
index baf248fc31c..056d5bec223 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/MockAwsEventFetcher.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/MockAwsEventFetcher.java
@@ -10,9 +10,12 @@ import java.util.HashMap;
import java.util.ArrayList;
import java.util.Optional;
+/**
+ * @author freva
+ */
public class MockAwsEventFetcher implements AwsEventFetcher {
- private Map<String, List<CloudEvent>> mockedEvents = new HashMap<>();
+ private final Map<String, List<CloudEvent>> mockedEvents = new HashMap<>();
@Override
public List<CloudEvent> getEvents(String awsRegionName) {
@@ -27,4 +30,5 @@ public class MockAwsEventFetcher implements AwsEventFetcher {
public void addEvent(String awsRegionName, CloudEvent cloudEvent) {
mockedEvents.computeIfAbsent(awsRegionName, i -> new ArrayList<>()).add(cloudEvent);
}
+
}