eventfilter

package
v0.0.0-...-9b5cd94 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	common.BulkCrudAPI
	ListFailures(c *gin.Context)
	ReadFailures(c *gin.Context)
}

func NewApi

func NewApi(
	store Store,
	actionLogger logger.ActionLogger,
	logger zerolog.Logger,
	transformer common.PatternFieldsTransformer,
) API

type AggregationFailureResult

type AggregationFailureResult struct {
	Data       []FailureResponse `bson:"data" json:"data"`
	TotalCount int64             `bson:"total_count" json:"total_count"`
}

func (*AggregationFailureResult) GetData

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

func (*AggregationFailureResult) GetTotal

func (r *AggregationFailureResult) GetTotal() int64

type AggregationResult

type AggregationResult struct {
	Data       []Response `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 BulkDeleteRequestItem

type BulkDeleteRequestItem struct {
	ID string `bson:"_id" json:"_id" binding:"required"`
}

type BulkUpdateRequestItem

type BulkUpdateRequestItem struct {
	EditRequest `bson:",inline"`
	ID          string `bson:"_id" json:"_id" binding:"required"`
}

type CreateRequest

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

type EditRequest

type EditRequest struct {
	Author       string                                        `json:"author" swaggerignore:"true"`
	Description  string                                        `json:"description" binding:"required,max=255"`
	Type         string                                        `json:"type" binding:"required,oneof=break drop enrichment change_entity"`
	Priority     int64                                         `json:"priority" binding:"min=0"`
	Enabled      bool                                          `json:"enabled"`
	Config       eventfilter.RuleConfig                        `json:"config"`
	ExternalData map[string]eventfilter.ExternalDataParameters `json:"external_data,omitempty" binding:"dive"`

	common.EntityPatternFieldsRequest
	EventPattern pattern.Event `json:"event_pattern" binding:"event_pattern"`

	RRule      string            `json:"rrule,omitempty"`
	Start      *datetime.CpsTime `json:"start,omitempty" swaggertype:"integer"`
	Stop       *datetime.CpsTime `json:"stop,omitempty" swaggertype:"integer"`
	Exdates    []exdate.Request  `json:"exdates" binding:"dive"`
	Exceptions []string          `json:"exceptions"`
}

type Exception

type Exception struct {
	ID          string           `bson:"_id" json:"_id"`
	Name        string           `bson:"name" json:"name"`
	Description string           `bson:"description" json:"description"`
	Exdates     []types.Exdate   `bson:"exdates" json:"exdates"`
	Created     datetime.CpsTime `bson:"created" json:"created" swaggertype:"integer"`
}

type FailureRequest

type FailureRequest struct {
	pagination.Query
	Type *int `json:"type" form:"type"`
}

type FailureResponse

type FailureResponse struct {
	ID        string           `bson:"_id" json:"_id"`
	Type      int64            `bson:"type" json:"type"`
	Timestamp datetime.CpsTime `bson:"t" json:"t" swaggertype:"integer"`
	Message   string           `bson:"message" json:"message"`
	Event     map[string]any   `bson:"event" json:"event" swaggertype:"object"`
	Unread    bool             `bson:"unread" json:"unread"`
}

type FilteredQuery

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

type Response

type Response struct {
	ID           string                                        `bson:"_id" json:"_id"`
	Author       *author.Author                                `bson:"author" json:"author" swaggerignore:"true"`
	Description  string                                        `bson:"description" json:"description"`
	Type         string                                        `bson:"type" json:"type"`
	Priority     int64                                         `bson:"priority" json:"priority"`
	Enabled      bool                                          `bson:"enabled" json:"enabled"`
	Config       eventfilter.RuleConfig                        `bson:"config" json:"config"`
	ExternalData map[string]eventfilter.ExternalDataParameters `bson:"external_data" json:"external_data,omitempty"`
	Created      *datetime.CpsTime                             `bson:"created,omitempty" json:"created,omitempty" swaggertype:"integer"`
	Updated      *datetime.CpsTime                             `bson:"updated,omitempty" json:"updated,omitempty" swaggertype:"integer"`
	RRule        string                                        `bson:"rrule" json:"rrule"`
	Start        *datetime.CpsTime                             `bson:"start,omitempty" json:"start,omitempty" swaggertype:"integer"`
	Stop         *datetime.CpsTime                             `bson:"stop,omitempty" json:"stop,omitempty" swaggertype:"integer"`
	Exdates      []types.Exdate                                `bson:"exdates" json:"exdates"`
	Exceptions   []Exception                                   `bson:"exceptions" json:"exceptions"`

	EventsCount         int64  `bson:"events_count" json:"events_count"`
	FailuresCount       *int64 `bson:"failures_count" json:"failures_count,omitempty"`
	UnreadFailuresCount *int64 `bson:"unread_failures_count" json:"unread_failures_count,omitempty"`

	EventPattern                     pattern.Event `bson:"event_pattern" json:"event_pattern"`
	savedpattern.EntityPatternFields `bson:",inline"`
}

type Store

type Store interface {
	Insert(ctx context.Context, request CreateRequest) (*Response, error)
	GetById(ctx context.Context, id string) (*Response, error)
	Find(ctx context.Context, query FilteredQuery) (*AggregationResult, error)
	Update(ctx context.Context, request UpdateRequest) (*Response, error)
	Delete(ctx context.Context, id string) (bool, error)
	FindFailures(ctx context.Context, id string, r FailureRequest) (*AggregationFailureResult, error)
	ReadFailures(ctx context.Context, id string) (bool, error)
}

func NewStore

func NewStore(
	dbClient mongo.DbClient,
	authorProvider author.Provider,
) Store

type UpdateRequest

type UpdateRequest struct {
	EditRequest `bson:",inline"`
	ID          string `bson:"-" json:"-"`
}

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator(client mongo.DbClient) *Validator

func (*Validator) ValidateBulkUpdateRequestItem

func (v *Validator) ValidateBulkUpdateRequestItem(ctx context.Context, sl validator.StructLevel)

func (*Validator) ValidateCreateRequest

func (v *Validator) ValidateCreateRequest(ctx context.Context, sl validator.StructLevel)

func (*Validator) ValidateUpdateRequest

func (v *Validator) ValidateUpdateRequest(ctx context.Context, sl validator.StructLevel)

Jump to

Keyboard shortcuts

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