Documentation ¶
Index ¶
- type FileInterface
- type Pf9FileIO
- func (f *Pf9FileIO) CopyFile(originalFile, duplicateFile string) error
- func (f *Pf9FileIO) DeleteFile(filename string) error
- func (f *Pf9FileIO) Extract(tgzFile string, destDir string) error
- func (f *Pf9FileIO) GenerateChecksum(imageDir string) error
- func (f *Pf9FileIO) GenerateHashForDir(imageDir string) ([]string, error)
- func (f *Pf9FileIO) GenerateHashForFile(fileName string) (string, error)
- func (f *Pf9FileIO) GetFileInfo(filename string) (os.FileInfo, error)
- func (f *Pf9FileIO) ListFiles(dirname string) ([]string, error)
- func (f *Pf9FileIO) ListFilesWithPatterns(root string, patterns []string) ([]string, error)
- func (f *Pf9FileIO) NewYamlFromTemplateYaml(templFile string, outFile string, data interface{}) error
- func (f *Pf9FileIO) ReadFile(filename string) ([]byte, error)
- func (f *Pf9FileIO) ReadFileByLine(filename string) ([]string, error)
- func (f *Pf9FileIO) ReadJSONFile(filename string, output interface{}) error
- func (f *Pf9FileIO) RenameAndMoveFile(originalFile, newFile string) error
- func (f *Pf9FileIO) TouchFile(filename string) error
- func (f *Pf9FileIO) VerifyChecksum(imageDir string) (bool, error)
- func (f *Pf9FileIO) WriteToFile(filename string, data interface{}, append bool) error
- func (f *Pf9FileIO) WriteToFileWithBase64Decoding(destFile string, srcFile string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileInterface ¶
type FileInterface interface { TouchFile(string) error GetFileInfo(string) (os.FileInfo, error) RenameAndMoveFile(string, string) error CopyFile(string, string) error DeleteFile(string) error ReadFile(string) ([]byte, error) ReadFileByLine(string) ([]string, error) WriteToFile(string, interface{}, bool) error ReadJSONFile(string, interface{}) error ListFiles(string) ([]string, error) GenerateChecksum(string) error VerifyChecksum(string) (bool, error) GenerateHashForDir(string) ([]string, error) GenerateHashForFile(string) (string, error) NewYamlFromTemplateYaml(string, string, interface{}) error ListFilesWithPatterns(string, []string) ([]string, error) WriteToFileWithBase64Decoding(string, string) error Extract(string, string) error }
FileInterface interface contains ways to R/W data From/To a file respectively
type Pf9FileIO ¶
type Pf9FileIO struct {
// contains filtered or unexported fields
}
Pf9FileIO : A Platform9 wrapper for doing file IO operations
func (*Pf9FileIO) DeleteFile ¶
DeleteFile deletes a file
func (*Pf9FileIO) GenerateChecksum ¶
GenerateChecksum generates sha256 checksum for files and writes the checksum file in checksum sub-dir in given directory
func (*Pf9FileIO) GenerateHashForDir ¶
GenerateHashForDir generates sha256 hash for files in directory and returns string slice of hashes of files
func (*Pf9FileIO) GenerateHashForFile ¶
GenerateHashForFile generates sha256 hash for given file and returns string of hash of file
func (*Pf9FileIO) GetFileInfo ¶
GetFileInfo fetches file details
func (*Pf9FileIO) ListFilesWithPatterns ¶
ListfilesWithPattern returns list of filenames with given patterns from given directory *recursively*
func (*Pf9FileIO) NewYamlFromTemplateYaml ¶
func (f *Pf9FileIO) NewYamlFromTemplateYaml(templFile string, outFile string, data interface{}) error
NewYamlFromTemplateYaml creates new yaml from template yaml file by replacing the value in provided data
func (*Pf9FileIO) ReadFile ¶
ReadFile reads an entire file and returns as bytes array
Should avoid reading large files
func (*Pf9FileIO) ReadFileByLine ¶
ReadFileByLine reads a file line by line and returns it as slice
Should be avoided when reading large files
func (*Pf9FileIO) ReadJSONFile ¶
ReadJSONFile reads a JSON file and updates the map passed as argument
func (*Pf9FileIO) RenameAndMoveFile ¶
RenameAndMoveFile renames and/or moves file
func (*Pf9FileIO) VerifyChecksum ¶
VerifyChecksum verifies the current sha256 checksum of all files with checksum file
func (*Pf9FileIO) WriteToFile ¶
WriteToFile writes data to file