Documentation ¶
Index ¶
- Constants
- func AddUser(ctx context.Context, name, hashpassword string, role define.Role) error
- func AdminChangeUser(ctx context.Context, id string, role define.Role, forbid bool, ...) error
- func ChangeHostGroup(ctx context.Context, hostids []string, id, remark string) error
- func ChangeTask(ctx context.Context, id string, run bool, tasktype define.TaskType, ...) error
- func ChangeUserInfo(ctx context.Context, ...) error
- func Check(ctx context.Context, table string, checkType checkType, args ...interface{}) (bool, error)
- func CleanTaskLog(ctx context.Context, name, taskid string, deletetime int64) (int64, error)
- func CreateHostgroup(ctx context.Context, name, remark, createByID string, hostids []string) error
- func CreateTask(ctx context.Context, id, name string, tasktype define.TaskType, ...) error
- func DeleteHost(ctx context.Context, hostid string) error
- func DeleteHostGroup(ctx context.Context, id string) error
- func DeleteTask(ctx context.Context, id string) error
- func DeleteUser(ctx context.Context, id string) error
- func ExistAddr(ctx context.Context, addr string) (*define.Host, bool, error)
- func GetEnforcer() *casbin.Enforcer
- func GetHostByAddr(ctx context.Context, addr string) (*define.Host, error)
- func GetHostByID(ctx context.Context, id string) (*define.Host, error)
- func GetHostByIDS(ctx context.Context, ids []string) ([]*define.Host, error)
- func GetHostGroupByID(ctx context.Context, id string) (*define.HostGroup, error)
- func GetHostGroupByName(ctx context.Context, hgname string) (*define.HostGroup, error)
- func GetHostGroups(ctx context.Context, limit, offset int) ([]define.HostGroup, int, error)
- func GetHosts(ctx context.Context, offset, limit int) ([]*define.Host, int, error)
- func GetHostsByHGID(ctx context.Context, hgid string) ([]*define.Host, error)
- func GetLog(ctx context.Context, taskname string, status int, offset, limit int) ([]*define.Log, int, error)
- func GetNameID(ctx context.Context, t string) ([]define.KlOption, error)
- func GetNotifyByUID(ctx context.Context, uid string) ([]define.Notify, error)
- func GetOperate(ctx context.Context, uid, username, method, module string, limit, offset int) ([]define.OperateLog, int, error)
- func GetTaskByID(ctx context.Context, id string) (*define.GetTask, error)
- func GetTaskByName(ctx context.Context, name string) (*define.GetTask, error)
- func GetTasks(ctx context.Context, offset, limit int, name, presearchname, createby string) ([]define.GetTask, int, error)
- func GetTreeLog(ctx context.Context, id string, startTime int64) ([]*define.TaskStatusTree, error)
- func GetUserByID(ctx context.Context, uid string) (*define.User, error)
- func GetUserByName(ctx context.Context, name string) (*define.User, error)
- func GetUsers(ctx context.Context, uids []string, offset, limit int) ([]define.User, int, error)
- func InitDb() error
- func InitRabc()
- func LoginUser(ctx context.Context, name string, password string) (string, error)
- func NotifyRead(ctx context.Context, id int, uid string) error
- func QueryIsInstall(ctx context.Context) (bool, error)
- func QueryUserRule(ctx context.Context, uid string) (define.Role, error)
- func RandHostID(hg *define.HostGroup) (string, error)
- func RegistryNewHost(ctx context.Context, req *pb.RegistryReq) (string, error)
- func RegistryToUpdateHost(ctx context.Context, req *pb.RegistryReq) error
- func SaveLog(ctx context.Context, l *define.Log) error
- func SaveNewNotify(ctx context.Context, notify define.Notify) error
- func SaveOperateLog(ctx context.Context, c *gin.Context, uid, username string, role define.Role, ...) error
- func StartInstall(ctx context.Context, username, password string) error
- func StopHost(ctx context.Context, hostid string, stop bool) error
- func TaskIsUse(ctx context.Context, taskid string) (int, error)
- func UpdateHostHearbeat(ctx context.Context, ip string, port int32, runningtasks []string) error
Constants ¶
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 )
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 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 ¶
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 ¶
CleanTaskLog clean old task from time ago
func CreateHostgroup ¶
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 ¶
DeleteHost will delete host
func DeleteHostGroup ¶
DeleteHostGroup delete hostgroup
func DeleteUser ¶ added in v1.1.6
DeleteUser will delete user msg
func GetHostByAddr ¶
GetHostByAddr get host by addr
func GetHostByID ¶
GetHostByID get host by hostid
func GetHostByIDS ¶
GetHostByIDS get hosts by hostids
func GetHostGroupByID ¶
GetHostGroupByID return hostgroup by id
func GetHostGroupByName ¶
GetHostGroupByName return hostgroup by name
func GetHostGroups ¶
GetHostGroups return all hostgroup
func GetHostsByHGID ¶
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 GetNotifyByUID ¶
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 ¶
GetTaskByID get task by id
func GetTaskByName ¶
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 ¶
GetTreeLog get tree log data
func GetUserByID ¶
GetUserByID get user by id
func GetUserByName ¶
GetUserByName get user by name
func NotifyRead ¶
NotifyRead make notify status is readed
func QueryIsInstall ¶
QueryIsInstall check table is create
func QueryUserRule ¶
QueryUserRule query user rule by uid
func RandHostID ¶
RandHostID return execute worker ip
func RegistryNewHost ¶
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 SaveNewNotify ¶
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 ¶
StartInstall start install system
Types ¶
This section is empty.