distribute

package
v0.0.0-...-815c261 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckingCloudInstance

func CheckingCloudInstance(opt libs.Options)

func ClearAllInstances

func ClearAllInstances(opt libs.Options)

func CommandBuilder

func CommandBuilder(options libs.Options) string

CommandBuilder build core command from API

func InitCloud

func InitCloud(options libs.Options, targets []string)

InitCloud init cloud runner obj

func InitCloudSetup

func InitCloudSetup(opt libs.Options)

func PrepareTarget

func PrepareTarget(target string, options libs.Options) string

PrepareTarget change the target file destination

func StringPrompt

func StringPrompt(label string, alt string) string

StringPrompt asks for a string value using the label

Types

type Client

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

func Dial

func Dial(network, addr string, config *ssh.ClientConfig) (*Client, error)

Dial starts a client connection to the given SSH server. This is wrap the ssh.Dial

func DialWithKey

func DialWithKey(addr, user, keyfile string) (*Client, error)

DialWithKey starts a client connection to the given SSH server with key authmethod.

func DialWithKeyString

func DialWithKeyString(addr, user, keyContent string) (*Client, error)

DialWithKeyString starts a client connection to the given SSH server with key authmethod.

func DialWithKeyWithPassphrase

func DialWithKeyWithPassphrase(addr, user, keyfile string, passphrase string) (*Client, error)

DialWithKeyWithPassphrase same as DialWithKey but with a passphrase to decrypt the private key

func DialWithPasswd

func DialWithPasswd(addr, user, passwd string) (*Client, error)

DialWithPasswd starts a client connection to the given SSH server with passwd authmethod.

func (*Client) Close

func (c *Client) Close() error

func (*Client) Cmd

func (c *Client) Cmd(cmd string) *remoteScript

Cmd create a command on client

func (*Client) Script

func (c *Client) Script(script string) *remoteScript

Script

func (*Client) ScriptFile

func (c *Client) ScriptFile(fname string) *remoteScript

ScriptFile

func (*Client) Shell

func (c *Client) Shell() *remoteShell

Shell create a noninteractive shell on client.

func (*Client) Terminal

func (c *Client) Terminal(config *TerminalConfig) *remoteShell

Terminal create a interactive shell on client.

type CloudRunner

type CloudRunner struct {
	Opt      libs.Options `json:"-"`
	Provider provider.Provider

	// for storing in local DB
	TaskName     string `json:"task_name"`
	TaskType     string `json:"task_type"`
	Input        string `json:"input"`
	RawCommand   string `json:"raw_command"`
	InstanceFile string `json:"instance_file"`

	// core entry point
	PublicIP      string `json:"public_ip"`
	DestInstance  string `json:"dest_instance"`
	SshPublicKey  string `json:"ssh_public_key"`
	SshPrivateKey string
	SSHUser       string
	BasePath      string

	InstanceID   string `json:"instance_id"`
	InstanceName string `json:"instance_name"`
	IsError      bool   `json:"is_error"`

	Target map[string]string `json:"-"`
	Runner core.Runner       `json:"-"`
}

func GetAllInstances

func GetAllInstances(opt libs.Options) (instances []CloudRunner)

func GetClouds

func GetClouds(options libs.Options) []CloudRunner

GetClouds prepare clouds object in config file

func SetupProvider

func SetupProvider(opt libs.Options, providerConfig provider.ConfigProvider) CloudRunner

SetupProvider setup new provider

func ValidateProvider

func ValidateProvider(opt libs.Options, providerConfig provider.ConfigProvider) (CloudRunner, error)

ValidateProvider setup new provider

func (*CloudRunner) CheckingDone

func (c *CloudRunner) CheckingDone() error

func (*CloudRunner) CloudMoreParams

func (c *CloudRunner) CloudMoreParams()

func (*CloudRunner) CopyTarget

func (c *CloudRunner) CopyTarget() error

func (*CloudRunner) CopyWorkflow

func (c *CloudRunner) CopyWorkflow() error

func (*CloudRunner) CreateInstance

func (c *CloudRunner) CreateInstance(target string) error

func (*CloudRunner) CreateUIReport

func (c *CloudRunner) CreateUIReport()

func (*CloudRunner) DBNewTarget

func (c *CloudRunner) DBNewTarget()

func (*CloudRunner) DBRuntimeUpdate

func (c *CloudRunner) DBRuntimeUpdate()

func (*CloudRunner) DeleteInstanceConfig

func (c *CloudRunner) DeleteInstanceConfig()

func (*CloudRunner) ErrorWriteInstanceConfig

func (c *CloudRunner) ErrorWriteInstanceConfig() error

func (*CloudRunner) HealthCheck

func (c *CloudRunner) HealthCheck() bool

func (*CloudRunner) InitSSHClient

func (c *CloudRunner) InitSSHClient() (*Client, error)

func (*CloudRunner) IsPanic

func (c *CloudRunner) IsPanic() bool

IsPanic checking if cloud instance has any panic error

func (*CloudRunner) IsRunning

func (c *CloudRunner) IsRunning() bool

IsRunning checking if cloud instance is running or not

func (*CloudRunner) PostRunLocal

func (c *CloudRunner) PostRunLocal() error

func (*CloudRunner) PreRunLocal

func (c *CloudRunner) PreRunLocal() error

func (*CloudRunner) PreRunRemote

func (c *CloudRunner) PreRunRemote() error

func (*CloudRunner) Prepare

func (c *CloudRunner) Prepare()

Prepare some variables

func (*CloudRunner) PrepareInput

func (c *CloudRunner) PrepareInput()

func (*CloudRunner) RetryCommand

func (c *CloudRunner) RetryCommand(cmd string, timeoutRaw ...string)

func (*CloudRunner) RetryCommandWithExcludeString

func (c *CloudRunner) RetryCommandWithExcludeString(cmd string, excludeString string, timeoutRaw ...string) string

func (*CloudRunner) RetryCommandWithExpectString

func (c *CloudRunner) RetryCommandWithExpectString(cmd string, expectString string, timeoutRaw ...string) string

func (*CloudRunner) RunScan

func (c *CloudRunner) RunScan() error

func (*CloudRunner) SSHExec

func (c *CloudRunner) SSHExec(command string) (string, error)

func (*CloudRunner) Scan

func (c *CloudRunner) Scan(target string) error

func (*CloudRunner) StartScan

func (c *CloudRunner) StartScan() error

func (*CloudRunner) SyncResult

func (c *CloudRunner) SyncResult() error

func (*CloudRunner) WriteInstanceConfig

func (c *CloudRunner) WriteInstanceConfig() error

type TerminalConfig

type TerminalConfig struct {
	Term   string
	Height int
	Weight int
	Modes  ssh.TerminalModes
}

Jump to

Keyboard shortcuts

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