From 87adc38f5bcbbac2bb55534740b6c0516f8e25e6 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Tue, 22 Jun 2021 10:03:15 +0200 Subject: [PATCH] feat: Added convenience functions for determining event types Signed-off-by: Florian Bacher --- pkg/lib/v0_2_0/events.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/lib/v0_2_0/events.go b/pkg/lib/v0_2_0/events.go index 784e3ed2..6c629f09 100644 --- a/pkg/lib/v0_2_0/events.go +++ b/pkg/lib/v0_2_0/events.go @@ -249,6 +249,18 @@ func GetEventTypeForTriggeredEvent(baseTriggeredEventType, newEventTypeSuffix st return trimmed + newEventTypeSuffix, nil } +func IsFinishedEventType(eventType string) bool { + return strings.HasSuffix(eventType, keptnFinishedEventSuffix) +} + +func IsStartedEventType(eventType string) bool { + return strings.HasSuffix(eventType, keptnStartedEventSuffix) +} + +func IsTriggeredEventType(eventType string) bool { + return strings.HasSuffix(eventType, keptnTriggeredEventSuffix) +} + // EventData contains mandatory fields of all Keptn CloudEvents type EventData struct { Project string `json:"project,omitempty"`