eventfilter

package
v0.0.0-...-d841f61 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApi

func NewApi(
	store Store,
	actionLogger logger.ActionLogger,
) common.CrudAPI

func NewValidator

func NewValidator(dbClient mongo.DbClient) *eventfilterValidator

Types

type AggregationResult

type AggregationResult struct {
	Data       []*EventFilter `bson:"data" json:"data"`
	TotalCount int64          `bson:"total_count" json:"total_count"`
}

func (*AggregationResult) GetData

func (r *AggregationResult) GetData() interface{}

func (*AggregationResult) GetTotal

func (r *AggregationResult) GetTotal() int64

type EventFilter

type EventFilter struct {
	ID                 string `bson:"_id" json:"_id" binding:"id"`
	EventFilterPayload `bson:",inline"`
}

type EventFilterPayload

type EventFilterPayload struct {
	Author      string `bson:"author" json:"author" swaggerignore:"true"`
	Description string `bson:"description" json:"description" binding:"required,max=255"`
	Type        string `bson:"type" json:"type" binding:"required,oneof=break drop enrichment"`

	Patterns *pattern.EventPatternList `bson:"patterns" json:"patterns"`

	Priority int   `bson:"priority" json:"priority"`
	Enabled  *bool `bson:"enabled" json:"enabled" binding:"required"`

	Actions      []eventfilter.Action   `bson:"actions,omitempty" json:"actions,omitempty" binding:"required_if=Type enrichment"`
	ExternalData map[string]interface{} `bson:"external_data,omitempty" json:"external_data,omitempty"`
	OnSuccess    string                 `bson:"on_success,omitempty" json:"on_success,omitempty" binding:"required_if=Type enrichment"`
	OnFailure    string                 `bson:"on_failure,omitempty" json:"on_failure,omitempty" binding:"required_if=Type enrichment"`

	Created *types.CpsTime `bson:"created,omitempty" json:"created,omitempty" swaggertype:"integer"`
	Updated *types.CpsTime `bson:"updated,omitempty" json:"updated,omitempty" swaggertype:"integer"`
}

type FilteredQuery

type FilteredQuery struct {
	pagination.FilteredQuery
	SortBy string `json:"sort_by" form:"sort_by" binding:"oneoforempty=_id author priority created updated on_success on_failure"`
}

type Store

type Store interface {
	Insert(model *EventFilter) error
	GetById(id string) (*EventFilter, error)
	Find(query FilteredQuery) (*AggregationResult, error)
	Update(model *EventFilter) (bool, error)
	Delete(id string) (bool, error)
}

func NewStore

func NewStore(
	dbClient mongo.DbClient,
) Store

Jump to

Keyboard shortcuts

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