script

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func NewController

func NewController() *Controller

func (*Controller) RegisterRoute

func (c *Controller) RegisterRoute(group *gin.RouterGroup)

type JobInfo added in v0.0.7

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

type Params

type Params map[string]any

func (*Params) Scan

func (p *Params) Scan(val interface{}) error

func (Params) Value

func (p Params) Value() (driver.Value, error)

type Record added in v0.0.7

type Record struct {
	ID          uuid.UUID `json:"id" gorm:"primary_key;type:uuid;" swaggerignore:"true"`
	ScriptTitle string    `json:"scriptTitle"`
	Script      string    `json:"script"`
	Hosts       string    `json:"hosts"`
	Params      string    `json:"params"`
	Result      string    `json:"result"`
	Status      string    `json:"status"`
	Message     string    `json:"message"`
	Error       string    `json:"error"`

	database.BaseModel
}

func (*Record) BeforeCreate added in v0.0.7

func (r *Record) BeforeCreate(tx *gorm.DB) error

func (*Record) TableName added in v0.0.7

func (r *Record) TableName() string

type RunScriptParams added in v0.0.7

type RunScriptParams struct {
	ScriptId uuid.UUID
	HostIds  []uuid.UUID
	Params   string
}

type Script

type Script struct {
	ID      uuid.UUID `json:"id" gorm:"primary_key;type:uuid;" swaggerignore:"true"`
	Title   string    `json:"title" gorm:"not null" validate:"required"`
	Desc    string    `json:"desc"`
	Content string    `json:"content" gorm:"not null" validate:"required"`
	Type    string    `json:"type" validate:"oneof=shell python"`

	database.BaseModel
}

func (*Script) BeforeCreate

func (s *Script) BeforeCreate(tx *gorm.DB) error

func (*Script) TableName

func (s *Script) TableName() string

type Service

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

func GetService

func GetService() *Service

func (*Service) AddScript

func (s *Service) AddScript(script *Script) error

func (*Service) BatchDeleteScript

func (s *Service) BatchDeleteScript(ids []uuid.UUID) error

func (*Service) DeleteScript

func (s *Service) DeleteScript(script *Script) error

func (*Service) DetailScript

func (s *Service) DetailScript(id uuid.UUID) (*Script, error)

func (*Service) GetJobLog added in v0.0.7

func (s *Service) GetJobLog(id uuid.UUID) (map[string][]string, error)

func (*Service) GetScriptFile added in v0.0.7

func (s *Service) GetScriptFile(id uuid.UUID) (string, error)

func (*Service) Initialize

func (s *Service) Initialize() error

func (*Service) PageRecord added in v0.0.7

func (s *Service) PageRecord(num, size int, record *Record) (*database.Pager[*Record], error)

func (*Service) PageScript

func (s *Service) PageScript(num, size int, script *Script) (*database.Pager[*Script], error)

func (*Service) RunScriptOnHosts added in v0.0.7

func (s *Service) RunScriptOnHosts(rsp *RunScriptParams) error

func (*Service) StopScript added in v0.0.7

func (s *Service) StopScript(id uuid.UUID) error

func (*Service) UpdateScript

func (s *Service) UpdateScript(script *Script) error

type Task added in v0.0.7

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

func NewTask added in v0.0.7

func NewTask() *Task

func (*Task) Run added in v0.0.7

func (t *Task) Run()

func (*Task) SetParams added in v0.0.7

func (t *Task) SetParams(params string)

type TaskParams added in v0.0.7

type TaskParams struct {
	Script *Script
	Hosts  []*api.HostInfo
	Params string
}

Jump to

Keyboard shortcuts

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