utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunCommand

func RunCommand(binary string, args ...string) (*exec.Cmd, string, error)

RunCommand runs the specified command with arguments and returns the output and the error if any.

func Try

func Try(timeout time.Duration, operation func() error) error

Try try operation timeout, and retry backoff

func TryRequest

func TryRequest(url string, timeout time.Duration, condition Condition) error

TryRequest try operation timeout, and retry backoff

Types

type Condition

type Condition func(*http.Response) error

Condition is a retry condition function. It receives a response, and returns an error if the response failed the condition.

func ErrorIfStatusCodeIsNot

func ErrorIfStatusCodeIsNot(status int) Condition

ErrorIfStatusCodeIsNot returns a retry condition function. The condition returns an error if the given response's status code is not the given HTTP status code.

Jump to

Keyboard shortcuts

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