Skip to content

Commit

Permalink
Added GetType() function in Trigger Config.
Browse files Browse the repository at this point in the history
  • Loading branch information
vhadianto committed Jul 25, 2024
1 parent 8e6a4dc commit e855ce4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modconfig/flowpipe_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e855ce4

Please sign in to comment.