tag

package
v0.0.0-...-0991925 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VIF_DEVICE_TYPE_INTERNET                        = 0
	VIF_DEVICE_TYPE_VM                              = 1
	VIF_DEVICE_TYPE_VROUTER                         = 5
	VIF_DEVICE_TYPE_HOST                            = 6
	VIF_DEVICE_TYPE_DHCP_PORT                       = 9
	VIF_DEVICE_TYPE_POD                             = 10
	VIF_DEVICE_TYPE_POD_SERVICE                     = 11
	VIF_DEVICE_TYPE_REDIS_INSTANCE                  = 12
	VIF_DEVICE_TYPE_RDS_INSTANCE                    = 13
	VIF_DEVICE_TYPE_POD_NODE                        = 14
	VIF_DEVICE_TYPE_LB                              = 15
	VIF_DEVICE_TYPE_NAT_GATEWAY                     = 16
	VIF_DEVICE_TYPE_POD_GROUP                       = 101
	VIF_DEVICE_TYPE_SERVICE                         = 102
	VIF_DEVICE_TYPE_POD_CLUSTER                     = 103
	VIF_DEVICE_TYPE_GPROCESS                        = 120
	VIF_DEVICE_TYPE_POD_GROUP_DEPLOYMENT            = 130
	VIF_DEVICE_TYPE_POD_GROUP_STATEFULSET           = 131
	VIF_DEVICE_TYPE_POD_GROUP_RC                    = 132
	VIF_DEVICE_TYPE_POD_GROUP_DAEMON_SET            = 133
	VIF_DEVICE_TYPE_POD_GROUP_REPLICASET_CONTROLLER = 134
	VIF_DEVICE_TYPE_POD_GROUP_CLONESET              = 135
	VIF_DEVICE_TYPE_IP                              = 255
)
View Source
const (
	TAP_PORT_MAC_0 = 0
	TAP_PORT_MAC_1 = 1
	TAP_PORT_IPV4  = 2
)

Variables

View Source
var AUTO_CUSTOM_TAG_CHECK_MAP = map[string][]string{}
View Source
var AUTO_CUSTOM_TAG_MAP = map[string][]string{}
View Source
var AUTO_CUSTOM_TAG_NAMES = []string{}
View Source
var AutoPodGroupMap = map[string]int{
	"pod_group": VIF_DEVICE_TYPE_POD_GROUP,
}
View Source
var AutoPodMap = map[string]int{
	"pod": VIF_DEVICE_TYPE_POD,
}
View Source
var FlowTagResourceMap = GenerateFlowTagTagResoureMap()
View Source
var HOSTNAME_IP_DEVICE_MAP = map[string]struct {
	ResourceType int
	ResourceName string
	FieldName    string
}{
	common.HOST_HOSTNAME:     {ResourceType: VIF_DEVICE_TYPE_HOST, ResourceName: "host", FieldName: "hostname"},
	common.HOST_IP:           {ResourceType: VIF_DEVICE_TYPE_HOST, ResourceName: "host", FieldName: "ip"},
	common.CHOST_HOSTNAME:    {ResourceType: VIF_DEVICE_TYPE_VM, ResourceName: "chost", FieldName: "hostname"},
	common.CHOST_IP:          {ResourceType: VIF_DEVICE_TYPE_VM, ResourceName: "chost", FieldName: "ip"},
	common.POD_NODE_HOSTNAME: {ResourceType: VIF_DEVICE_TYPE_POD_NODE, ResourceName: "pod_node", FieldName: "hostname"},
	common.POD_NODE_IP:       {ResourceType: VIF_DEVICE_TYPE_POD_NODE, ResourceName: "pod_node", FieldName: "ip"},
}
View Source
var INT_ENUM_PEER_TAG = []string{"resource_gl0_type", "resource_gl1_type", "resource_gl2_type", "tcp_flags_bit", "auto_instance_type", "auto_service_type"}
View Source
var INT_ENUM_TAG = []string{"close_type", "eth_type", "signal_source", "is_ipv4", "l7_ip_protocol", "type", "l7_protocol", "protocol", "response_status", "server_port", "status", "capture_nic_type", "tunnel_tier", "tunnel_type", "instance_type", "nat_source", "role", "event_level", "policy_level", "policy_app_type", "is_tls", "severity_number"}
View Source
var PodGroupTypeSlice = []string{
	"deployment", "stateful_set", "replication_controller", "daemon_set",
	"replica_set_controller", "clone_set",
}
View Source
var STRING_ENUM_TAG = []string{"observation_point", "event_type", "profile_language_type"}
View Source
var TAG_DESCRIPTIONS = map[TagDescriptionKey]*TagDescription{}
View Source
var TAG_DESCRIPTION_KEYS = []TagDescriptionKey{}
View Source
var TAG_ENUMS = map[string][]*TagEnum{}

key=tagEnumFile

View Source
var TAG_INT_ENUMS = map[string][]*TagEnum{}
View Source
var TAG_RESOURCE_TYPE_AUTO = []string{"resource_gl0", "resource_gl1", "resource_gl2", "auto_instance", "auto_service"}
View Source
var TAG_RESOURCE_TYPE_DEFAULT = []string{
	"region", "az", "pod_node", "pod_ns",
	"pod_group", "pod", "pod_cluster", "subnet", "gprocess",
}
View Source
var TAG_STRING_ENUMS = map[string][]*TagEnum{}
View Source
var TagResoureMap = GenerateTagResoureMap()

Functions

func GenerateFlowTagTagResoureMap

func GenerateFlowTagTagResoureMap() map[string]map[string]*Tag

func GenerateTagResoureMap

func GenerateTagResoureMap() map[string]map[string]*Tag

func GetEnumTagValues

func GetEnumTagValues(db, table, sql string) (map[string][]interface{}, error)

func GetExternalTagValues

func GetExternalTagValues(db, table, rawSql string) (*common.Result, []string, error)

func GetTagDescriptions

func GetTagDescriptions(db, table, rawSql, queryCacheTTL, orgID string, useQueryCache bool, ctx context.Context) (response *common.Result, err error)

func GetTagResourceValues

func GetTagResourceValues(db, table, rawSql string) (*common.Result, []string, error)

func GetTagValues

func GetTagValues(db, table, sql, queryCacheTTL, orgID string, useQueryCache bool) (*common.Result, []string, error)

func LoadTagDescriptions

func LoadTagDescriptions(tagData map[string]interface{}) error

Types

type Tag

type Tag struct {
	TagTranslator         string            // 对tag进行翻译或转换
	NotNullFilter         string            // 资源非空过滤
	WhereTranslator       string            // 资源过滤转换
	WhereRegexpTranslator string            // 资源过滤正则转换
	TagTranslatorMap      map[string]string // 自定义分组tag翻译
}

func GetTag

func GetTag(name, db, table, function string) (*Tag, bool)

func NewTag

func NewTag(tagTranslator, notNullFilter, whereTranslator, whereRegexpTranslator string) *Tag

type TagDescription

type TagDescription struct {
	Name                  string
	ClientName            string
	ServerName            string
	DisplayName           string
	Type                  string
	EnumFile              string
	Category              string
	Description           string
	Operators             []string
	Permissions           []bool
	RelatedTag            string
	Deprecated            bool
	NotSupportedOperators []string
}

func NewTagDescription

func NewTagDescription(
	name, clientName, serverName, displayName, tagType, enumFile, category string,
	permissions []bool, description, relatedTag string, deprecated bool, notSupportedOperators []string,
) *TagDescription

type TagDescriptionKey

type TagDescriptionKey struct {
	DB      string
	Table   string
	TagName string
}

[db][table]tag*TagDescription

type TagEnum

type TagEnum struct {
	Value       interface{}
	DisplayName interface{}
	Description interface{}
}

func NewTagEnum

func NewTagEnum(value, displayName, description interface{}) *TagEnum

Jump to

Keyboard shortcuts

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