rules

package
v0.0.0-...-e20b040 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigIdKey = "dtConfigId"
View Source
const ConfigNameKey = "dtConfigName"
View Source
const DownloadedKey = "downloaded"
View Source
const EntitiesListKey = "dtEntitiesList"
View Source
const Settings20V1Id = "dtSettings20V1Id"
View Source
const ValueKey = "value"

Variables

View Source
var HIERARCHY_CONFIG_LIST_ENTITIES = HierarchyRuleTypeList{
	RuleTypes: []HierarchyRuleType{
		{
			IsSeed:      true,
			IsParent:    true,
			WeightValue: 100,
			HierarchyRules: []HierarchyRule{
				{
					Name:              "Matches",
					ResultType:        MATCHES_TYPE,
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
			},
		},
		{
			IsSeed:      true,
			IsParent:    true,
			WeightValue: 90,
			HierarchyRules: []HierarchyRule{
				{
					Name:              "Multi Matched",
					ResultType:        MULTI_MATCHED_TYPE,
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
			},
		},
		{
			IsSeed:      true,
			IsParent:    false,
			WeightValue: 80,
			HierarchyRules: []HierarchyRule{
				{
					Name:              "Matches",
					ResultType:        MATCHES_TYPE,
					WeightValue:       2,
					SelfMatchDisabled: false,
				},
				{
					Name:              "Multi Matched",
					ResultType:        MULTI_MATCHED_TYPE,
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
			},
		},
		{
			IsSeed:      true,
			IsParent:    false,
			WeightValue: 70,
			HierarchyRules: []HierarchyRule{
				{
					Name:              "PostProcess",
					ResultType:        POST_PROCESS_TYPE,
					WeightValue:       0,
					SelfMatchDisabled: false,
				},
			},
		},
	},
}
View Source
var HIERARCHY_SOURCE_LIST_ENTITIES = HierarchySourceList{
	Sources: []HierarchySource{
		{
			Name:     "Runs on Host",
			Priority: 100,
			Path:     []string{"fromRelationships", "runsOnHost"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.RunsOnHost
				}
				return nil
			},
		},
		{
			Name:     "Is Process Of",
			Priority: 90,
			Path:     []string{"fromRelationships", "isProcessOf"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.IsProcessOf
				}
				return nil
			},
		},
		{
			Name:     "Runs on",
			Priority: 80,
			Path:     []string{"fromRelationships", "runsOn"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.RunsOn
				}
				return nil
			},
		},
		{
			Name:     "Is instance of",
			Priority: 70,
			Path:     []string{"fromRelationships", "isInstanceOf"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.IsInstanceOf
				}
				return nil
			},
		},
		{
			Name:     "Is container group instance of host",
			Priority: 60,
			Path:     []string{"fromRelationships", "isCgiOfHost"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.IsCgiOfHost
				}
				return nil
			},
		},
		{
			Name:     "Is disk of",
			Priority: 60,
			Path:     []string{"fromRelationships", "isDiskOf"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.IsDiskOf
				}
				return nil
			},
		},
		{
			Name:     "Step of",
			Priority: 60,
			Path:     []string{"fromRelationships", "isStepOf"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.IsStepOf
				}
				return nil
			},
		},
		{
			Name:     "Application of synthetic test",
			Priority: 60,
			Path:     []string{"fromRelationships", "isApplicationOfSyntheticTest"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.IsApplicationOfSyntheticTest
				}
				return nil
			},
		},
		{
			Name:     "Is Group Of",
			Priority: 50,
			Path:     []string{"fromRelationships", "isGroupOf"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.IsGroupOf
				}
				return nil
			},
		},
		{
			Name:     "Is Application Method Group Of",
			Priority: 40,
			Path:     []string{"fromRelationships", "isApplicationMethodOfGroup"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.IsApplicationMethodOfGroup
				}
				return nil
			},
		},
		{
			Name:     "Is Child Of",
			Priority: 30,
			Path:     []string{"fromRelationships", "isChildOf"},
			Getter: func(value entitiesValues.Value) *[]entitiesValues.Relation {
				if value.FromRelationship != nil {
					return value.FromRelationship.IsChildOf
				}
				return nil
			},
		},
	},
}
View Source
var INDEX_CONFIG_LIST_CONFIGS = IndexRuleTypeList{
	RuleTypes: []IndexRuleType{
		{
			IsSeed:      true,
			SplitMatch:  true,
			WeightValue: 100,
			Rules: []IndexRule{
				{
					Name:              "Config Name",
					Path:              []string{ConfigNameKey},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
				{
					Name:              "Scope",
					Path:              []string{DownloadedKey, "scope"},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
				{
					Name:              "Dashboard Owner",
					Path:              []string{DownloadedKey, ValueKey, "dashboardMetadata", "owner"},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
			},
		},
		{
			IsSeed:      false,
			SplitMatch:  false,
			WeightValue: 90,
			Rules: []IndexRule{
				{
					Name:              "Entities List",
					Path:              []string{EntitiesListKey},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
			},
		},
		{
			IsSeed:      false,
			SplitMatch:  false,
			WeightValue: 50,
			Rules: []IndexRule{
				{
					Name:              "id",
					Path:              []string{ConfigIdKey},
					WeightValue:       2,
					SelfMatchDisabled: true,
				},
			},
		},
	},
}
View Source
var INDEX_CONFIG_LIST_ENTITIES = IndexRuleTypeList{
	RuleTypes: []IndexRuleType{
		{
			IsSeed:      true,
			WeightValue: 100,
			Rules: []IndexRule{
				{
					Name: "Detected Name",
					Path: []string{"properties", "detectedName"},
					Getter: func(value entitiesValues.Value) *string {
						if value.Properties != nil {
							return &value.Properties.DetectedName
						}
						return nil
					},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
				{
					Name: "One Agent Custom Host Name",
					Path: []string{"properties", "oneAgentCustomHostName"},
					Getter: func(value entitiesValues.Value) *string {
						if value.Properties != nil {
							return value.Properties.OneAgentCustomHostName
						}
						return nil
					},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
				{
					Name: "Geolocation Code",
					Path: []string{"properties", "geolocationCode"},
					Getter: func(value entitiesValues.Value) *string {
						if value.Properties != nil {
							return value.Properties.GeolocationCode
						}
						return nil
					},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
				{
					Name: "Geolocation Type",
					Path: []string{"properties", "geolocationType"},
					Getter: func(value entitiesValues.Value) *string {
						if value.Properties != nil {
							return value.Properties.GeolocationType
						}
						return nil
					},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
				{
					Name: "Web Service Name",
					Path: []string{"properties", "webServiceName"},
					Getter: func(value entitiesValues.Value) *string {
						if value.Properties != nil {
							return value.Properties.WebServiceName
						}
						return nil
					},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
				{
					Name: "Web Service Namespace",
					Path: []string{"properties", "webServiceNamespace"},
					Getter: func(value entitiesValues.Value) *string {
						if value.Properties != nil {
							return value.Properties.WebServiceNamespace
						}
						return nil
					},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
			},
		},
		{
			IsSeed:      true,
			WeightValue: 90,
			Rules: []IndexRule{
				{
					Name:              "Entity Id",
					Path:              []string{"entityId"},
					Getter:            func(value entitiesValues.Value) *string { return &value.EntityId },
					WeightValue:       1,
					SelfMatchDisabled: true,
				},
				{
					Name:              "Display Name",
					Path:              []string{"displayName"},
					Getter:            func(value entitiesValues.Value) *string { return value.DisplayName },
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
			},
		},

		{
			IsSeed:      true,
			WeightValue: 50,
			Rules: []IndexRule{
				{
					Name: "Ip Addresses List",
					Path: []string{"properties", "ipAddress"},
					GetterList: func(value entitiesValues.Value) *[]string {
						if value.Properties != nil {
							return value.Properties.IpAddress
						}
						return nil
					},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
				{
					Name: "Internal Ip Addresses List",
					Path: []string{"properties", "internalIpAddresses"},
					GetterList: func(value entitiesValues.Value) *[]string {
						if value.Properties != nil {
							return value.Properties.InternalIpAddresses
						}
						return nil
					},
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
			},
		},
		{
			IsSeed:      true,
			WeightValue: 40,
			Rules: []IndexRule{
				{
					Name: "Executable Path",
					Path: []string{"properties", "metadata"},
					GetterMetadata: func(value entitiesValues.Value) *[]entitiesValues.Metadata {
						if value.Properties != nil {
							return value.Properties.Metadata
						}
						return nil
					},
					ListItemKey:       "EXE_PATH",
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
			},
		},
		{
			IsSeed:      false,
			WeightValue: 30,
			Rules: []IndexRule{
				{
					Name: "K8s Pod UID",
					Path: []string{"properties", "metadata"},
					GetterMetadata: func(value entitiesValues.Value) *[]entitiesValues.Metadata {
						if value.Properties != nil {
							return value.Properties.Metadata
						}
						return nil
					},
					ListItemKey:       "KUBERNETES_POD_UID",
					WeightValue:       1,
					SelfMatchDisabled: false,
				},
			},
		},
	},
}
View Source
var MATCHES_TYPE = "Matches"
View Source
var MULTI_MATCHED_TYPE = "MultiMatched"
View Source
var POST_PROCESS_TYPE = "PostProcess"

Functions

func GenExtraFieldsL2

func GenExtraFieldsL2(ruleTypeList RuleTypeList) map[string][]string

Types

type ByPriorityHierarchySource

type ByPriorityHierarchySource []HierarchySource

func (ByPriorityHierarchySource) Len

func (ByPriorityHierarchySource) Less

func (a ByPriorityHierarchySource) Less(i, j int) bool

func (ByPriorityHierarchySource) Swap

func (a ByPriorityHierarchySource) Swap(i, j int)

type HierarchyRule

type HierarchyRule struct {
	Name              string
	Path              []string
	ResultType        string
	WeightValue       int
	SelfMatchDisabled bool
	SpecificType      []string
}

func (*HierarchyRule) GetWeightValue

func (me *HierarchyRule) GetWeightValue() int

type HierarchyRuleType

type HierarchyRuleType struct {
	Name           string
	Key            int
	IsSeed         bool
	IsParent       bool
	SplitMatch     bool
	WeightValue    int
	HierarchyRules []HierarchyRule
}

func (*HierarchyRuleType) IsSplitMatch

func (me *HierarchyRuleType) IsSplitMatch() bool

type HierarchyRuleTypeList

type HierarchyRuleTypeList struct {
	RuleTypes []HierarchyRuleType
}

type HierarchySource

type HierarchySource struct {
	Name     string
	Priority int
	Path     []string
	Getter   func(entitiesValues.Value) *[]entitiesValues.Relation
}

func GetSortedHierarchySourceListEntities

func GetSortedHierarchySourceListEntities() []HierarchySource

type HierarchySourceList

type HierarchySourceList struct {
	Sources []HierarchySource
}

func (*HierarchySourceList) GetPaths

func (me *HierarchySourceList) GetPaths() [][]string

type IndexRule

type IndexRule struct {
	Name              string
	Path              []string
	Getter            func(entitiesValues.Value) *string
	GetterList        func(entitiesValues.Value) *[]string
	GetterMetadata    func(entitiesValues.Value) *[]entitiesValues.Metadata
	ListItemKey       string
	WeightValue       int
	SelfMatchDisabled bool
	SpecificType      []string
}

func (*IndexRule) GetWeightValue

func (me *IndexRule) GetWeightValue() int

type IndexRuleType

type IndexRuleType struct {
	Key         int
	IsSeed      bool
	SplitMatch  bool
	WeightValue int
	Rules       []IndexRule
}

func (*IndexRuleType) IsSplitMatch

func (me *IndexRuleType) IsSplitMatch() bool

type IndexRuleTypeList

type IndexRuleTypeList struct {
	RuleTypes []IndexRuleType
}

func (*IndexRuleTypeList) GetPaths

func (me *IndexRuleTypeList) GetPaths() [][]string

type Rule

type Rule interface {
	GetWeightValue() int
}

type RuleType

type RuleType interface {
	IsSplitMatch() bool
}

type RuleTypeList

type RuleTypeList interface {
	GetPaths() [][]string
}

Jump to

Keyboard shortcuts

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