Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateCountPatternRequest ¶
func ValidateCountPatternRequest(sl validator.StructLevel)
func ValidateEditRequest ¶
func ValidateEditRequest(sl validator.StructLevel)
Types ¶
type API ¶
func NewApi ¶
func NewApi( store Store, actionLogger logger.ActionLogger, conf config.UserInterfaceConfigProvider, ) API
type AggregationResult ¶
type AggregationResult struct { Data []idlerule.Rule `bson:"data" json:"data"` TotalCount int64 `bson:"total_count" json:"total_count"` }
func (AggregationResult) GetData ¶
func (r AggregationResult) GetData() interface{}
GetData implementation PaginatedData interface
func (AggregationResult) GetTotal ¶
func (r AggregationResult) GetTotal() int64
GetTotal implementation PaginatedData interface
type CountByPatternRequest ¶
type CountByPatternRequest struct { EntityPatterns pattern.EntityPatternList `json:"entity_patterns"` AlarmPatterns pattern.AlarmPatternList `json:"alarm_patterns"` }
type CountByPatternResult ¶
type EditRequest ¶
type EditRequest struct { ID string `json:"-"` Name string `json:"name" binding:"required,max=255"` Description string `json:"description" binding:"max=255"` Author string `json:"author" binding:"required,max=255"` Enabled *bool `json:"enabled" binding:"required"` Type string `json:"type" binding:"required"` Priority *int64 `json:"priority" binding:"required"` Duration types.DurationWithUnit `json:"duration" binding:"required"` DisableDuringPeriods []string `json:"disable_during_periods"` EntityPatterns pattern.EntityPatternList `json:"entity_patterns"` AlarmPatterns pattern.AlarmPatternList `json:"alarm_patterns"` AlarmCondition string `json:"alarm_condition"` Operation *OperationRequest `json:"operation,omitempty"` }
type FilteredQuery ¶
type FilteredQuery struct { pagination.FilteredQuery SortBy string `json:"sort_by" form:"sort_by" binding:"oneoforempty=_id name author duration created updated type priority"` }
type OperationRequest ¶
type OperationRequest struct { Type string `json:"type" binding:"required"` Parameters interface{} `json:"parameters,omitempty"` }
func (*OperationRequest) UnmarshalJSON ¶
func (r *OperationRequest) UnmarshalJSON(b []byte) error
type Store ¶
type Store interface { Insert(context.Context, EditRequest) (*idlerule.Rule, error) Find(context.Context, FilteredQuery) (*AggregationResult, error) GetOneBy(ctx context.Context, id string) (*idlerule.Rule, error) Update(context.Context, EditRequest) (*idlerule.Rule, error) Delete(ctx context.Context, id string) (bool, error) CountByPatterns(ctx context.Context, filter CountByPatternRequest, timeout int, overLimit int) (*CountByPatternResult, error) }
Click to show internal directories.
Click to hide internal directories.