port

package
v0.0.0-...-215933a Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionCheck

type ConnectionCheck interface {
	CheckConnection(host string, port int) error
}

ConnectionCheck represents a connection checker

type Port

type Port struct {
	*resource.Status
	*wait.Retrier
	Host string
	Port int
	ConnectionCheck
}

Port represents a port check

func (*Port) Apply

func (p *Port) Apply() (resource.TaskStatus, error)

Apply retries the check until it passes or returns max failure threshold

func (*Port) Check

Check if the port is open

func (*Port) CheckConnection

func (p *Port) CheckConnection() error

CheckConnection attempts to see if a tcp port is open

type Preparer

type Preparer struct {
	// a host name or ip address. A TCP connection will be attempted at this host
	// and the specified Port.
	Host string `hcl:"host"`

	// the TCP port to attempt to connect to.
	Port int `hcl:"port" required:"true"`

	// the amount of time to wait in between checks. The format is Go's duration
	// string. A duration string is a possibly signed sequence of decimal numbers,
	// each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or
	// "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". If
	// the interval is not specified, it will default to 5 seconds.
	Interval string `hcl:"interval" doc_type:"duration string"`

	// the amount of time to wait before running the first check and after a
	// successful check. The format is Go's duration string. A duration string is
	// a possibly signed sequence of decimal numbers, each with optional fraction
	// and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units
	// are "ns", "us" (or "µs"), "ms", "s", "m", "h". If no grace period is
	// specified, no grace period will be taken into account.
	GracePeriod string `hcl:"grace_period" doc_type:"duration string"`

	// the maximum number of attempts before the wait fails. If the maximum number
	// of retries is not set, it will default to 5.
	MaxRetry int `hcl:"max_retry"`
}

Preparer handles wait.query tasks

func (*Preparer) Prepare

func (p *Preparer) Prepare(render resource.Renderer) (resource.Task, error)

Prepare creates a new wait.port type

type TCPConnectionCheck

type TCPConnectionCheck struct{}

TCPConnectionCheck impelements a ConnectionCheck over TCP

func (*TCPConnectionCheck) CheckConnection

func (t *TCPConnectionCheck) CheckConnection(host string, port int) error

CheckConnection attempts to see if a tcp port is open

Jump to

Keyboard shortcuts

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