Documentation ¶
Index ¶
- Constants
- Variables
- func ValidateDetailsRequest(sl validator.StructLevel)
- func ValidateListRequest(sl validator.StructLevel)
- type API
- type AggregationResult
- type Alarm
- type AlarmValue
- type AssignedDeclareTicketRule
- type AssignedInstruction
- type BaseFilterRequest
- type ChildDetailsRequest
- type ChildrenDetails
- type Count
- type DeclareTicketRule
- type Details
- type DetailsRequest
- type DetailsResponse
- type DisplayNameData
- type Execution
- type ExecutionStatus
- type ExportFetchParameters
- type ExportRequest
- type ExportResponse
- type FilterRequest
- type GetDisplayNamesRequest
- type GetDisplayNamesResponse
- type GetOpenRequest
- type Instruction
- type InstructionFilterRequest
- type InstructionWithExecutions
- type LinksRequest
- type ListByComponentRequest
- type ListByServiceRequest
- type ListRequest
- type ListRequestWithPagination
- type MetaAlarmRule
- type MongoQueryBuilder
- func (q *MongoQueryBuilder) CreateAggregationPipelineByMatch(ctx context.Context, alarmMatch bson.M, entityMatch bson.M, ...) ([]bson.M, error)
- func (q *MongoQueryBuilder) CreateChildrenAggregationPipeline(r ChildDetailsRequest, opened int, parentId string, search string, ...) ([]bson.M, error)
- func (q *MongoQueryBuilder) CreateCountAggregationPipeline(ctx context.Context, r FilterRequest, userID string, now datetime.CpsTime) ([]bson.M, error)
- func (q *MongoQueryBuilder) CreateGetAggregationPipeline(match bson.M, now datetime.CpsTime, userID string, opened int) ([]bson.M, error)
- func (q *MongoQueryBuilder) CreateGetDisplayNamesPipeline(r GetDisplayNamesRequest, 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, userID string) ([]bson.M, error)
- type Pbehavior
- type ResolvedListRequest
- type SortRequest
- type Step
- type StepDetails
- type StepsRequest
- type Store
- type Watcher
Constants ¶
View Source
const ( OnlyOpened = iota OpenedAndRecentResolved OnlyResolved )
View Source
const ( NoIcon = iota IconManualInProgress IconAutoInProgress IconAutoFailed IconManualFailed IconManualFailedOtherInProgress IconAutoFailedOtherInProgress IconManualFailedManualAvailable IconAutoFailedManualAvailable IconManualAvailable IconAutoSuccessful IconManualSuccessful IconAutoSuccessfulOtherInProgress IconManualSuccessfulOtherInProgress IconAutoSuccessfulManualAvailable IconManualSuccessfulManualAvailable )
View Source
const ( AlarmStepDeclareTicketRuleInProgress = "declareticketruleinprogress" AlarmStepDeclareTicketRuleComplete = "declareticketrulecomplete" AlarmStepDeclareTicketRuleFail = "declareticketrulefail" AlarmStepWebhookInProgress = "webhookinprogress" )
View Source
const ( InstructionExecutionStatusRunning = iota InstructionExecutionStatusPaused InstructionExecutionStatusCompleted InstructionExecutionStatusAborted InstructionExecutionStatusFailed InstructionExecutionStatusWaitResult )
View Source
const ( InstructionTypeManual = iota InstructionTypeAuto InstructionTypeSimplifiedManual )
View Source
const InstructionStatusApproved = 0
Variables ¶
Functions ¶
func ValidateDetailsRequest ¶
func ValidateDetailsRequest(sl validator.StructLevel)
func ValidateListRequest ¶
func ValidateListRequest(sl validator.StructLevel)
Types ¶
type API ¶
type API interface { List(c *gin.Context) Get(c *gin.Context) GetOpen(c *gin.Context) GetDetails(c *gin.Context) ListByService(c *gin.Context) ListByComponent(c *gin.Context) ResolvedList(c *gin.Context) Count(c *gin.Context) StartExport(c *gin.Context) GetExport(c *gin.Context) DownloadExport(c *gin.Context) GetLinks(c *gin.Context) GetDisplayNames(c *gin.Context) }
type AggregationResult ¶
type AggregationResult struct { Data []Alarm `bson:"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 Alarm ¶
type Alarm struct { ID string `bson:"_id" json:"_id"` Time datetime.CpsTime `bson:"t" json:"t" swaggertype:"integer"` Entity entity.Entity `bson:"entity" json:"entity"` Value AlarmValue `bson:"v" json:"v"` Tags []string `bson:"tags" json:"tags"` Infos map[string]map[string]interface{} `bson:"infos" json:"infos"` Pbehavior *Pbehavior `bson:"pbehavior,omitempty" json:"pbehavior,omitempty"` // Meta alarm fields MetaAlarmRule *MetaAlarmRule `bson:"meta_alarm_rule,omitempty" json:"meta_alarm_rule,omitempty"` IsMetaAlarm *bool `bson:"is_meta_alarm,omitempty" json:"is_meta_alarm,omitempty"` Children *int64 `bson:"children,omitempty" json:"children,omitempty"` OpenedChildren *int64 `bson:"opened_children,omitempty" json:"opened_children,omitempty"` ClosedChildren *int64 `bson:"closed_children,omitempty" json:"closed_children,omitempty"` ChildrenInstructions *bool `bson:"children_instructions" json:"children_instructions,omitempty"` // Meta alarm child fields Parents *int64 `bson:"parents" json:"parents,omitempty"` MetaAlarmRules []MetaAlarmRule `bson:"meta_alarm_rules" json:"meta_alarm_rules,omitempty"` AssignedInstructions *[]AssignedInstruction `bson:"assigned_instructions,omitempty" json:"assigned_instructions,omitempty"` InstructionExecutionIcon int `bson:"-" json:"instruction_execution_icon,omitempty"` RunningManualInstructions []string `bson:"-" json:"running_manual_instructions,omitempty"` RunningAutoInstructions []string `bson:"-" json:"running_auto_instructions,omitempty"` FailedManualInstructions []string `bson:"-" json:"failed_manual_instructions,omitempty"` FailedAutoInstructions []string `bson:"-" json:"failed_auto_instructions,omitempty"` SuccessfulManualInstructions []string `bson:"-" json:"successful_manual_instructions,omitempty"` SuccessfulAutoInstructions []string `bson:"-" json:"successful_auto_instructions,omitempty"` Links link.LinksByCategory `bson:"-" json:"links,omitempty"` ImpactState int64 `bson:"impact_state" json:"impact_state"` AssignedDeclareTicketRules []AssignedDeclareTicketRule `bson:"-" json:"assigned_declare_ticket_rules,omitempty"` // Only for details request Filtered *bool `bson:"filtered" json:"filtered,omitempty"` Bookmark bool `bson:"bookmark" json:"bookmark"` }
type AlarmValue ¶
type AlarmValue struct { ACK *common.AlarmStep `bson:"ack,omitempty" json:"ack,omitempty"` Canceled *common.AlarmStep `bson:"canceled,omitempty" json:"canceled,omitempty"` Snooze *common.AlarmStep `bson:"snooze,omitempty" json:"snooze,omitempty"` State *common.AlarmStep `bson:"state,omitempty" json:"state,omitempty"` Status *common.AlarmStep `bson:"status,omitempty" json:"status,omitempty"` ChangeState *common.AlarmStep `bson:"change_state,omitempty" json:"change_state,omitempty"` Tickets []common.AlarmStep `bson:"tickets,omitempty" json:"tickets,omitempty"` Ticket *common.AlarmStep `bson:"ticket,omitempty" json:"ticket,omitempty"` Comments []common.AlarmStep `bson:"comments,omitempty" json:"comments,omitempty"` LastComment *common.AlarmStep `bson:"last_comment,omitempty" json:"last_comment,omitempty"` Steps []common.AlarmStep `bson:"steps,omitempty" json:"steps,omitempty"` Component string `bson:"component" json:"component"` Connector string `bson:"connector" json:"connector"` ConnectorName string `bson:"connector_name" json:"connector_name"` CreationDate datetime.CpsTime `bson:"creation_date" json:"creation_date" swaggertype:"integer"` ActivationDate *datetime.CpsTime `bson:"activation_date,omitempty" json:"activation_date,omitempty" swaggertype:"integer"` DisplayName string `bson:"display_name" json:"display_name"` InitialOutput string `bson:"initial_output" json:"initial_output"` Output string `bson:"output" json:"output"` InitialLongOutput string `bson:"initial_long_output" json:"initial_long_output"` LongOutput string `bson:"long_output" json:"long_output"` LongOutputHistory []string `bson:"long_output_history" json:"long_output_history"` LastUpdateDate datetime.CpsTime `bson:"last_update_date" json:"last_update_date" swaggertype:"integer"` LastEventDate datetime.CpsTime `bson:"last_event_date" json:"last_event_date" swaggertype:"integer"` Resource string `bson:"resource,omitempty" json:"resource,omitempty"` Resolved *datetime.CpsTime `bson:"resolved,omitempty" json:"resolved,omitempty" swaggertype:"integer"` PbehaviorInfo *entity.PbehaviorInfo `bson:"pbehavior_info,omitempty" json:"pbehavior_info,omitempty"` Meta string `bson:"meta,omitempty" json:"meta,omitempty"` Parents []string `bson:"parents" json:"parents"` Children []string `bson:"children" json:"children"` StateChangesSinceStatusUpdate types.CpsNumber `bson:"state_changes_since_status_update,omitempty" json:"state_changes_since_status_update,omitempty"` TotalStateChanges types.CpsNumber `bson:"total_state_changes,omitempty" json:"total_state_changes,omitempty"` Duration int `bson:"duration" json:"duration"` CurrentStateDuration int `bson:"current_state_duration" json:"current_state_duration"` SnoozeDuration int64 `bson:"snooze_duration" json:"snooze_duration"` PbehaviorInactiveDuration int64 `bson:"pbh_inactive_duration" json:"pbh_inactive_duration"` ActiveDuration int64 `bson:"active_duration" json:"active_duration"` EventsCount types.CpsNumber `bson:"events_count,omitempty" json:"events_count,omitempty"` RuleVersion map[string]string `bson:"infos_rule_version" json:"infos_rule_version"` Infos map[string]map[string]interface{} `bson:"infos" json:"infos"` }
type AssignedDeclareTicketRule ¶
type AssignedInstruction ¶
type BaseFilterRequest ¶
type BaseFilterRequest struct { Filters []string `form:"filters[]" json:"filters"` Search string `form:"search" json:"search"` TimeField string `form:"time_field" json:"time_field" binding:"oneoforempty=t v.creation_date v.resolved v.last_update_date v.last_event_date"` StartFrom *datetime.CpsTime `form:"tstart" json:"tstart" swaggertype:"integer"` StartTo *datetime.CpsTime `form:"tstop" json:"tstop" swaggertype:"integer"` Opened *bool `form:"opened" json:"opened"` OnlyParents bool `form:"correlation" json:"correlation"` Category string `form:"category" json:"category"` // Tag is deprecated, please use tags[] parameter Tag string `form:"tag" json:"tag"` Tags []string `form:"tags[]" json:"tags"` AlarmPattern string `form:"alarm_pattern" json:"alarm_pattern"` EntityPattern string `form:"entity_pattern" json:"entity_pattern"` PbehaviorPattern string `form:"pbehavior_pattern" json:"pbehavior_pattern"` Instructions []InstructionFilterRequest `form:"instructions[]" json:"instructions"` OnlyBookmarks bool `form:"only_bookmarks" json:"only_bookmarks"` }
func (BaseFilterRequest) GetOpenedFilter ¶
func (r BaseFilterRequest) GetOpenedFilter() int
type ChildDetailsRequest ¶
type ChildDetailsRequest struct { pagination.Query SortRequest }
type ChildrenDetails ¶
type ChildrenDetails struct { Data []Alarm `json:"data"` Meta common.PaginatedMeta `json:"meta"` }
type Count ¶
type Count struct { Total int `bson:"total" json:"total"` TotalActive int `bson:"total_active" json:"total_active"` TotalSnooze int `bson:"total_snooze" json:"snooze"` TotalAck int `bson:"total_ack" json:"ack"` TotalUnack int `bson:"total_unack" json:"unack"` TotalTicket int `bson:"total_ticket" json:"ticket"` TotalPbehavior int `bson:"total_pbehavior" json:"pbehavior_active"` }
type DeclareTicketRule ¶
type DeclareTicketRule struct { ID string `bson:"_id" json:"_id"` Name string `bson:"name" json:"name"` savedpattern.AlarmPatternFields `bson:",inline"` savedpattern.EntityPatternFields `bson:",inline"` savedpattern.PbehaviorPatternFields `bson:",inline"` }
type Details ¶
type Details struct { // Only for websocket ID string `bson:"-" json:"_id,omitempty"` Steps *StepDetails `bson:"steps" json:"steps,omitempty"` Children *ChildrenDetails `bson:"children" json:"children,omitempty"` FilteredPerfData []string `bson:"filtered_perf_data" json:"filtered_perf_data,omitempty"` IsMetaAlarm bool `json:"-" bson:"is_meta_alarm"` StepsCount int64 `json:"-" bson:"steps_count"` Entity entity.Entity `json:"entity" bson:"entity"` }
type DetailsRequest ¶
type DetailsRequest struct { ID string `json:"_id" binding:"required"` Search string `json:"search"` SearchBy []string `json:"search_by"` Opened *bool `json:"opened"` WithInstructions bool `json:"with_instructions"` WithDeclareTickets bool `json:"with_declare_tickets"` WithDependencies bool `json:"with_dependencies"` Steps *StepsRequest `json:"steps"` Children *ChildDetailsRequest `json:"children"` PerfData []string `json:"perf_data"` }
func (*DetailsRequest) Format ¶
func (r *DetailsRequest) Format()
func (*DetailsRequest) GetOpenedFilter ¶
func (r *DetailsRequest) GetOpenedFilter() int
type DetailsResponse ¶
type DisplayNameData ¶
type Execution ¶
type ExecutionStatus ¶
type ExecutionStatus struct { ID string `bson:"_id"` Icon int `bson:"-"` RunningManualInstructions []string `bson:"running_manual_instructions"` RunningAutoInstructions []string `bson:"running_auto_instructions"` FailedManualInstructions []string `bson:"failed_manual_instructions"` FailedAutoInstructions []string `bson:"failed_auto_instructions"` SuccessfulManualInstructions []string `bson:"successful_manual_instructions"` SuccessfulAutoInstructions []string `bson:"successful_auto_instructions"` LastFailed *int `bson:"last_failed"` LastSuccessful *int `bson:"last_successful"` }
type ExportFetchParameters ¶
type ExportFetchParameters struct { BaseFilterRequest TimeFormat string `json:"time_format" binding:"time_format"` }
ExportFetchParameters easyjson:json
func (ExportFetchParameters) MarshalEasyJSON ¶
func (v ExportFetchParameters) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (*ExportFetchParameters) UnmarshalEasyJSON ¶
func (v *ExportFetchParameters) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
type ExportRequest ¶
type ExportRequest struct { ExportFetchParameters Fields export.Fields `json:"fields"` Separator string `json:"separator" binding:"oneoforempty=comma semicolon tab space"` }
type ExportResponse ¶
type FilterRequest ¶
type FilterRequest struct { BaseFilterRequest SearchBy []string `form:"active_columns[]" json:"active_columns[]"` }
type GetDisplayNamesRequest ¶
type GetDisplayNamesRequest struct { pagination.Query Sort string `form:"sort" json:"sort" binding:"oneoforempty=asc desc"` Search string `form:"search" json:"search"` AlarmPattern string `form:"alarm_pattern" json:"alarm_pattern"` EntityPattern string `form:"entity_pattern" json:"entity_pattern"` PbehaviorPattern string `form:"pbehavior_pattern" json:"pbehavior_pattern"` }
type GetDisplayNamesResponse ¶
type GetDisplayNamesResponse struct { Data []DisplayNameData `bson:"data" json:"data"` TotalCount int64 `bson:"total_count" json:"total_count"` }
func (*GetDisplayNamesResponse) GetData ¶
func (r *GetDisplayNamesResponse) GetData() interface{}
func (*GetDisplayNamesResponse) GetTotal ¶
func (r *GetDisplayNamesResponse) GetTotal() int64
type GetOpenRequest ¶
type GetOpenRequest struct {
ID string `form:"_id" json:"_id" binding:"required"`
}
type Instruction ¶
type Instruction struct { ID string `bson:"_id"` Name string `bson:"name"` Type int `bson:"type"` ActiveOnPbh []string `bson:"active_on_pbh"` DisabledOnPbh []string `bson:"disabled_on_pbh"` savedpattern.AlarmPatternFields `bson:",inline"` savedpattern.EntityPatternFields `bson:",inline"` }
type InstructionFilterRequest ¶
type InstructionFilterRequest struct { Running *bool `form:"running" json:"running"` IncludeTypes []int `form:"include_types[]" json:"include_types"` ExcludeTypes []int `form:"exclude_types[]" json:"exclude_types"` Include []string `form:"include[]" json:"include"` Exclude []string `form:"exclude[]" json:"exclude"` }
type InstructionWithExecutions ¶
type InstructionWithExecutions struct { Instruction `bson:",inline"` Executions []struct { Execution `bson:",inline"` Alarm string `bson:"alarm"` } `bson:"executions"` }
func (InstructionWithExecutions) GetExecution ¶
func (i InstructionWithExecutions) GetExecution(alarmId string) *Execution
type LinksRequest ¶
type LinksRequest struct {
Ids []string `form:"ids[]" json:"ids" binding:"required,notblank"`
}
type ListByComponentRequest ¶
type ListByComponentRequest struct { pagination.Query SortRequest ID string `form:"_id" json:"_id" binding:"required"` }
type ListByServiceRequest ¶
type ListByServiceRequest struct { pagination.Query SortRequest Search string `form:"search" json:"search"` Category string `form:"category" json:"category"` WithService bool `form:"with_service" json:"with_service"` }
type ListRequest ¶
type ListRequest struct { FilterRequest SortRequest WithInstructions bool `form:"with_instructions" json:"with_instructions"` WithDeclareTickets bool `form:"with_declare_tickets" json:"with_declare_tickets"` WithLinks bool `form:"with_links" json:"with_links"` WithDependencies bool `form:"with_dependencies" json:"with_dependencies"` QueryLog bool `form:"query_log" json:"query_log"` }
type ListRequestWithPagination ¶
type ListRequestWithPagination struct { pagination.Query ListRequest }
type MetaAlarmRule ¶
type MongoQueryBuilder ¶
type MongoQueryBuilder struct {
// contains filtered or unexported fields
}
func NewMongoQueryBuilder ¶
func (*MongoQueryBuilder) CreateAggregationPipelineByMatch ¶
func (q *MongoQueryBuilder) CreateAggregationPipelineByMatch( ctx context.Context, alarmMatch bson.M, entityMatch bson.M, paginationQuery pagination.Query, sortRequest SortRequest, filterRequest FilterRequest, now datetime.CpsTime, userID string, ) ([]bson.M, error)
func (*MongoQueryBuilder) CreateChildrenAggregationPipeline ¶
func (*MongoQueryBuilder) CreateCountAggregationPipeline ¶
func (q *MongoQueryBuilder) CreateCountAggregationPipeline(ctx context.Context, r FilterRequest, userID string, now datetime.CpsTime) ([]bson.M, error)
func (*MongoQueryBuilder) CreateGetAggregationPipeline ¶
func (*MongoQueryBuilder) CreateGetDisplayNamesPipeline ¶
func (q *MongoQueryBuilder) CreateGetDisplayNamesPipeline(r GetDisplayNamesRequest, now datetime.CpsTime) ([]bson.M, error)
type Pbehavior ¶
type Pbehavior struct { ID string `bson:"_id" json:"_id"` Author *author.Author `bson:"author" json:"author"` Name string `bson:"name" json:"name"` RRule string `bson:"rrule" json:"rrule"` Start *datetime.CpsTime `bson:"tstart" json:"tstart" swaggertype:"integer"` Stop *datetime.CpsTime `bson:"tstop" json:"tstop" swaggertype:"integer"` Type *pbehavior.Type `bson:"type" json:"type"` Reason *pbehavior.Reason `bson:"reason" json:"reason"` LastComment *pbehaviorcomment.Response `bson:"last_comment" json:"last_comment"` }
type ResolvedListRequest ¶
type ResolvedListRequest struct { pagination.Query SortRequest ID string `form:"_id" json:"_id" binding:"required"` StartFrom *datetime.CpsTime `form:"tstart" json:"tstart" swaggertype:"integer"` StartTo *datetime.CpsTime `form:"tstop" json:"tstop" swaggertype:"integer"` }
type SortRequest ¶
type Step ¶
type StepDetails ¶
type StepDetails struct { Data []Step `json:"data"` Meta common.PaginatedMeta `json:"meta"` }
type StepsRequest ¶
type StepsRequest struct { pagination.Query Reversed bool `json:"reversed"` Type string `json:"type"` Group bool `json:"group"` }
type Store ¶
type Store interface { Find(ctx context.Context, r ListRequestWithPagination, userID string) (*AggregationResult, error) GetAssignedInstructionsMap(ctx context.Context, alarmIds []string) (map[string][]AssignedInstruction, error) GetInstructionExecutionStatuses(ctx context.Context, alarmIDs []string, assignedInstructionsMap map[string][]AssignedInstruction) (map[string]ExecutionStatus, error) Count(ctx context.Context, r FilterRequest, userID string) (*Count, error) GetByID(ctx context.Context, id, userID string) (*Alarm, error) GetOpenByEntityID(ctx context.Context, id, userID string) (*Alarm, bool, error) FindByService(ctx context.Context, id string, r ListByServiceRequest, userID string) (*AggregationResult, error) FindByComponent(ctx context.Context, r ListByComponentRequest, userID string) (*AggregationResult, error) FindResolved(ctx context.Context, r ResolvedListRequest, userID string) (*AggregationResult, error) GetDetails(ctx context.Context, r DetailsRequest, userID string) (*Details, error) GetAssignedDeclareTicketsMap(ctx context.Context, alarmIds []string) (map[string][]AssignedDeclareTicketRule, error) Export(ctx context.Context, t export.Task) (export.DataCursor, error) GetLinks(ctx context.Context, ruleId string, alarmIds []string, userID string) ([]link.Link, bool, error) GetDisplayNames(ctx context.Context, r GetDisplayNamesRequest) (*GetDisplayNamesResponse, error) }
Click to show internal directories.
Click to hide internal directories.