common

package
v0.0.0-...-1c351ce Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyToDir

func CopyToDir(src string, destDir string) error

CopyToDir src path to dest path

func CreateDir

func CreateDir(baseDir string, requestedDir string) error

CreateDir Create directories if needed

func CreateTmpDir

func CreateTmpDir() (string, error)

CreateTmpDir wrapper around ioutil since i am lazy

func DownloadFromURL

func DownloadFromURL(url string, downloadPath string) error

DownloadFromURL download a file from a url

func GetCWD

func GetCWD() string

GetCWD return curret working directory

func Info

func Info(prefix string, info string)

Info print info with a prefix

func InfoPrint

func InfoPrint(info string)

InfoPrint print an info message

func IsDir

func IsDir(dirPath string) (bool, error)

IsDir return true if dirPath is a directory

func MatrixPrint

func MatrixPrint(headers []string, items [][]string)

MatrixPrint Prints a matrix

func ParseJSON

func ParseJSON(jsonString string, query string) (string, error)

ParseJSON query with JQ compatible language a JSON string

func PathExists

func PathExists(path string) bool

PathExists check if file or path does not exists

func ReadFile

func ReadFile(fileName string) ([]byte, error)

ReadFile return content of a file as bytes

func RmDir

func RmDir(dir string) error

RmDir Removes a dir content and a dir

func Sha2sumFile

func Sha2sumFile(filePath string) (string, error)

Sha2sumFile return a sha2sum of a file

func WriteFile

func WriteFile(fileName string, data []byte, fileMode os.FileMode) error

WriteFile write an array of bytes to fileName

Types

type BoshJSONOutput

type BoshJSONOutput struct {
	Tables []struct {
		Content string `json:"Content"`
		Header  struct {
			Az           string `json:"az"`
			Instance     string `json:"instance"`
			Ips          string `json:"ips"`
			ProcessState string `json:"process_state"`
		} `json:"Header"`
		Rows []struct {
			Az           string `json:"az"`
			Instance     string `json:"instance"`
			Ips          string `json:"ips"`
			ProcessState string `json:"process_state"`
		} `json:"Rows"`
		Notes interface{} `json:"Notes"`
	} `json:"Tables"`
	Blocks interface{} `json:"Blocks"`
	Lines  []string    `json:"Lines"`
}

BoshJSONOutput represents a bosh outpit with --env json

Jump to

Keyboard shortcuts

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