ssh

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AuthMethodPassword = "password"
View Source
const AuthMethodSSHKey = "ssh_key"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthSpec

type AuthSpec struct {
	Method     string       `json:"authMethod" mapstructure:"authMethod"`
	PrivateKey SecretKeyRef `json:"privateKey" mapstructure:"privateKey"`
	Passphrase SecretKeyRef `json:"passphrase" mapstructure:"passphrase"`
	Password   SecretKeyRef `json:"password" mapstructure:"password"`
}

AuthSpec is the authentication config group (SSH key or password, credential references).

type Client

type Client struct {
	Host     string
	Port     int
	Username string

	// For key auth
	PrivateKey []byte
	Passphrase []byte

	// For password auth
	Password []byte
	// contains filtered or unexported fields
}

Client connects to an SSH server and runs commands. Supports either SSH key or password authentication.

func NewClientKey

func NewClientKey(host string, port int, username string, privateKey, passphrase []byte) *Client

NewClient builds a client for key-based auth.

func NewClientPassword

func NewClientPassword(host string, port int, username string, password []byte) *Client

NewClientPassword builds a client for password auth.

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect() (*ssh.Client, error)

func (*Client) ExecuteCommand

func (c *Client) ExecuteCommand(command string, timeout time.Duration) (*CommandResult, error)

type CommandResult

type CommandResult struct {
	Stdout   string `json:"stdout"`
	Stderr   string `json:"stderr"`
	ExitCode int    `json:"exitCode"`
}

CommandResult holds the result of a single command execution.

type ExecutionMetadata

type ExecutionMetadata struct {
	Result *CommandResult `json:"result" mapstructure:"result"`
}

type SSHCommand

type SSHCommand struct{}

func (*SSHCommand) Actions

func (c *SSHCommand) Actions() []core.Action

func (*SSHCommand) Cancel

func (c *SSHCommand) Cancel(ctx core.ExecutionContext) error

func (*SSHCommand) Cleanup

func (c *SSHCommand) Cleanup(ctx core.SetupContext) error

func (*SSHCommand) Color

func (c *SSHCommand) Color() string

func (*SSHCommand) Configuration

func (c *SSHCommand) Configuration() []configuration.Field

func (*SSHCommand) Description

func (c *SSHCommand) Description() string

func (*SSHCommand) Documentation

func (c *SSHCommand) Documentation() string

func (*SSHCommand) ExampleOutput

func (c *SSHCommand) ExampleOutput() map[string]any

func (*SSHCommand) Execute

func (c *SSHCommand) Execute(ctx core.ExecutionContext) error

func (*SSHCommand) HandleAction

func (c *SSHCommand) HandleAction(ctx core.ActionContext) error

func (*SSHCommand) HandleWebhook

func (c *SSHCommand) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*SSHCommand) Icon

func (c *SSHCommand) Icon() string

func (*SSHCommand) Label

func (c *SSHCommand) Label() string

func (*SSHCommand) Name

func (c *SSHCommand) Name() string

func (*SSHCommand) OutputChannels

func (c *SSHCommand) OutputChannels(configuration any) []core.OutputChannel

func (*SSHCommand) ProcessQueueItem

func (c *SSHCommand) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*SSHCommand) Setup

func (c *SSHCommand) Setup(ctx core.SetupContext) error

type SecretKeyRef

type SecretKeyRef struct {
	Secret string `json:"secret" mapstructure:"secret"`
	Key    string `json:"key" mapstructure:"key"`
}

SecretKeyRef is stored in YAML as: { secret: "name", key: "keyName" }.

func (SecretKeyRef) IsSet

func (r SecretKeyRef) IsSet() bool

type Spec

type Spec struct {
	Host             string   `json:"host" mapstructure:"host"`
	Port             int      `json:"port" mapstructure:"port"`
	User             string   `json:"username" mapstructure:"username"`
	Authentication   AuthSpec `json:"authentication" mapstructure:"authentication"`
	Command          string   `json:"command" mapstructure:"command"`
	WorkingDirectory string   `json:"workingDirectory,omitempty" mapstructure:"workingDirectory"`
	Timeout          int      `json:"timeout" mapstructure:"timeout"` // command timeout in seconds (default 60)
}

Jump to

Keyboard shortcuts

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