model

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Email check email
	Email checkType = iota
	// Name check name
	Name
	// ID check id
	ID
	// IDCreateByUID check ID CreateByUID
	IDCreateByUID
	// UID check uid
	UID // uid正常
	// NameCreateByUID check name's createByUID
	NameCreateByUID
	// HostGroupID check hostgroup is used by tasks
	HostGroupID
	// CreateByID check use is used by hostgroup or tasks
	CreateByID
	// UserName check exist user name
	UserName
)
View Source
const (
	// TBUser select ccrocodile_user
	TBUser string = "crocodile_user"
	// TBHostgroup select ccrocodile_user
	TBHostgroup string = "crocodile_hostgroup"
	// TBTask select crocodile_task
	TBTask string = "crocodile_task"
	// TBHost select crocodile_host
	TBHost string = "crocodile_host"
	// TBLog log table
	TBLog string = "crocodile_log"
	// TBNotify notify table
	TBNotify string = "crocodile_notify"
	// TBOperate operate table
	TBOperate string = "crocodile_operate"
	// TBCasbin casbin table
	TBCasbin string = "casbin_rule"
)

Variables

This section is empty.

Functions

func AddUser

func AddUser(ctx context.Context, name, hashpassword string, role define.Role) error

AddUser add new user

func AdminChangeUser

func AdminChangeUser(ctx context.Context, id string, role define.Role, forbid bool, password, remark string) error

AdminChangeUser admin change user some column define.AdminChangeUser func AdminChangeUser(ctx context.Context, adminuser *define.AdminChangeUser) error {

func ChangeHostGroup

func ChangeHostGroup(ctx context.Context, hostids []string, id, remark string) error

ChangeHostGroup change hostgroup

func ChangeTask

func ChangeTask(ctx context.Context, id string, run bool, tasktype define.TaskType, taskData interface{},
	parentTaskIds []string, parentRunParallel bool, childTaskIds []string, childRunParallel bool,
	cronExpr string, timeout int, alarmUserIds []string, routePolicy define.RoutePolicy, expectCode int,
	expectContent string, alarmStatus define.AlarmStatus, hostGroupID, remark string) error

ChangeTask change task

func ChangeUserInfo

func ChangeUserInfo(ctx context.Context, id, name, email, wechat, dingding, telegram, password, remark string) error

ChangeUserInfo user change self's config define.ChangeUserSelf func ChangeUserInfo(ctx context.Context, id string, changeinfo *define.ChangeUserSelf) error {

func Check

func Check(ctx context.Context, table string, checkType checkType, args ...interface{}) (bool, error)

Check check some msg is valid

func CleanTaskLog

func CleanTaskLog(ctx context.Context, name, taskid string, deletetime int64) (int64, error)

CleanTaskLog clean old task from time ago

func CreateHostgroup

func CreateHostgroup(ctx context.Context, name, remark, createByID string, hostids []string) error

CreateHostgroup create hostgroup

func CreateTask

func CreateTask(ctx context.Context, id, name string, tasktype define.TaskType, taskData interface{}, run bool,
	parentTaskIds []string, parentRunParallel bool, childTaskIds []string, childRunParallel bool,
	cronExpr string, timeout int, alarmUserIds []string, routePolicy define.RoutePolicy, expectCode int,
	expectContent string, alarmStatus define.AlarmStatus, createByID, hostGroupID, remark string) error

CreateTask create task

func DeleteHost

func DeleteHost(ctx context.Context, hostid string) error

DeleteHost will delete host

func DeleteHostGroup

func DeleteHostGroup(ctx context.Context, id string) error

DeleteHostGroup delete hostgroup

func DeleteTask

func DeleteTask(ctx context.Context, id string) error

DeleteTask delete task

func DeleteUser added in v1.1.6

func DeleteUser(ctx context.Context, id string) error

DeleteUser will delete user msg

func ExistAddr

func ExistAddr(ctx context.Context, addr string) (*define.Host, bool, error)

ExistAddr check already exist

func GetEnforcer

func GetEnforcer() *casbin.Enforcer

GetEnforcer get casbin auth

func GetHostByAddr

func GetHostByAddr(ctx context.Context, addr string) (*define.Host, error)

GetHostByAddr get host by addr

func GetHostByID

func GetHostByID(ctx context.Context, id string) (*define.Host, error)

GetHostByID get host by hostid

func GetHostByIDS

func GetHostByIDS(ctx context.Context, ids []string) ([]*define.Host, error)

GetHostByIDS get hosts by hostids

func GetHostGroupByID

func GetHostGroupByID(ctx context.Context, id string) (*define.HostGroup, error)

GetHostGroupByID return hostgroup by id

func GetHostGroupByName

func GetHostGroupByName(ctx context.Context, hgname string) (*define.HostGroup, error)

GetHostGroupByName return hostgroup by name

func GetHostGroups

func GetHostGroups(ctx context.Context, limit, offset int) ([]define.HostGroup, int, error)

GetHostGroups return all hostgroup

func GetHosts

func GetHosts(ctx context.Context, offset, limit int) ([]*define.Host, int, error)

GetHosts get all hosts

func GetHostsByHGID

func GetHostsByHGID(ctx context.Context, hgid string) ([]*define.Host, error)

GetHostsByHGID return hostgroup's host details

func GetLog

func GetLog(ctx context.Context, taskname string, status int, offset, limit int) ([]*define.Log, int, error)

GetLog get task resp log by taskid

func GetNameID

func GetNameID(ctx context.Context, t string) ([]define.KlOption, error)

GetNameID get return name,id

func GetNotifyByUID

func GetNotifyByUID(ctx context.Context, uid string) ([]define.Notify, error)

GetNotifyByUID get user's notify

func GetOperate

func GetOperate(ctx context.Context, uid, username, method, module string, limit, offset int) ([]define.OperateLog, int, error)

GetOperate get operate log

func GetTaskByID

func GetTaskByID(ctx context.Context, id string) (*define.GetTask, error)

GetTaskByID get task by id

func GetTaskByName

func GetTaskByName(ctx context.Context, name string) (*define.GetTask, error)

GetTaskByName get task by id

func GetTasks

func GetTasks(ctx context.Context, offset, limit int, name, presearchname, createby string) ([]define.GetTask, int, error)

GetTasks get all tasks

func GetTreeLog

func GetTreeLog(ctx context.Context, id string, startTime int64) ([]*define.TaskStatusTree, error)

GetTreeLog get tree log data

func GetUserByID

func GetUserByID(ctx context.Context, uid string) (*define.User, error)

GetUserByID get user by id

func GetUserByName

func GetUserByName(ctx context.Context, name string) (*define.User, error)

GetUserByName get user by name

func GetUsers

func GetUsers(ctx context.Context, uids []string, offset, limit int) ([]define.User, int, error)

GetUsers get all users info

func InitDb

func InitDb() error

InitDb init db

func InitRabc

func InitRabc()

InitRabc init rabc

func LoginUser

func LoginUser(ctx context.Context, name string, password string) (string, error)

LoginUser login user

func NotifyRead

func NotifyRead(ctx context.Context, id int, uid string) error

NotifyRead make notify status is readed

func QueryIsInstall

func QueryIsInstall(ctx context.Context) (bool, error)

QueryIsInstall check table is create

func QueryUserRule

func QueryUserRule(ctx context.Context, uid string) (define.Role, error)

QueryUserRule query user rule by uid

func RandHostID

func RandHostID(hg *define.HostGroup) (string, error)

RandHostID return execute worker ip

func RegistryNewHost

func RegistryNewHost(ctx context.Context, req *pb.RegistryReq) (string, error)

RegistryNewHost refistry new host

func RegistryToUpdateHost added in v1.1.0

func RegistryToUpdateHost(ctx context.Context, req *pb.RegistryReq) error

RegistryToUpdateHost refistry new host

func SaveLog

func SaveLog(ctx context.Context, l *define.Log) error

SaveLog save task reps log

func SaveNewNotify

func SaveNewNotify(ctx context.Context, notify define.Notify) error

SaveNewNotify save new notify

func SaveOperateLog

func SaveOperateLog(ctx context.Context,
	c *gin.Context, uid, username string,
	role define.Role, method, module, modulename string,
	operatetime int64, desc string, columns []define.Column) error

SaveOperateLog save all user change operate

func StartInstall

func StartInstall(ctx context.Context, username, password string) error

StartInstall start install system

func StopHost

func StopHost(ctx context.Context, hostid string, stop bool) error

StopHost will stop run worker in hostid

func TaskIsUse

func TaskIsUse(ctx context.Context, taskid string) (int, error)

TaskIsUse check a task is other task's parent task ids or child task

func UpdateHostHearbeat

func UpdateHostHearbeat(ctx context.Context, ip string, port int32, runningtasks []string) error

UpdateHostHearbeat update host last recv hearbeat time

Types

This section is empty.

Jump to

Keyboard shortcuts

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