topo_tree

package
v0.0.0-...-cb472e6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OverHeadError = errors.New("hit data is overhead")

Functions

This section is empty.

Types

type CustomLevel

type CustomLevel struct {
	Object   string `json:"bk_obj_id"`
	InstName string `json:"bk_inst_name"`
}

business topology custom level describe.

type MainlineNode

type MainlineNode struct {
	// mainline topology object
	Object string `json:"bk_obj_id"`
	// object's instance id, eg, bk_set_id, bk_module_id...
	InstanceID int64 `json:"bk_inst_id"`
}

type Node

type Node struct {
	// mainline topology object
	Object string `json:"bk_obj_id"`
	// object's instance id, eg, bk_set_id, bk_module_id...
	InstanceID int64 `json:"bk_inst_id"`
	// instance's name, eg: bk_set_name, bk_module_name...
	InstanceName string `json:"bk_inst_name"`
	// node's parent id, only used for internal, do not return to user.
	ParentID int64 `json:"-"`
}

type NodePaths

type NodePaths struct {
	*MainlineNode
	InstanceName string `json:"bk_inst_name"`
	// host may have multiple paths
	Paths [][]Node `json:"bk_paths"`
}

NodePaths describes a topology instance's path from itself to the top biz. cause a host may exists in multiple modules, so it's may have several paths.

type SearchNodePathOption

type SearchNodePathOption struct {
	Business int64           `json:"bk_biz_id"`
	Nodes    []*MainlineNode `json:"bk_nodes"`
}

search one of the node's path in the the business topology.

type SearchOption

type SearchOption struct {
	BusinessID int64 `json:"bk_biz_id"`
	// if BusinessID is > 0, then BusinessName will be ignored
	BusinessName string      `json:"bk_biz_name"`
	SetName      string      `json:"bk_set_name"`
	ModuleName   string      `json:"bk_module_name"`
	Level        CustomLevel `json:"bk_level"`
}

all the search option is all matched with regexp and ignore case.

func (SearchOption) Validate

func (s SearchOption) Validate() error

type Topology

type Topology struct {
	BusinessID   int64  `json:"bk_biz_id"`
	BusinessName string `json:"bk_biz_name"`
	Trees        []Tree `json:"bk_topo_tree"`
}

type TopologyTree

type TopologyTree struct {
	// contains filtered or unexported fields
}

func NewTopologyTree

func NewTopologyTree(client *business.Client) *TopologyTree

func (*TopologyTree) SearchNodePath

func (t *TopologyTree) SearchNodePath(ctx context.Context, opt *SearchNodePathOption) ([]NodePaths, error)

func (*TopologyTree) SearchTopologyTree

func (t *TopologyTree) SearchTopologyTree(opt *SearchOption) ([]*Topology, error)

func (*TopologyTree) SearchWithBusiness

func (t *TopologyTree) SearchWithBusiness(opt *SearchOption) (*Topology, error)

Obviously, we search it from top to bottom.

type Tree

type Tree struct {
	Object   string `json:"bk_obj_id"`
	InstName string `json:"bk_inst_name"`
	InstID   int64  `json:"bk_inst_id"`
	Children []Tree `json:"children"`
}

Jump to

Keyboard shortcuts

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