Documentation ¶
Index ¶
- func ConvertArrayOfIntToString(lun_ids []int32) string
- func CopyFile(src, dst string) (err error)
- func CreateDirIfNotExists(dirPath string, perm os.FileMode) error
- func DecodeBase64Credential(b64data string) (string, error)
- func ExecCommandOutput(cmd string, args []string) (string, int, error)
- func ExecCommandOutputWithStdinArgs(cmd string, args []string, stdInArgs []string) (string, int, error)
- func ExecCommandOutputWithTimeout(cmd string, args []string, timeout int) (string, int, error)
- func FileCheck(e error)
- func FileDelete(path string) error
- func FileExists(path string) (exists bool, dir bool, err error)
- func FileGetStrings(path string) (line []string, err error)
- func FileGetStringsWithPattern(path string, pattern string) (filelines []string, err error)
- func FileReadFirstLine(path string) (line string, er error)
- func FileSaveGob(path string, object interface{}) error
- func FileWriteString(path, line string) (err error)
- func FileWriteStrings(path string, lines []string) (err error)
- func FileloadGob(path string, object interface{}) error
- func FindStringSubmatchMap(s string, r *regexp.Regexp) map[string]string
- func GetMD5HashOfTwoStrings(string1, string2 string) string
- func GetNltHome() (installDir string)
- func GetSecondaryArrayDiscoveryIps(details string) []string
- func GetSecondaryArrayLUNIds(details string) []int32
- func GetSecondaryArrayTargetNames(details string) []string
- func GetSecondaryBackends(details string) []*model.SecondaryLunInfo
- func GetVolumeObject(serialNumber, lunID string) *model.Volume
- func InitializeRouter(router *mux.Router, routes []Route) (err error)
- func IsFileSymlink(path string) (exists bool, symlink bool, err error)
- func ToCamelCase(str string) string
- func ToSnakeCase(str string) string
- type FileWatch
- type Route
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertArrayOfIntToString ¶
ConvertArrayOfIntToString converts a given list of integer to comma separated string value
func CopyFile ¶
CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.
func CreateDirIfNotExists ¶
CreateDirIfNotExists to create a directory if it is not already available
func DecodeBase64Credential ¶
DecodeBase64Credential to plain text if its b64 encoded, else return the data as-is.
func ExecCommandOutput ¶
ExecCommandOutput returns stdout and stderr in a single string, the return code, and error. If the return code is not zero, error will not be nil. Stdout and Stderr are dumped to the log at the debug level. Return code of 999 indicates an error starting the command.
func ExecCommandOutputWithStdinArgs ¶
func ExecCommandOutputWithStdinArgs(cmd string, args []string, stdInArgs []string) (string, int, error)
ExecCommandOutputWithStdinArgs returns stdout and stderr in a single string, the return code, and error. If the return code is not zero, error will not be nil. Stdout and Stderr are dumped to the log at the debug level. Return code of 999 indicates an error starting the command.
func ExecCommandOutputWithTimeout ¶
ExecCommandOutputWithTimeout executes ExecCommandOutput with the specified timeout
func FileExists ¶
FileExists does a stat on the path and returns true if it exists In addition, dir returns true if the path is a directory
func FileGetStrings ¶
FileGetStrings : get the file contents as array of string
func FileGetStringsWithPattern ¶
FileGetStringsWithPattern : get the filecontents as array of string matching pattern pattern
func FileReadFirstLine ¶
FileReadFirstLine read first line from a file TODO: make it OS independent
func FileSaveGob ¶
FileSaveGob : save the Gob file
func FileWriteString ¶
FileWriteString : write line to the path
func FileWriteStrings ¶
FileWriteStrings writes all lines to file specified by path. Newline is appended to each line
func FileloadGob ¶
FileloadGob : Load and Decode Gob file
func FindStringSubmatchMap ¶
FindStringSubmatchMap : find and build the map of named groups
func GetMD5HashOfTwoStrings ¶
func GetNltHome ¶
func GetNltHome() (installDir string)
GetNltHome returns base install directory of NLT or HPE cloud toolkits
func GetSecondaryArrayLUNIds ¶
func GetSecondaryBackends ¶
func GetSecondaryBackends(details string) []*model.SecondaryLunInfo
func GetVolumeObject ¶
func InitializeRouter ¶
InitializeRouter initializes all handlers
func IsFileSymlink ¶
IsFileSymlink to check if the path exists and if it's a symlink
func ToCamelCase ¶
ToCamelCase converts the given snake_case string to camelCase
func ToSnakeCase ¶
ToSnakeCase converts the given camelCase string into snake_case
Types ¶
type FileWatch ¶
type FileWatch struct {
// contains filtered or unexported fields
}
FileWatch contains watcher attributes.
func InitializeWatcher ¶
InitializeWatcher is used to initialize fileWatch with anonymous function and new watcher. It regularly monitors os signals like SIGTERM,SIGHUP etc in a separate thread for graceful exit of the watcher.
func (*FileWatch) AddWatchList ¶
AddWatchList list of files /and directories to watch
func (*FileWatch) StartWatcher ¶
func (w *FileWatch) StartWatcher()
StartWatcher triggers watcher until os sig interrupt. This will run anonymous fn forever.