jobmgr

package
v0.0.0-...-ac666ac Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credential

type Credential struct {
	Passphrase string `json:"passphrase"`
	Password   string `json:"password"`
	SSHKeyfile string `json:"sshkeyfile"`
}

type I_Job

type I_Job interface {
	Execute(*websocket.Conn)
}

Define interface I_Job with only method Execute

type I_Machine

type I_Machine interface {
	GetDomain() string
	GetPort() string
	GetUsername() string
	GetMode() string
	GetSSHKeyfile() string
	GetPassphrase() string
	GetPassword() string
	GetSudoPassword() string
	GetAuthConf() (*ssh.ClientConfig, string, error)
}

type I_Mgr

type I_Mgr interface {
	SetConn(*websocket.Conn)
	ExecuteJob()
}

Define interface: I_Mgr for handling ssh job and websocket communication

type I_Task

type I_Task interface {
	Serialize() string
	GetTopic() string
}

Define interface: I_Task

type Job

type Job struct {
	Machine I_Machine
	Tasks   []I_Task
}

Implement I_Job

func (*Job) Execute

func (job *Job) Execute(conn *websocket.Conn)

Execute ssh job and communicate through websocket

func (*Job) GetSSH

func (job *Job) GetSSH() (*ssh.Session, *ssh.Client)

Get ssh session and ssh client

func (*Job) GetTaskCMD

func (job *Job) GetTaskCMD() string

Formalize cmd of tasks for ssh

type Machine

type Machine struct {
	Domain       string     `json:"domain"`
	Port         string     `json:"port"`
	Username     string     `json:"username"`
	Mode         string     `json:"mode"`
	Credential   Credential `json:"credential"`
	SudoPassword string     `json:"sudopassword"`
}

Define class: Machine implementing I_Machine

func (*Machine) GetAuthConf

func (m *Machine) GetAuthConf() (*ssh.ClientConfig, string, error)

Implement I_Machine.GetAutoConf() Get auth conf for ssh

func (*Machine) GetDomain

func (m *Machine) GetDomain() string

Implement I_Machine.GetDomain() Get machine domain name or ip

func (*Machine) GetMode

func (m *Machine) GetMode() string

Implement I_Machine.GetMode() Get approach of logging into machine: SSHKEY, USERPASS

func (*Machine) GetPassphrase

func (m *Machine) GetPassphrase() string

Implement I_Machine.GetPassphrase() Get passphrase

func (*Machine) GetPassword

func (m *Machine) GetPassword() string

Implement I_Machine.GetPassword() Get password

func (*Machine) GetPort

func (m *Machine) GetPort() string

Implement I_Machine.GetPort() Get ssh port

func (*Machine) GetSSHKeyfile

func (m *Machine) GetSSHKeyfile() string

Implement I_Machine.GetSSHKeyfile() Get ssh private key file

func (*Machine) GetSigner

func (m *Machine) GetSigner() (ssh.Signer, error)

func (*Machine) GetSudoPassword

func (m *Machine) GetSudoPassword() string

Implement I_Machine.GetSudoPassword() Get sudo password of user

func (*Machine) GetUsername

func (m *Machine) GetUsername() string

Implement I_Machine.GetUsername() Get username

type Mgr

type Mgr struct {
	Conn *websocket.Conn
	Job  I_Job
}

Implement I_Mgr

func (*Mgr) CreateJob

func (mgr *Mgr) CreateJob(jobData []byte) error

Create job from job description, which is defined as jobmgr.Job

func (*Mgr) ExecuteJob

func (mgr *Mgr) ExecuteJob()

Execute ssh job

func (*Mgr) SetConn

func (mgr *Mgr) SetConn(conn *websocket.Conn)

Set websocket connection

type Task

type Task struct {
	Topic string
	Tasks []string
}

Define class: Task implementing I_Task

func (*Task) GetTopic

func (t *Task) GetTopic() string

Get description of task

func (*Task) Serialize

func (t *Task) Serialize() string

Generate task executable command

type WindowSize

type WindowSize struct {
	Height int    `json:"height"`
	Width  int    `json:"width"`
	Type   string `json:"type"`
}

Jump to

Keyboard shortcuts

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