modules

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Modules = make(map[string]Moduler)

Modules module manager map

Functions

func ModuleRegister

func ModuleRegister(name string, module Moduler) error

ModuleRegister register module

Types

type Copy

type Copy struct {
	Src  string      `json:"src" yaml:"src"`
	Dest string      `json:"dest" yaml:"dest"`
	Mode os.FileMode `json:"mode" yaml:"mode"`
}

Copy copies files to remote locations

func NewCopy

func NewCopy() *Copy

NewCopy init copy

func (*Copy) Close

func (s *Copy) Close(endpoint *ssh.Endpoint) error

Close endpoint

func (*Copy) Name

func (s *Copy) Name() string

Name name

func (*Copy) Parse

func (s *Copy) Parse(cmd string) error

Parse parse

func (*Copy) Run

func (s *Copy) Run(ctx context.Context, endpoint *ssh.Endpoint) ([]byte, error)

Run run

type Fetch

type Fetch struct {
	Src  string `json:"src" yaml:"src"`
	Dest string `json:"dest" yaml:"dest"`
}

Fetch fetch - Fetches a file from remote nodes

func (*Fetch) Close

func (s *Fetch) Close(endpoint *ssh.Endpoint) error

Close endpoint

func (*Fetch) Name

func (s *Fetch) Name() string

Name name

func (*Fetch) Parse

func (s *Fetch) Parse(cmd string) error

Parse parse

func (*Fetch) Run

func (s *Fetch) Run(ctx context.Context, endpoint *ssh.Endpoint) ([]byte, error)

Run run

type Moduler

type Moduler interface {
	Name() string
	Parse(command string) error
	Run(ctx context.Context, endpoint *ssh.Endpoint) ([]byte, error)
	Close(endpoint *ssh.Endpoint) error
}

Moduler module interface

type Script

type Script struct {
	Path string `json:"path" yaml:"path"`
}

Script script module

func (*Script) Close

func (s *Script) Close(endpoint *ssh.Endpoint) error

Close endpoint

func (*Script) Name

func (s *Script) Name() string

Name name

func (*Script) Parse

func (s *Script) Parse(cmd string) error

Parse parse

func (*Script) Run

func (s *Script) Run(ctx context.Context, endpoint *ssh.Endpoint) ([]byte, error)

Run run module

type Shell

type Shell struct {
	Command string `json:"command" yaml:"commad"`
}

Shell Execute commands in nodes.

func (*Shell) Close

func (s *Shell) Close(endpoint *ssh.Endpoint) error

Close endpoint

func (*Shell) Name

func (s *Shell) Name() string

Name name

func (*Shell) Parse

func (s *Shell) Parse(cmd string) error

Parse parse

func (*Shell) Run

func (s *Shell) Run(ctx context.Context, endpoint *ssh.Endpoint) ([]byte, error)

Run run module

Jump to

Keyboard shortcuts

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