utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2017 License: Apache-2.0 Imports: 19 Imported by: 22

Documentation

Index

Constants

View Source
const (
	STALE_LOCK_TIMEOUT = 600 //in seconds
)

Variables

This section is empty.

Functions

func CloseLogs

func CloseLogs(logFile *os.File)

func Exists

func Exists(path string) bool

func ExtractErrorResponse

func ExtractErrorResponse(response *http.Response) error

func ExtractVarsFromRequest

func ExtractVarsFromRequest(r *http.Request, varName string) string

func FormatURL

func FormatURL(url string, entries ...string) string

func GetPath

func GetPath(paths []string) string

func HttpExecute

func HttpExecute(httpClient *http.Client, logger *log.Logger, requestType string, requestURL string, rawPayload interface{}) (*http.Response, error)

func HttpExecuteUserAuth

func HttpExecuteUserAuth(httpClient *http.Client, logger *log.Logger, requestType string, requestURL string, user string, password string, rawPayload interface{}) (*http.Response, error)

func MarshalAndRecord

func MarshalAndRecord(object interface{}, dir string, fileName string) error

func MkDir

func MkDir(path string) error

func PathUnescape

func PathUnescape(s string) (string, error)

func PrintResponse

func PrintResponse(f resources.FlexVolumeResponse) error

func ReadAndUnmarshal

func ReadAndUnmarshal(object interface{}, dir string, fileName string) error

func ReadFile

func ReadFile(path string) (content []byte, err error)

func SetupConfigDirectory

func SetupConfigDirectory(logger *log.Logger, executor Executor, configPath string) (string, error)

func SetupLogger

func SetupLogger(logPath string, loggerName string) (*log.Logger, *os.File)

func StringInSlice

func StringInSlice(a string, list []string) bool

func Unmarshal

func Unmarshal(r *http.Request, object interface{}) error

func UnmarshalDataFromRequest

func UnmarshalDataFromRequest(r *http.Request, object interface{}) error

func UnmarshalResponse

func UnmarshalResponse(r *http.Response, object interface{}) error

func WriteFile

func WriteFile(path string, content []byte) error

func WriteResponse

func WriteResponse(w http.ResponseWriter, code int, object interface{})

Types

type EscapeError

type EscapeError string

func (EscapeError) Error

func (e EscapeError) Error() string

type Executor

type Executor interface {
	Execute(command string, args []string) ([]byte, error)
	Stat(string) (os.FileInfo, error)
	Mkdir(string, os.FileMode) error
	MkdirAll(string, os.FileMode) error
	RemoveAll(string) error
	Hostname() (string, error)
	IsExecutable(string) error
}

func NewExecutor

func NewExecutor() Executor

type Heartbeat

type Heartbeat interface {
	Exists() (bool, error)
	Create() error
	Update() error
	GetLastUpdateTimestamp() (time.Time, error)
}

func NewHeartbeat

func NewHeartbeat(log *log.Logger, mountpoint string) Heartbeat

type InvalidHostError

type InvalidHostError string

func (InvalidHostError) Error

func (e InvalidHostError) Error() string

type Locker

type Locker interface {
	WriteLock(name string)
	WriteUnlock(name string)
	ReadLock(name string)
	ReadUnlock(name string)
}

func NewLocker

func NewLocker() Locker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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