Documentation ¶
Index ¶
- Constants
- func GetHex(num int) string
- func RandomColor() string
- type AdminTag
- type AdminTagForNode
- type TagManager
- func (m *TagManager) All() ([]AdminTag, error)
- func (m *TagManager) AutoTagNode(env string, node nodes.OsqueryNode, user string) error
- func (m *TagManager) ChangeColor(name, color string, envID uint) error
- func (m *TagManager) ChangeDescription(name, description string, envID uint) error
- func (m *TagManager) ChangeIcon(name, icon string, envID uint) error
- func (m *TagManager) Create(tag *AdminTag) error
- func (m *TagManager) Delete(name string, envID uint) error
- func (m *TagManager) Exists(name string) bool
- func (m *TagManager) ExistsGet(name string, envID uint) (bool, AdminTag)
- func (m *TagManager) Get(name string, envID uint) (AdminTag, error)
- func (m *TagManager) GetByEnv(envID uint) ([]AdminTag, error)
- func (m *TagManager) GetNodeTags(tagged []AdminTag) ([]AdminTagForNode, error)
- func (m *TagManager) GetTags(node nodes.OsqueryNode) ([]AdminTag, error)
- func (m *TagManager) IsTagged(name string, node nodes.OsqueryNode) bool
- func (m *TagManager) IsTaggedID(name string, nodeID uint) bool
- func (m *TagManager) New(name, description, color, icon, user string, envID uint) (AdminTag, error)
- func (m *TagManager) NewTag(name, description, color, icon, user string, envID uint) error
- func (m *TagManager) TagNode(name string, node nodes.OsqueryNode, user string, auto bool) error
- func (m *TagManager) TagNodeMulti(tags []string, node nodes.OsqueryNode, user string, auto bool) error
- func (m *TagManager) UntagNode(name string, node nodes.OsqueryNode) error
- type TaggedNode
Constants ¶
const ( // DefaultTagIcon as default icon to use for tags DefaultTagIcon string = "fas fa-tag" // DefaultAutoTagUser as default user ID to be used for auto tagging DefaultAutoTagUser uint = 0 // DefaultAutocreated as default username and description for tags DefaultAutocreated = "Autocreated" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AdminTag ¶
type AdminTag struct { gorm.Model Name string `gorm:"index"` Description string Color string Icon string CreatedBy string EnvironmentID uint }
AdminTag to hold all tags
type AdminTagForNode ¶
AdminTagForNode to check if this tag is used for an specific node
type TagManager ¶
TagManager have all tags
func CreateTagManager ¶
func CreateTagManager(backend *gorm.DB) *TagManager
CreateTagManager to initialize the tags struct and tables
func (*TagManager) AutoTagNode ¶
func (m *TagManager) AutoTagNode(env string, node nodes.OsqueryNode, user string) error
AutoTagNode to automatically tag a node based on multiple fields
func (*TagManager) ChangeColor ¶
func (m *TagManager) ChangeColor(name, color string, envID uint) error
ChangeColor to update color for a tag
func (*TagManager) ChangeDescription ¶
func (m *TagManager) ChangeDescription(name, description string, envID uint) error
ChangeDescription to update description for a tag
func (*TagManager) ChangeIcon ¶
func (m *TagManager) ChangeIcon(name, icon string, envID uint) error
ChangeIcon to update icon for a tag
func (*TagManager) Delete ¶
func (m *TagManager) Delete(name string, envID uint) error
Delete tag by name
func (*TagManager) Exists ¶
func (m *TagManager) Exists(name string) bool
Exists checks if tag exists
func (*TagManager) ExistsGet ¶
func (m *TagManager) ExistsGet(name string, envID uint) (bool, AdminTag)
ExistsGet checks if tag exists and returns the tag
func (*TagManager) Get ¶
func (m *TagManager) Get(name string, envID uint) (AdminTag, error)
Get tag by name
func (*TagManager) GetByEnv ¶
func (m *TagManager) GetByEnv(envID uint) ([]AdminTag, error)
All get all tags by environment
func (*TagManager) GetNodeTags ¶
func (m *TagManager) GetNodeTags(tagged []AdminTag) ([]AdminTagForNode, error)
GetNodeTags to decorate tags for a given node
func (*TagManager) GetTags ¶
func (m *TagManager) GetTags(node nodes.OsqueryNode) ([]AdminTag, error)
GetTags to retrieve the tags of a given node
func (*TagManager) IsTagged ¶
func (m *TagManager) IsTagged(name string, node nodes.OsqueryNode) bool
IsTagged to check if a node is already tagged
func (*TagManager) IsTaggedID ¶
func (m *TagManager) IsTaggedID(name string, nodeID uint) bool
IsTaggedID to check if a node is already tagged by node ID
func (*TagManager) New ¶
func (m *TagManager) New(name, description, color, icon, user string, envID uint) (AdminTag, error)
New empty tag
func (*TagManager) NewTag ¶
func (m *TagManager) NewTag(name, description, color, icon, user string, envID uint) error
NewTag to create a tag and creates it without returning it
func (*TagManager) TagNode ¶
func (m *TagManager) TagNode(name string, node nodes.OsqueryNode, user string, auto bool) error
TagNode to tag a node TODO use the correct user_id
func (*TagManager) TagNodeMulti ¶
func (m *TagManager) TagNodeMulti(tags []string, node nodes.OsqueryNode, user string, auto bool) error
TagNodeMulti to tag a node with multiple tags TODO use the correct user_id
func (*TagManager) UntagNode ¶
func (m *TagManager) UntagNode(name string, node nodes.OsqueryNode) error
UntagNode to untag a node