trigger

package
v0.0.1-dev-810fd14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Triggers         = "triggers"
	DB               = "triggers"
	Collection       = "triggers"
	ReqCollection    = "requests"
	ReqTTL           = 3600
	ResponsePolicyV2 = "/etc/policies/alert_resp/alert_resp2_0.yml"
	ISO8601Z         = "2006-01-02T15:04:05+00:00"
)

Variables

This section is empty.

Functions

func GetDetailsMap

func GetDetailsMap() map[string]ApiOptions

func SyncList

func SyncList(triggers []ApiOptions)

func TimeISO8601Z

func TimeISO8601Z(t time.Time) string

Types

type ApiOptions

type ApiOptions struct {
	Name        string      `json:"name" yaml:"name" bson:"name"`
	Description string      `json:"description" yaml:"description"`
	Match       string      `json:"-" yaml:"match"`
	Attributes  []Attribute `json:"attributes" bson:"-" yaml:"-"`
	Response    `json:"response" yaml:"response"`
	Enabled     bool            `json:"enabled" yaml:"enabled"`
	Status      *status.Trigger `json:"status" yaml:"-" bson:"status"`
}

func Get

func Get(name string) (*ApiOptions, bool)

func GetList

func GetList() []ApiOptions

func (*ApiOptions) AppendEmail

func (a *ApiOptions) AppendEmail(email email.Recipient)

func (*ApiOptions) AppendSlack

func (a *ApiOptions) AppendSlack(slack slack.ApiChannel)

func (*ApiOptions) ConvertToCosOptions

func (a *ApiOptions) ConvertToCosOptions() CosOptions

func (*ApiOptions) GenEmailList

func (a *ApiOptions) GenEmailList() []string

func (*ApiOptions) GenMatchRule

func (a *ApiOptions) GenMatchRule() string

func (*ApiOptions) GenSlackList

func (a *ApiOptions) GenSlackList() []string

func (*ApiOptions) GenTaskUpdate

func (a *ApiOptions) GenTaskUpdate() ApiOptions

func (*ApiOptions) HasEmail

func (a *ApiOptions) HasEmail(email string) bool

func (*ApiOptions) HasEmailRecipients

func (a *ApiOptions) HasEmailRecipients() bool

func (*ApiOptions) HasSlack

func (a *ApiOptions) HasSlack(channel string) bool

func (*ApiOptions) HasSlackChannels

func (a *ApiOptions) HasSlackChannels() bool

func (*ApiOptions) InitOkStatus

func (a *ApiOptions) InitOkStatus()

func (*ApiOptions) InitUpdateStatus

func (a *ApiOptions) InitUpdateStatus()

func (*ApiOptions) IsSame

func (a *ApiOptions) IsSame(trigger ApiOptions) bool

func (*ApiOptions) SetCompleted

func (a *ApiOptions) SetCompleted()

func (*ApiOptions) SetEmailDetails

func (a *ApiOptions) SetEmailDetails(email email.Recipient)

func (*ApiOptions) SetError

func (a *ApiOptions) SetError()

func (*ApiOptions) SetSlackDetails

func (a *ApiOptions) SetSlackDetails(slack slack.ApiChannel)

type Attribute

type Attribute struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Value   any    `json:"value"`
	Enabled bool   `json:"enabled"`
}

type CosOptions

type CosOptions struct {
	Name        string   `json:"name"`
	Enabled     bool     `json:"enabled"`
	Topic       string   `json:"topic"`
	Match       string   `json:"match"`
	Description string   `json:"description"`
	Emails      []string `json:"emails"`
	Slacks      []string `json:"slacks"`
	Execs       `json:"execs"`
}

func (*CosOptions) Bytes

func (c *CosOptions) Bytes() ([]byte, error)

func (*CosOptions) ConvertToApiEmails

func (c *CosOptions) ConvertToApiEmails() []email.Recipient

func (*CosOptions) ConvertToApiOptions

func (c *CosOptions) ConvertToApiOptions() ApiOptions

func (*CosOptions) ConvertToApiSlacks

func (c *CosOptions) ConvertToApiSlacks() []slack.ApiChannel

type Execs

type Execs struct {
	Shells []string `json:"shells"`
	Bins   []string `json:"bins"`
}

type Response

type Response struct {
	Types  []string           `json:"types" yaml:"-"`
	Slacks []slack.ApiChannel `json:"slacks" yaml:"slacks"`
	Emails []email.Recipient  `json:"emails" yaml:"emails"`
}

type Toggle

type Toggle struct {
	Enable bool `json:"enable" yaml:"enable"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL