Documentation ¶
Index ¶
- Constants
- Variables
- func TransformInfosRequest(infoRequests []InfoRequest) map[string]types.Info
- type API
- type AggregationResult
- type ArchiveDisabledRequest
- type ArchiveUnlinkedRequest
- type Archiver
- type BaseFilterRequest
- type BulkToggleRequestItem
- type Category
- type CheckStateSettingRequest
- type CleanTask
- type ContextGraphRequest
- type ContextGraphResponse
- type DisabledCleaner
- type Entity
- type ExportRequest
- type ExportResponse
- type Info
- type InfoRequest
- type Infos
- type ListRequest
- type ListRequestWithPagination
- type MongoQueryBuilder
- func (q *MongoQueryBuilder) CreateCountAggregationPipeline(ctx context.Context, r ListRequestWithPagination, now datetime.CpsTime) ([]bson.M, error)
- func (q *MongoQueryBuilder) CreateListAggregationPipeline(ctx context.Context, r ListRequestWithPagination, now datetime.CpsTime) ([]bson.M, error)
- func (q *MongoQueryBuilder) CreateOnlyListAggregationPipeline(ctx context.Context, r ListRequest, now datetime.CpsTime) ([]bson.M, error)
- func (q *MongoQueryBuilder) CreateTreeOfDepsAggregationPipeline(match bson.M, paginationQuery pagination.Query, sortRequest SortRequest, ...) []bson.M
- type PbehaviorInfo
- type SimplifiedEntity
- type SortRequest
- type StateSettingResponse
- type Store
Constants ¶
View Source
const ( CleanTaskTypeArchiveDisabled = iota CleanTaskTypeArchiveUnlinked CleanTaskTypeCleanArchived )
Variables ¶
Functions ¶
func TransformInfosRequest ¶
func TransformInfosRequest(infoRequests []InfoRequest) map[string]types.Info
Types ¶
type API ¶
type API interface { List(c *gin.Context) BulkEnable(c *gin.Context) BulkDisable(c *gin.Context) StartExport(c *gin.Context) GetExport(c *gin.Context) DownloadExport(c *gin.Context) ArchiveDisabled(c *gin.Context) ArchiveUnlinked(c *gin.Context) CleanArchived(c *gin.Context) GetContextGraph(c *gin.Context) CheckStateSetting(c *gin.Context) GetStateSetting(c *gin.Context) }
func NewApi ¶
func NewApi( store Store, exportExecutor export.TaskExecutor, cleanTaskChan chan<- CleanTask, entityChangeListener chan<- entityservice.ChangeEntityMessage, metricMetaUpdater metrics.MetaUpdater, encoder encoding.Encoder, logger zerolog.Logger, ) 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 ArchiveDisabledRequest ¶
type ArchiveDisabledRequest struct {
WithDependencies bool `json:"with_dependencies"`
}
type ArchiveUnlinkedRequest ¶
type ArchiveUnlinkedRequest struct {
ArchiveBefore datetime.DurationWithUnit `json:"archive_before"`
}
type Archiver ¶
type Archiver interface { ArchiveDisabledEntities(ctx context.Context, archiveDeps bool) (int64, error) ArchiveUnlinkedResources(ctx context.Context, before datetime.CpsTime) (int64, error) ArchiveUnlinkedComponents(ctx context.Context, before datetime.CpsTime) (int64, error) ArchiveUnlinkedConnectors(ctx context.Context, before datetime.CpsTime) (int64, error) DeleteArchivedEntities(ctx context.Context) (int64, error) }
type BaseFilterRequest ¶
type BaseFilterRequest struct { Search string `form:"search" json:"search"` Filters []string `form:"filters[]" json:"filters"` Category string `form:"category" json:"category"` Type []string `form:"type[]" json:"type"` NoEvents bool `form:"no_events" json:"no_events"` EntityPattern string `form:"entity_pattern" json:"entity_pattern"` }
BaseFilterRequest easyjson:json
func (BaseFilterRequest) MarshalEasyJSON ¶
func (v BaseFilterRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (*BaseFilterRequest) UnmarshalEasyJSON ¶
func (v *BaseFilterRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
type BulkToggleRequestItem ¶
type BulkToggleRequestItem struct {
ID string `json:"_id" binding:"required"`
}
type Category ¶
type CheckStateSettingRequest ¶
type CheckStateSettingRequest struct { ID string `json:"_id"` Name string `json:"name" binding:"required,max=255"` Connector string `json:"connector"` Type string `json:"type" binding:"required,oneof=component service"` Infos []InfoRequest `json:"infos" binding:"dive"` Category string `json:"category"` ImpactLevel int64 `json:"impact_level" binding:"required,min=1,max=10"` }
CheckStateSettingRequest contains some required fields because they are required in entitybasic.EditRequest they are not needed to be required for check logic, we're just keeping the validation consistency between request models.
type CleanTask ¶
type CleanTask struct { Type int ArchiveWithDependencies bool ArchiveBefore *datetime.DurationWithUnit UserID string }
type ContextGraphRequest ¶
type ContextGraphRequest struct {
ID string `form:"_id" binding:"required"`
}
type ContextGraphResponse ¶
type DisabledCleaner ¶
func NewDisabledCleaner ¶
func NewDisabledCleaner( redisClient redis.Cmdable, adapter datastorage.Adapter, dataStorageConfigProvider config.DataStorageConfigProvider, metricMetaUpdater metrics.MetaUpdater, logger zerolog.Logger, ) DisabledCleaner
type Entity ¶
type Entity struct { ID string `bson:"_id" json:"_id"` Name string `bson:"name" json:"name"` 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"` ImpactLevel int64 `bson:"impact_level" json:"impact_level"` Category *Category `bson:"category" json:"category"` IdleSince *datetime.CpsTime `bson:"idle_since,omitempty" json:"idle_since,omitempty" swaggertype:"integer"` LastEventDate *datetime.CpsTime `bson:"last_event_date,omitempty" json:"last_event_date,omitempty" swaggertype:"integer"` PbehaviorInfo *PbehaviorInfo `bson:"pbehavior_info,omitempty" json:"pbehavior_info,omitempty"` LastPbehaviorDate *datetime.CpsTime `bson:"last_pbehavior_date,omitempty" json:"last_pbehavior_date,omitempty" swaggertype:"integer"` Connector string `bson:"connector,omitempty" json:"connector,omitempty"` Component string `bson:"component,omitempty" json:"component,omitempty"` // ConnectorType contains a part before "/" of connector id. ConnectorType string `bson:"-" json:"connector_type,omitempty"` // Flags Deletable *bool `bson:"deletable,omitempty" json:"deletable,omitempty"` // Stats OKEvents *int `bson:"ok_events" json:"ok_events,omitempty"` KOEvents *int `bson:"ko_events" json:"ko_events,omitempty"` // Alarm fields State *int `bson:"state" json:"state,omitempty"` ImpactState *int `bson:"impact_state" json:"impact_state,omitempty"` Status *int `bson:"status" json:"status,omitempty"` Ack *common.AlarmStep `bson:"ack" json:"ack,omitempty"` Snooze *common.AlarmStep `bson:"snooze" json:"snooze,omitempty"` AlarmLastUpdateDate *datetime.CpsTime `bson:"alarm_last_update_date" json:"alarm_last_update_date,omitempty" swaggertype:"integer"` // Links Links link.LinksByCategory `bson:"-" json:"links,omitempty"` // DependsCount contains only service's dependencies DependsCount *int `bson:"depends_count" json:"depends_count,omitempty"` // ImpactsCount contains only services ImpactsCount *int `bson:"impacts_count" json:"impacts_count,omitempty"` Coordinates *types.Coordinates `bson:"coordinates,omitempty" json:"coordinates,omitempty"` savedpattern.EntityPatternFields `bson:",inline"` Resources []string `bson:"resources,omitempty" json:"-"` ImportSource string `bson:"import_source,omitempty" json:"import_source,omitempty"` Imported *datetime.CpsTime `bson:"imported,omitempty" json:"imported,omitempty" swaggertype:"integer"` PerfData []string `bson:"perf_data" json:"-"` FilteredPerfData []string `bson:"filtered_perf_data" json:"filtered_perf_data,omitempty"` }
type ExportRequest ¶
type ExportRequest struct { BaseFilterRequest Fields export.Fields `json:"fields"` Separator string `json:"separator" binding:"oneoforempty=comma semicolon tab space"` }
type ExportResponse ¶
type Info ¶
type InfoRequest ¶
type InfoRequest struct { Name string `json:"name" binding:"required,max=255"` Description string `json:"description" binding:"max=255"` Value interface{} `json:"value"` }
func (*InfoRequest) UnmarshalJSON ¶
func (r *InfoRequest) UnmarshalJSON(b []byte) error
type Infos ¶
type ListRequest ¶
type ListRequest struct { BaseFilterRequest SortRequest SearchBy []string `form:"active_columns[]" json:"active_columns[]"` }
type ListRequestWithPagination ¶
type ListRequestWithPagination struct { pagination.Query ListRequest WithFlags bool `form:"with_flags" json:"with_flags"` PerfData []string `form:"perf_data[]" json:"perf_data"` }
type MongoQueryBuilder ¶
type MongoQueryBuilder struct {
// contains filtered or unexported fields
}
func NewMongoQueryBuilder ¶
func NewMongoQueryBuilder(client mongo.DbClient, authorProvider author.Provider) *MongoQueryBuilder
func (*MongoQueryBuilder) CreateCountAggregationPipeline ¶
func (q *MongoQueryBuilder) CreateCountAggregationPipeline(ctx context.Context, r ListRequestWithPagination, now datetime.CpsTime) ([]bson.M, error)
func (*MongoQueryBuilder) CreateListAggregationPipeline ¶
func (q *MongoQueryBuilder) CreateListAggregationPipeline(ctx context.Context, r ListRequestWithPagination, now datetime.CpsTime) ([]bson.M, error)
func (*MongoQueryBuilder) CreateOnlyListAggregationPipeline ¶
func (q *MongoQueryBuilder) CreateOnlyListAggregationPipeline(ctx context.Context, r ListRequest, now datetime.CpsTime) ([]bson.M, error)
func (*MongoQueryBuilder) CreateTreeOfDepsAggregationPipeline ¶
func (q *MongoQueryBuilder) CreateTreeOfDepsAggregationPipeline( match bson.M, paginationQuery pagination.Query, sortRequest SortRequest, category, search string, withFlags bool, withStateDependsCount bool, now datetime.CpsTime, ) []bson.M
type PbehaviorInfo ¶
type PbehaviorInfo struct { types.PbehaviorInfo `bson:",inline"` LastComment *struct { ID string `bson:"_id" json:"_id"` Author string `bson:"author" json:"author"` Timestamp datetime.CpsTime `bson:"ts" json:"ts" swaggertype:"integer"` Message string `bson:"message" json:"message"` } `bson:"last_comment" json:"last_comment"` }
type SimplifiedEntity ¶
type SortRequest ¶
type StateSettingResponse ¶
type StateSettingResponse struct { ID string `bson:"_id" json:"_id"` Title string `json:"title"` Method string `json:"method"` Type string `json:"type,omitempty"` InheritedEntityPattern *pattern.Entity `bson:"inherited_entity_pattern,omitempty" json:"inherited_entity_pattern,omitempty"` StateThresholds *statesettings.StateThresholds `bson:"state_thresholds,omitempty" json:"state_thresholds,omitempty"` DependsCount int `bson:"-" json:"depends_count,omitempty"` ThresholdState string `bson:"-" json:"threshold_state,omitempty"` ThresholdStateDependsCount int `bson:"-" json:"threshold_state_depends_count,omitempty"` }
type Store ¶
type Store interface { Find(ctx context.Context, r ListRequestWithPagination) (*AggregationResult, error) Toggle(ctx context.Context, id, userID string, enabled bool) (bool, SimplifiedEntity, error) GetContextGraph(ctx context.Context, id string) (*ContextGraphResponse, error) Export(ctx context.Context, t export.Task) (export.DataCursor, error) CheckStateSetting(ctx context.Context, r CheckStateSettingRequest) (StateSettingResponse, error) GetStateSetting(ctx context.Context, id string) (StateSettingResponse, error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.