entityservice

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: 21 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 {
	Create(c *gin.Context)
	Get(c *gin.Context)
	GetDependencies(c *gin.Context)
	GetImpacts(c *gin.Context)
	Update(c *gin.Context)
	Delete(c *gin.Context)
}

func NewApi

func NewApi(
	store Store,
	serviceChangeListener chan<- entityservice.ChangeEntityMessage,
	actionLogger logger.ActionLogger,
	logger zerolog.Logger,
) API

type AlarmWithEntity

type AlarmWithEntity struct {
	Entity          entity.Entity `bson:"entity" json:"entity"`
	Alarm           *types.Alarm  `bson:"alarm" json:"alarm"`
	ImpactState     int64         `bson:"impact_state" json:"impact_state"`
	HasDependencies *bool         `bson:"has_dependencies,omitempty" json:"has_dependencies,omitempty"`
	HasImpacts      *bool         `bson:"has_impacts,omitempty" json:"has_impacts,omitempty"`
}

type ContextGraphAggregationResult

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

func (*ContextGraphAggregationResult) GetData

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

func (*ContextGraphAggregationResult) GetTotal

func (r *ContextGraphAggregationResult) GetTotal() int64

type ContextGraphRequest

type ContextGraphRequest struct {
	pagination.Query
	ID string `form:"_id"`
}

type CreateRequest

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

type EditRequest

type EditRequest struct {
	Name           string                    `json:"name" binding:"required,max=255"`
	Enabled        *bool                     `json:"enabled" binding:"required"`
	OutputTemplate string                    `json:"output_template" binding:"required,max=500"`
	Category       string                    `json:"category"`
	ImpactLevel    int64                     `json:"impact_level" binding:"required,min=1,max=10"`
	EntityPatterns pattern.EntityPatternList `json:"entity_patterns"`
	Infos          []entitybasic.InfoRequest `json:"infos" binding:"dive"`
}

type EntityService

type EntityService struct {
	entity.Entity  `bson:",inline"`
	EntityPatterns pattern.EntityPatternList `bson:"entity_patterns" json:"entity_patterns"`
	OutputTemplate string                    `bson:"output_template" json:"output_template"`
}

type ServiceChanges

type ServiceChanges struct {
	IsPatternChanged bool
	IsToggled        bool
}

type Store

type Store interface {
	GetOneBy(ctx context.Context, id string) (*EntityService, error)
	GetDependencies(ctx context.Context, id string, query pagination.Query) (*ContextGraphAggregationResult, error)
	GetImpacts(ctx context.Context, id string, query pagination.Query) (*ContextGraphAggregationResult, error)
	Create(ctx context.Context, request CreateRequest) (*EntityService, error)
	Update(ctx context.Context, request UpdateRequest) (*EntityService, ServiceChanges, error)
	Delete(ctx context.Context, id string) (bool, *types.Alarm, error)
}

func NewStore

func NewStore(db mongo.DbClient) Store

type UpdateRequest

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

type Validator

type Validator interface {
	ValidateEditRequest(ctx context.Context, sl validator.StructLevel)
}

func NewValidator

func NewValidator(client mongo.DbClient) Validator

Jump to

Keyboard shortcuts

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