utils

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDirectory

func CreateDirectory(directoryPath string) error

CreateDirectory creates a directory with full permissions

func DecryptString

func DecryptString(encryptedRaw string, keyBase string) (plainTextString string, err error)

DecryptString descryptin encrypted string with keybase

func EncryptAES

func EncryptAES(key, data []byte) ([]byte, error)

EncryptAES encrypts data with provided key

func EncryptString

func EncryptString(plain string, keyBase string) (string, error)

EncryptString encrypts plain string with the provided keybase (AES)

func Fetch

func Fetch(fromFile, prefix string) ([]string, error)

Fetch data from a file with a provided prefix

func FindFiles

func FindFiles(dir string) []os.FileInfo

FindFiles fidn the files in provided directory

func GetEnvVars

func GetEnvVars(prefix string) []string

GetEnvVars returns the environments variables

func PrettyPrint

func PrettyPrint(b []byte) ([]byte, error)

PrettyPrint prints json with pretty identation

func PrintLogLines

func PrintLogLines(logs []api.LogLine) error

PrintLogLines prints lines as logs

func ReadLines

func ReadLines(path string) ([]string, error)

ReadLines reads a file and returns the string contents

func RichLog

func RichLog(level string, log string)

RichLog based on level logs properly

func StringInSlice

func StringInSlice(str string, list []string) bool

StringInSlice check if a string is in slice

func ToHash

func ToHash(plain string) []byte

ToHash hashes with SHA256 the provided string

func ToYaml

func ToYaml(o interface{}) ([]byte, error)

ToYaml transforms interface data to Yaml

func WalkPropertyValueFromArgs

func WalkPropertyValueFromArgs(args []string, actionFunc func(property, value string) error) error

WalkPropertyValueFromArgs walks the proerty values from arguments

func WriteByteFile

func WriteByteFile(fileName string, data []byte) error

WriteByteFile writes to a file from byte data

func WriteBytesFile

func WriteBytesFile(landscapeDir, basePath, fileName string, data []byte) error

WriteBytesFile write bytes to a file to basepath with filename and the given format

func WriteFile

func WriteFile(landscapeDir, basePath, fileName, format string, resource interface{}) error

WriteFile write a file to basepath with filename and the given format

func WriteJSON

func WriteJSON(landscapeDir, basePath, fileName string, resource interface{}) error

WriteJSON write JSON to a file to basepath with filename

func WriteStringFile

func WriteStringFile(fileName string, data []string) error

WriteStringFile writes to a file from string data

func WriteYAML

func WriteYAML(landscapeDir, basePath, fileName string, resource interface{}) error

WriteYAML write YAMLto a file to basepath with filename

Types

This section is empty.

Jump to

Keyboard shortcuts

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