connector

package
v4.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector interface {
	// Init initializes the connection
	Init(ctx context.Context) error
	// Close closes the connection
	Close(ctx context.Context) error
	// PutFile copies a file from src to dst with mode.
	PutFile(ctx context.Context, src []byte, dst string, mode fs.FileMode) error
	// FetchFile copies a file from src to dst writer.
	FetchFile(ctx context.Context, src string, dst io.Writer) error
	// ExecuteCommand executes a command on the remote host
	ExecuteCommand(ctx context.Context, cmd string) ([]byte, error)
}

Connector is the interface for connecting to a remote host

func NewConnector

func NewConnector(host string, connectorVars map[string]any) (Connector, error)

NewConnector creates a new connector if set connector to "local", use local connector if set connector to "ssh", use ssh connector if set connector to "kubernetes", use kubernetes connector if connector is not set. when host is localhost, use local connector, else use ssh connector vars contains all inventory for host. It's best to define the connector info in inventory file.

type GatherFacts

type GatherFacts interface {
	HostInfo(ctx context.Context) (map[string]any, error)
}

GatherFacts get host info.

Jump to

Keyboard shortcuts

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