Help us shape the future of Go! Take the 2026 Go Developer Survey

script

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 21 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

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

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

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

func (*Record) TableName

func (r *Record) TableName() string

type RunScriptParams

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

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

func (*Service) GetScriptFile

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

func (*Service) Initialize

func (s *Service) Initialize() error

func (*Service) PageRecord

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

func (*Service) PageScript

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

func (*Service) RunScriptOnHosts

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

func (*Service) StopScript

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

func (*Service) UpdateScript

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

type Task

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

func NewTask

func NewTask() *Task

func (*Task) Run

func (t *Task) Run()

func (*Task) SetParams

func (t *Task) SetParams(params string)

type TaskParams

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