entity

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

View Source
const DefaultCategory = "default"

Variables

This section is empty.

Functions

func ValidateListRequest

func ValidateListRequest(sl validator.StructLevel)

Types

type API

type API interface {
	List(c *gin.Context)
	StartExport(c *gin.Context)
	GetExport(c *gin.Context)
	DownloadExport(c *gin.Context)
}

func NewApi

func NewApi(
	store Store,
	exportExecutor export.TaskExecutor,
) API

type AggregationResult

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

type Entity struct {
	ID             string                   `bson:"_id" json:"_id"`
	Name           string                   `bson:"name" json:"name"`
	Impacts        []string                 `bson:"impact" json:"impact"`
	Depends        []string                 `bson:"depends" json:"depends"`
	EnableHistory  []types.CpsTime          `bson:"enable_history" json:"enable_history" swaggertype:"array,integer"`
	Measurements   interface{}              `bson:"measurements" json:"measurements"`
	Enabled        bool                     `bson:"enabled" json:"enabled"`
	Infos          Infos                    `bson:"infos" json:"infos"`
	ComponentInfos Infos                    `bson:"component_infos,omitempty" json:"component_infos,omitempty"`
	Type           string                   `bson:"type" json:"type"`
	Component      string                   `bson:"component,omitempty" json:"component,omitempty"`
	ImpactLevel    int64                    `bson:"impact_level" json:"impact_level"`
	Category       *entitycategory.Category `bson:"category" json:"category"`
	Deletable      *bool                    `bson:"deletable,omitempty" json:"deletable,omitempty"`
	IdleSince      *types.CpsTime           `bson:"idle_since,omitempty" json:"idle_since,omitempty" swaggertype:"integer"`
}

type ExportRequest

type ExportRequest struct {
	ListRequest
	Separator string `form:"separator" json:"separator" binding:"oneoforempty=comma semicolon tab space"`
}

type ExportResponse

type ExportResponse struct {
	ID     string `json:"_id"`
	Status int    `json:"status"`
}

type Info

type Info struct {
	Name        string      `bson:"name" json:"name"`
	Description string      `bson:"description" json:"description"`
	Value       interface{} `bson:"value" json:"value"`
}

type Infos

type Infos map[string]Info

func (*Infos) UnmarshalBSONValue

func (i *Infos) UnmarshalBSONValue(_ bsontype.Type, b []byte) error

type ListRequest

type ListRequest struct {
	Search   string   `form:"search" json:"search"`
	Filter   string   `form:"filter" json:"filter"`
	Sort     string   `form:"sort" json:"sort" binding:"oneoforempty=asc desc"`
	SortBy   string   `form:"sort_by" json:"sort_by" binding:"oneoforempty=name type category impact_level category.name idle_since"`
	SearchBy []string `form:"active_columns[]" json:"active_columns[]"`
	Category string   `form:"category" json:"category"`
}

type ListRequestWithPagination

type ListRequestWithPagination struct {
	pagination.Query
	ListRequest
	WithFlags bool `form:"with_flags"`
	NoEvents  bool `form:"no_events"`
}

type Store

type Store interface {
	Find(ctx context.Context, r ListRequestWithPagination) (*AggregationResult, error)
}

func NewStore

func NewStore(db mongo.DbClient) Store

Jump to

Keyboard shortcuts

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