operation

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: GPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	OpTypeShell = "shell"
	OpTypeCopy  = "copy"
	OpTypeLocal = "local"
)

Variables

View Source
var (
	ErrInvalidOperation = errors.New("invalid operation")
	ErrInvalidOpType    = errors.New("invalid operation type")
)

Functions

func MakeErrInvalidOperation

func MakeErrInvalidOperation(in Input) error

Types

type Input

type Input struct {
	Name string `yaml:"name"`
	Role string `yaml:"role"`
	Type string `yaml:"type"`

	Shell string `yaml:"shell"`
	Local string `yaml:"local"`

	Copy   string `yaml:"copy"`
	To     string `yaml:"to"`
	Backup bool   `yaml:"backup"`
}

type OpCopy

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

OpCopy copies files or directories to remote hosts via SFTP.

func NewOpCopy

func NewOpCopy(in Input) (*OpCopy, error)

NewOpCopy creates a new OpCopy operation from the given Input. Returns ErrInvalidOperation if the To field is empty.

func (OpCopy) DefaultName added in v0.0.13

func (op OpCopy) DefaultName() string

DefaultName returns the default name for copy operations.

func (OpCopy) Execute

func (op OpCopy) Execute(r *remote.Remote) (*gtypes.OrderedMap[string, string], error)

Execute uploads the local file or directory to the remote host.

func (OpCopy) Name

func (op OpCopy) Name() string

Name returns the operation's name.

func (OpCopy) Role

func (op OpCopy) Role() string

Role returns the operation's target role.

func (*OpCopy) SetName

func (op *OpCopy) SetName(name string)

SetName sets the operation's name.

func (*OpCopy) SetRole

func (op *OpCopy) SetRole(role string)

SetRole sets the operation's target role.

type OpLocal added in v0.0.22

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

func NewOpLocal added in v0.0.22

func NewOpLocal(in Input) (*OpLocal, error)

func (OpLocal) DefaultName added in v0.0.22

func (op OpLocal) DefaultName() string

func (OpLocal) Execute added in v0.0.22

func (op OpLocal) Execute(r *remote.Remote) (*gtypes.OrderedMap[string, string], error)

func (OpLocal) Name added in v0.0.22

func (op OpLocal) Name() string

Name returns the operation's name.

func (OpLocal) Role added in v0.0.22

func (op OpLocal) Role() string

Role returns the operation's target role.

func (*OpLocal) SetName added in v0.0.22

func (op *OpLocal) SetName(name string)

SetName sets the operation's name.

func (*OpLocal) SetPrefix added in v0.0.22

func (op *OpLocal) SetPrefix(prefix string)

func (*OpLocal) SetRole added in v0.0.22

func (op *OpLocal) SetRole(role string)

SetRole sets the operation's target role.

type OpShell

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

OpShell executes shell commands on remote hosts.

func NewOpShell

func NewOpShell(in Input) (*OpShell, error)

NewOpShell creates a new OpShell operation from the given Input. Returns ErrInvalidOperation if Shell field is empty.

func (OpShell) DefaultName added in v0.0.13

func (op OpShell) DefaultName() string

DefaultName returns the default name for shell operations.

func (OpShell) Execute

func (op OpShell) Execute(r *remote.Remote) (*gtypes.OrderedMap[string, string], error)

Execute runs the shell command on the remote host and returns the results.

func (OpShell) Name

func (op OpShell) Name() string

Name returns the operation's name.

func (OpShell) Role

func (op OpShell) Role() string

Role returns the operation's target role.

func (*OpShell) SetName

func (op *OpShell) SetName(name string)

SetName sets the operation's name.

func (*OpShell) SetRole

func (op *OpShell) SetRole(role string)

SetRole sets the operation's target role.

type Operation

type Operation interface {
	Execute(r *remote.Remote) (*gtypes.OrderedMap[string, string], error)
	DefaultName() string
	// contains filtered or unexported methods
}

func GetOperation

func GetOperation(in Input) (Operation, error)

Jump to

Keyboard shortcuts

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