scp

package
v0.0.0-...-141d866 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingSource is a returned when the plugin is missing the source parameter.
	ErrMissingSource = errors.New("missing source parameter")

	// ErrMissingTarget is a returned when the plugin is missing the target parameter.
	ErrMissingTarget = errors.New("missing target parameter")
)

Functions

This section is empty.

Types

type Config

type Config struct {

	// Source is a required parameter containing all of the source
	// files to be copied from the local or remote file systems to
	// the Target destination.
	Source []string

	// Target is the final destination (local or remote) for the
	// Source files above to be placed.
	Target string

	// IdentityFilePath is the path to the identity file to use
	// for authenticating against remote systems. You can specify
	// multiple files to use each one in turn if needed.
	IdentityFilePath []string

	// IdentityFileContents is a string representation of an identity
	// file. This is used since the plugin needs to consume secrets
	// and those sometimes come through as environmental variables
	// so we'll need to take the raw contents and place them into a file
	// so that the binaries later can use them.
	IdentityFileContents string

	// SCPFlags is for setting or overriding any sort of scp features.
	SCPFlags []string

	// SSHPassword is used for authenticating against systems with a password
	// instead of an identity file. Since this is passed to sshpass it's
	// limited to only one password for whatever remote systems are in use.
	// Prefer to use identity files if possible since you can specify quite a bit more.
	SSHPassword string

	// SSHPassphrase is used for the identity files specified. Just like with SSHPassword
	// this is handed off to sshpass to use in authentication and it only supports
	// one parameter, so this passphrase needs to be viable for all identity files
	// that contain a passphrase. If needing multiple identity files be sure
	// they all use the same passphrase for the remote systems.
	SSHPassphrase string

	// SSHPASSFlags is for setting or overriding any sort of sshpass features.
	SSHPASSFlags []string
	// contains filtered or unexported fields
}

func (*Config) Arguments

func (c *Config) Arguments() []string

Arguments returns a string slice representation of all of the command line arguments required for the binary to work. If using sshpass parameters they will be placed at the start of the slice while all others float to the end. Think of these as the commands a user would normally manually type to use the binary.

func (*Config) Binary

func (c *Config) Binary() string

Binary returns the system path location for either the scp binary (by default) or the sshpass binary depending on if the plugin configuration requires the use of sshpass or not.

func (*Config) Environment

func (c *Config) Environment() map[string]string

Environment returns a mapping of key/value strings representing any additional environmental variables a particular plugin might need. This plugin doesn't require anything in particular, but a few env vars are provided so that users can place that in their pipeline for diagnostic purposes.

func (*Config) Setup

func (c *Config) Setup() error

Setup will make sure all of the internal configuration of the plugin is set and ready to go along with any sorts of file system side effects and preparations are done.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks some basic plugin configuration parameters to ensure everything is set that we need or expect and that and sort of conflicting parameters are sorted appropriately. Note that we're really not validating that the format of the parameters is correct since we'll just rely on surfacing those errors by using the binary itself. Why duplicate that validation logic when the binaries can do that for us?

Jump to

Keyboard shortcuts

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