hosts

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address          string   `yaml:"address" validate:"required,hostname|ip"`
	User             string   `yaml:"user"`
	SSHPort          int      `yaml:"sshPort" validate:"gt=0,lte=65535"`
	SSHKeyPath       string   `yaml:"sshKeyPath" validate:"file"`
	Role             string   `yaml:"role" validate:"oneof=master worker"`
	ExtraArgs        []string `yaml:"extraArgs"`
	PrivateInterface string   `validate:"omitempty,gt=2"`
}

Config for host

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals yaml

type Host

type Host struct {
	Config

	Metadata *HostMetadata
	// contains filtered or unexported fields
}

Host describes connectable host

func (*Host) Connect

func (h *Host) Connect() error

Connect to the host

func (*Host) CopyFile added in v0.2.0

func (h *Host) CopyFile(file os.File, remotePath string, permissions string) error

CopyFile copies a local file to host

func (*Host) Disconnect

func (h *Host) Disconnect() error

Disconnect from the host

func (*Host) Exec

func (h *Host) Exec(cmd string) error

Exec a command on the host

func (*Host) ExecWithOutput

func (h *Host) ExecWithOutput(cmd string) (string, error)

ExecWithOutput execs a command on the host and return output

func (*Host) FullAddress added in v0.2.0

func (h *Host) FullAddress() string

FullAddress returns address and non-standard ssh port

type HostMetadata added in v0.2.0

type HostMetadata struct {
	Hostname        string
	InternalAddress string
}

HostMetadata resolved metadata for host

type Hosts

type Hosts []*Host

Hosts array of hosts

type RemoteHost

type RemoteHost interface {
	Connect() error
	Disconnect() error
}

Jump to

Keyboard shortcuts

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