From e855ce484fb0a7d88eedc3deb3bef84f5a21f597 Mon Sep 17 00:00:00 2001
From: Victor Hadianto <victor@turbot.com>
Date: Fri, 26 Jul 2024 09:46:38 +1000
Subject: [PATCH] Added GetType() function in Trigger Config.

---
 modconfig/flowpipe_trigger.go | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/modconfig/flowpipe_trigger.go b/modconfig/flowpipe_trigger.go
index 9dc8a334..dab02a9f 100644
--- a/modconfig/flowpipe_trigger.go
+++ b/modconfig/flowpipe_trigger.go
@@ -262,12 +262,17 @@ type TriggerConfig interface {
 	SetAttributes(*Mod, *Trigger, hcl.Attributes, *hcl.EvalContext) hcl.Diagnostics
 	SetBlocks(*Mod, *Trigger, hcl.Blocks, *hcl.EvalContext) hcl.Diagnostics
 	Equals(other TriggerConfig) bool
+	GetType() string
 }
 
 type TriggerSchedule struct {
 	Schedule string `json:"schedule"`
 }
 
+func (t *TriggerSchedule) GetType() string {
+	return schema.TriggerTypeSchedule
+}
+
 func (t *TriggerSchedule) Equals(other TriggerConfig) bool {
 	otherTrigger, ok := other.(*TriggerSchedule)
 	if !ok {
@@ -354,6 +359,10 @@ type TriggerQuery struct {
 	Captures   map[string]*TriggerQueryCapture `json:"captures"`
 }
 
+func (t *TriggerQuery) GetType() string {
+	return schema.TriggerTypeQuery
+}
+
 func (t *TriggerQuery) Equals(other TriggerConfig) bool {
 	otherTrigger, ok := other.(*TriggerQuery)
 	if !ok {
@@ -620,6 +629,10 @@ type TriggerHttp struct {
 	Methods       map[string]*TriggerHTTPMethod `json:"methods"`
 }
 
+func (t *TriggerHttp) GetType() string {
+	return schema.TriggerTypeHttp
+}
+
 func (t *TriggerHttp) Equals(other TriggerConfig) bool {
 	otherTrigger, ok := other.(*TriggerHttp)
 	if !ok {