diff options
author | Valerij Fredriksen <freva@users.noreply.github.com> | 2019-08-08 12:37:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-08 12:37:37 +0200 |
commit | a57f471086808aa58ddace94c59f30f7ca99173b (patch) | |
tree | dcefe511194ca791b2771161bd790ad257cf7a1e /controller-api | |
parent | 4ba21966182d5086b9039395ed4ba15a5632eea9 (diff) |
Revert "Revert "Revert "Revert "Automatically file a JIRA ticket for AWS events." """
Diffstat (limited to 'controller-api')
6 files changed, 78 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/AwsEventFetcher.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/AwsEventFetcher.java new file mode 100644 index 00000000000..d17f046c5ca --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/AwsEventFetcher.java @@ -0,0 +1,11 @@ +package com.yahoo.vespa.hosted.controller.api.integration.aws; + +import com.yahoo.config.provision.zone.ZoneId; +import com.yahoo.vespa.hosted.controller.api.integration.organization.Issue; + +import java.util.List; + +public interface AwsEventFetcher { + List<CloudEvent> getEvents(ZoneId zoneId); + Issue createIssue(CloudEvent event); +} 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 new file mode 100644 index 00000000000..59fd84aec74 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/CloudEvent.java @@ -0,0 +1,30 @@ +package com.yahoo.vespa.hosted.controller.api.integration.aws; + +import java.util.Date; +import java.util.Optional; +import java.util.Set; + +public final 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 String awsRegionName; + public Set<String> affectedHostnames; + + public CloudEvent(String instanceEventId, String code, String description, Date notAfter, Date notBefore, Date notBeforeDeadline, + String awsRegionName, Set<String> affectedHostnames) { + 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.affectedHostnames = affectedHostnames; + } +} 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 new file mode 100644 index 00000000000..73b1942de44 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/MockAwsEventFetcher.java @@ -0,0 +1,19 @@ +package com.yahoo.vespa.hosted.controller.api.integration.aws; + +import com.yahoo.config.provision.zone.ZoneId; +import com.yahoo.vespa.hosted.controller.api.integration.organization.Issue; + +import java.util.List; +import java.util.Optional; + +public class MockAwsEventFetcher implements AwsEventFetcher { + @Override + public List<CloudEvent> getEvents(ZoneId zoneId) { + return List.of(); + } + + @Override + public Issue createIssue(CloudEvent event) { + return new Issue("summary", "description", "VESPA", Optional.empty()); + } +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/package-info.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/package-info.java new file mode 100644 index 00000000000..31aa5291547 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/aws/package-info.java @@ -0,0 +1,5 @@ +// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +@ExportPackage +package com.yahoo.vespa.hosted.controller.api.integration.aws; + +import com.yahoo.osgi.annotation.ExportPackage; diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueHandler.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueHandler.java index db4f0eb5c59..80e23249daa 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueHandler.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueHandler.java @@ -83,4 +83,12 @@ public interface IssueHandler { */ Optional<User> escalate(IssueId issueId, Contact contact); + /** + * Returns whether there exists an issue with an exactly matching summary. + * + * @param issue The summary of the issue. + * @return Whether the issue exists. + */ + boolean issueExists(Issue issue); + } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockIssueHandler.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockIssueHandler.java index 674523ba26b..2e92c993686 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockIssueHandler.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockIssueHandler.java @@ -101,6 +101,11 @@ public class MockIssueHandler implements IssueHandler { return Optional.empty(); } + @Override + public boolean issueExists(Issue issue) { + return issues.values().stream().anyMatch(i -> i.issue.summary().equals(issue.summary())); + } + public MockIssueHandler close(IssueId issueId) { issues.get(issueId).open = false; touch(issueId); |