client

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package client provides functionality so that other uses of sansshell can provide their own main.go without having to cargo-cult everything across for common use cases. i.e. adding additional modules that are locally defined.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, rs RunState)

Run takes the given context and RunState and executes the command passed in after parsing with flags. As this is intended to be called from main() it doesn't return errors and will instead exit on any errors.

Types

type RunState added in v1.0.2

type RunState struct {
	// Proxy is an optional proxy server to route requests.
	Proxy string
	// Targets is a list of remote targets to use when a proxy
	// is in use. For non proxy must be 1 entry.
	Targets []string
	// Outputs must map 1:1 with Targets indicating where to emit
	// output from commands. If the list is empty or a single entry
	// set to - then stdout/stderr will be used for all outputs.
	Outputs []string
	// OutputsDir defines a directory to place outputs instead of
	// specifying then in Outputs. The files will be names 0.output,
	// 1.output and .error respectively for each target.
	OutputsDir string
	// CredSource is a registered credential source with the mtls package.
	CredSource string
	// Timeout is the duration to place on the context when making RPC calls.
	Timeout time.Duration
	// ClientPolicy is an optional OPA policy for determining outbound decisions.
	ClientPolicy string
	// PrefixOutput if true will prefix every line of output with '<index>-<target>: '
	PrefixOutput bool
}

RunState encapsulates all of the variable state needed to run a sansssh command.

Jump to

Keyboard shortcuts

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