Documentation ¶
Index ¶
- func CmpMapValues(map1, map2 map[string]string, key string) (int, error)
- func EqualArrays(arr1, arr2 []string) bool
- func FileExists(path, desiredType string) int
- func GcsDowndload(bucket, object, destDir, name string, authenticate bool) (string, error)
- func InArray(val string, arr []string) bool
- func MountDisk(diskFile, mountDir, partition string) (string, error)
- func ReadFileToMap(filePath, sep string) (map[string]string, error)
- func SliceToMapStr(input []string) map[string]string
- func Unmount(mountedDirectory, loopDevice string) error
- func WriteToNewFile(filename string, data string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CmpMapValues ¶
CmpMapValues is a helper function that compares a value shared by two maps / Input:
(map[string]string) map1 - First map to be compared (map[string]string) map2 - Second map to be compared (string) key - The key of the value be compared in both maps
Output:
(int) result - -1 for error, 0 for no difference, 1 for difference
func EqualArrays ¶
EqualArrays determines if two string arrays are equal
func FileExists ¶
FileExists determines if the path exists, and then if the path points to a file of the desired type Input:
(string) path - Local path to the file (string) desiredType - The type of the file desired
Output: -1 if file doesn't exist, 0 if exists and is not desiredType, and 1 if file exists and is desiredType
func GcsDowndload ¶
GcsDowndload calls the GCS client api to download a specified object from a GCS bucket. Input:
(string) bucket - Name of the GCS bucket (string) object - Name of the GCS object (string) destDir - Destination for downloaded GCS object (string) name - Name for the downloaded file (bool) authenticate - Indicates whether the GCS client need to be authenticated. Use unauthenticated client if you only wish to access public data. Otherwise, ADC will be used for authorization.
Output:
(string) downloadedFile - Path to downloaded GCS object
func MountDisk ¶
MountDisk finds a free loop device and mounts a DOS/MBR disk file Input:
(string) diskFile - Name of DOS/MBR file (ex: disk.raw) (string) mountDir - Mount Destination (string) partition - The partition number you are pulling the offset from
Output:
(string) loopDevice - Name of the loop device used to mount
func ReadFileToMap ¶
ReadFileToMap reads a text file line by line into a map. For each line key: first word split by separator, value: rest of line after separator. Ex: Inputs: textLine: "NAME=Container-Optimized OS", sep: "="
Outputs: map: {"NAME":"Container-Optimized OS"}
Input:
(string) filePath - The command-line path to the text file (string) sep - The separator string for the key and value pairs
Output:
(map[string]string) mapOfFile - The map of the read-in text file
func SliceToMapStr ¶
SliceToMapStr initializes a map with keys from input and empty strings as values
func WriteToNewFile ¶
WriteToNewFile creates a file and writes a string into it
Types ¶
This section is empty.