Documentation ¶
Index ¶
- Variables
- func CheckIfDirEmpty(dirname string) (rerr error)
- func CheckRequiredSettings(requiredArgs []string) error
- func CopyFileContents(dst, src string) (rerr error)
- func CreateMSWorkingDirectory(uid string, scratchDir string) (*os.File, error)
- func CreateMetricSample(exportDirectory os.File, uid string, cleanUp bool, scratchDir string) (*os.File, error)
- func IsValidURL(toTest string) bool
- func MatchOneFile(directory string, pattern string) (fileName string, err error)
- func SafeClose(closer func() error, err *error)
- func SetupLogger() (err error)
- func TestHTTPConnection(testClient rest.HTTPClient, URL, method, bearerToken string, retries uint, ...) (successful bool, body *[]byte, err error)
- func ValidateScratchDir(scratchDir string) error
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyDataDir = errors.New("empty data directory")
ErrEmptyDataDir error to indicate the data directory is empty
Functions ¶
func CheckIfDirEmpty ¶
CheckIfDirEmpty checks if a directory is empty, returning an ErrEmptyDataDir error if it is
func CheckRequiredSettings ¶
CheckRequiredSettings checks for required min values / flags / environment variables
func CopyFileContents ¶
CopyFileContents copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file.
func CreateMSWorkingDirectory ¶
CreateMSWorkingDirectory takes a given prefix and returns a metric sample working directory
func CreateMetricSample ¶
func CreateMetricSample(exportDirectory os.File, uid string, cleanUp bool, scratchDir string) (*os.File, error)
CreateMetricSample creates a metric sample from a given directory removing the source directory if cleanup is true
func IsValidURL ¶
IsValidURL returns true if string is a valid URL
func MatchOneFile ¶
MatchOneFile returns the name of one file based on a given directory and pattern returning an error if more or less than one match is found. The syntax of patterns is the same as in filepath.Glob & Match.
func SafeClose ¶
SafeClose will close the given closer function, setting the err ONLY if it is currently nil. This allows for cleaner handling of always-closing, but retaining the original error (ie from a previous Write).
func SetupLogger ¶
func SetupLogger() (err error)
SetupLogger sets configuration for the default logger
func TestHTTPConnection ¶
func TestHTTPConnection(testClient rest.HTTPClient, URL, method, bearerToken string, retries uint, verbose bool) (successful bool, body *[]byte, err error)
TestHTTPConnection takes a given client / URL(string) / bearerToken(string)/ retries count (int) and returns true if response code is 2xx.
func ValidateScratchDir ¶
ValidateScratchDir validates whether or not the scratch directory exists or not
Types ¶
This section is empty.