Documentation ¶
Index ¶
- Constants
- func BlankIsNA(s string) string
- func CSVtoArray(tagcsv string) []string
- func CopyFile(src, dst string) (int64, error)
- func DmidecodeProduct() (string, error)
- func EmptyString(s string) bool
- func Error2ExitCode(err error) int
- func ExecToFile(cli string, ofile string) (err error)
- func FileExists(filename string) (bool, error)
- func FileExistsEasy(p string) bool
- func GetFirstFile(rootpath string, hint string) string
- func GetPrivateSSHKey() string
- func Grep(path string, musthave string, mustnothave string) ([]string, error)
- func Gunzip(dst string, r io.Reader) error
- func HighLight(a string, b string, hl string) string
- func Hostname() (string, error)
- func HumanReadableBigNumber(n int64) string
- func HumanReadableSeconds(s int64) string
- func HumanReadableStorageCapacity(b int64) string
- func IsMonth(m string) bool
- func LoadFileIntoSlice(f string) ([]string, error)
- func MD5sumChunk(filePath string, chunkSize int64)
- func MD5sumFile(filePath string) (string, error)
- func Move(src, dst string) error
- func NotBlankIsMasked(s string) string
- func Popen3(output_buffer *bytes.Buffer, stack ...*exec.Cmd) (err error)
- func Popen3Grep(cmd string, musthave string, mustnothave string) ([]string, error)
- func Popen3GrepFast(cmd string, musthave string, mustnothave string) ([]string, error)
- func PopentoString(cmd string) (string, error)
- func PopentoStringAwk(cmd string, awk int) (string, error)
- func PrettyPrint(v any) string
- func ReadFileToSlice(filename string, force bool) ([]string, error)
- func ReadStructFromCommand(cli string, structure interface{}) error
- func ReadStructFromCommandOverSSH(ssh SSHStruct, cli string, structure interface{}) error
- func ReadStructFromJSONFile(filePath string, structure interface{}) error
- func ReadStructFromString(content string, structure interface{}) error
- func RecursiveDelete(path string) error
- func RemoveFile(path string) error
- func RemoveGlob(glob string) error
- func RemoveTag(l []string, s string) []string
- func SSHPopenToString(hostname string, command string) (string, error)
- func SetEnvironment(v *bool, env_var string)
- func SetPrivateSSHKey(newkey string)
- func SetStringIfNotSet(v string, d string) string
- func SetVerbose(v bool)
- func SliceContains(haystack []string, needle string) bool
- func Spinny(sigChan chan bool)
- func StringToFileOverSSH(outputContent string, remoteserver string, outputfile string) error
- func System3(cmd string) error
- func System3AndSpin(cmd string, redirect string) (err error)
- func System3toCapturedString(s *string, cmd string) error
- func Targz(sourceDir string, outputFilename string, leaveout string) error
- func Touch(fileName string) error
- func TrimQuotes(s string) string
- func TrimSuffix(s, suffix string) string
- func TrueIsYes(b bool) string
- func UniqTagSet(l []string) []string
- func Untar(dst string, r io.Reader) error
- func Unzip(destination string, r *zip.ReadCloser) error
- func VerbosePrintln(cmd string)
- func WriteSliceToFile(filename string, content []string) error
- func WriteSparseFile(f string, sizeMin int, sizeMax int, r int) error
- func WriteStringToFile(filename string, content string) error
- func WriteStructToJSONFile(filePath string, structure interface{}) error
- type ExecCallBackFunc
- type ExecStruct
- func (ex *ExecStruct) Execute() error
- func (ex ExecStruct) GetIface() interface{}
- func (ex ExecStruct) Init() ExecStruct
- func (ex ExecStruct) OkToSpin() bool
- func (ex ExecStruct) OkToWatch() bool
- func (ex ExecStruct) WithCapture(c bool) ExecStruct
- func (ex ExecStruct) WithDirectory(d string) ExecStruct
- func (ex ExecStruct) WithHintInterface(i interface{}) ExecStruct
- func (ex ExecStruct) WithMainExecFunc(cb ExecCallBackFunc, cli string) ExecStruct
- func (ex ExecStruct) WithProgressExecFunc(cb ProgressCallBackFunc) ExecStruct
- func (ex ExecStruct) WithSSH(ssh SSHStruct, cli string) ExecStruct
- func (ex ExecStruct) WithSpinny(b bool) ExecStruct
- func (ex ExecStruct) WithWatcherExecFunc(cb WatcherCallBackFunc) ExecStruct
- type ProgressCallBackFunc
- type S3ClientSession
- func (this S3ClientSession) CreateBucket() error
- func (this S3ClientSession) EstablishSession() S3ClientSession
- func (this S3ClientSession) HeadBucket() (bool, error)
- func (s3c S3ClientSession) KeepBucket() S3ClientSession
- func (this S3ClientSession) RecursiveBucketDelete() error
- func (this S3ClientSession) RemoveBucket() error
- func (this S3ClientSession) SetBucket(b string) S3ClientSession
- func (this S3ClientSession) SetEndpoint(sep string) S3ClientSession
- func (this S3ClientSession) SetRegion(r string) S3ClientSession
- func (this S3ClientSession) SetVersioning(v bool) S3ClientSession
- func (this S3ClientSession) Sync(localPath string) error
- func (this S3ClientSession) SyncInner(trimsz int, localPath string) error
- type S3credStruct
- type SSHStruct
- func (s SSHStruct) BackgroundedRemoteExecute(cli string) (SSHStruct, error)
- func (s SSHStruct) Chown(uid int, gid int, path string) error
- func (s SSHStruct) DownloadCLI(src string, tgt string) string
- func (s SSHStruct) GetBody() string
- func (s SSHStruct) GetRemoteDir() string
- func (s SSHStruct) GetRemoteHostname() (string, error)
- func (s SSHStruct) GetSSHCli() string
- func (s SSHStruct) MkdirAll(dir string) error
- func (this SSHStruct) RemoteExecuteAndSpin(cli string) (SSHStruct, error)
- func (s SSHStruct) RemoteFileExists(path string) bool
- func (this SSHStruct) SecureDownload(remoteFilePath string, localFilePath string) error
- func (this SSHStruct) SecureDownloadAndSpin(remoteFilePath string, localFilePath string) error
- func (this *SSHStruct) SecureRemoteExecution(cli string) error
- func (this SSHStruct) SecureUpload(localFilePath string, remoteFilePath string) error
- func (this SSHStruct) SecureUploadAndSpin(localFilePath string, remoteFilePath string) error
- func (s *SSHStruct) SetCapture(c bool) SSHStruct
- func (this *SSHStruct) SetDefaults()
- func (s *SSHStruct) SetHost(h string) SSHStruct
- func (this SSHStruct) UploadCLI(src string, tgt string) string
- func (s SSHStruct) WithCapture(c bool) SSHStruct
- func (s SSHStruct) WithHost(h string) SSHStruct
- func (s SSHStruct) WithKey(k string) SSHStruct
- func (s SSHStruct) WithRemoteDir(rd string) SSHStruct
- func (s SSHStruct) WithSilent(c bool) SSHStruct
- func (s SSHStruct) WithUser(u string) SSHStruct
- type WatcherCallBackFunc
Constants ¶
const ( ALFREDO_VERSION = "23Oct2023 - 2000" NOT_AVAILABLE = "N/A" )
Variables ¶
This section is empty.
Functions ¶
func CSVtoArray ¶
func DmidecodeProduct ¶
func EmptyString ¶
func Error2ExitCode ¶
func ExecToFile ¶
func FileExists ¶
func FileExistsEasy ¶
func GetFirstFile ¶
func GetPrivateSSHKey ¶
func GetPrivateSSHKey() string
func Gunzip ¶
Untar takes a destination path and a reader; a tar reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files
func HumanReadableBigNumber ¶
func HumanReadableSeconds ¶
func LoadFileIntoSlice ¶
load a file with lines that \n terminated into a slice (used by the syslog self-test)
func MD5sumChunk ¶
work in progress; want to return string of hash for a partial file
func MD5sumFile ¶
func NotBlankIsMasked ¶ added in v0.2.0
func Popen3Grep ¶
func Popen3GrepFast ¶
func PopentoString ¶
func ReadStructFromCommand ¶
func ReadStructFromJSONFile ¶
simply reads JSON data from a file and populates the provided structure.
func ReadStructFromString ¶
func RecursiveDelete ¶
func RemoveFile ¶
func RemoveGlob ¶
func SetEnvironment ¶
func SetPrivateSSHKey ¶
func SetPrivateSSHKey(newkey string)
func SetStringIfNotSet ¶ added in v0.2.0
func SetVerbose ¶
func SetVerbose(v bool)
func SliceContains ¶
func StringToFileOverSSH ¶
write otuput content (including new lines) to file outputfile (including full absolute path) on remoteserver over SSH
func System3AndSpin ¶
func System3toCapturedString ¶ added in v0.2.0
func TrimQuotes ¶
func TrimSuffix ¶
func UniqTagSet ¶ added in v0.2.0
func Untar ¶
Untar takes a destination path and a reader; a tar reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files
func Unzip ¶
func Unzip(destination string, r *zip.ReadCloser) error
Untar takes a destination path and a reader; a tar reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files
func VerbosePrintln ¶
func VerbosePrintln(cmd string)
for debugging purposes, a more verbose output to catch attention
func WriteSliceToFile ¶
func WriteSparseFile ¶
write a sparse file f of size, randomly between sizeMin and sizeMax, r random 1's in the 0's. Seek for 0's
func WriteStringToFile ¶
func WriteStructToJSONFile ¶
simply write a data interface to a json file; shamelessly picked off the internet
Types ¶
type ExecCallBackFunc ¶ added in v0.2.0
type ExecStruct ¶ added in v0.2.0
type ExecStruct struct { SpinSigChan chan bool WatchSigChan chan bool ErrChan chan error // contains filtered or unexported fields }
func (*ExecStruct) Execute ¶ added in v0.2.0
func (ex *ExecStruct) Execute() error
func (ExecStruct) GetIface ¶ added in v0.2.0
func (ex ExecStruct) GetIface() interface{}
func (ExecStruct) Init ¶ added in v0.2.0
func (ex ExecStruct) Init() ExecStruct
func (ExecStruct) OkToSpin ¶ added in v0.2.0
func (ex ExecStruct) OkToSpin() bool
func (ExecStruct) OkToWatch ¶ added in v0.2.0
func (ex ExecStruct) OkToWatch() bool
func (ExecStruct) WithCapture ¶ added in v0.2.0
func (ex ExecStruct) WithCapture(c bool) ExecStruct
func (ExecStruct) WithDirectory ¶ added in v0.2.0
func (ex ExecStruct) WithDirectory(d string) ExecStruct
func (ExecStruct) WithHintInterface ¶ added in v0.2.0
func (ex ExecStruct) WithHintInterface(i interface{}) ExecStruct
func (ExecStruct) WithMainExecFunc ¶ added in v0.2.0
func (ex ExecStruct) WithMainExecFunc(cb ExecCallBackFunc, cli string) ExecStruct
func (ExecStruct) WithProgressExecFunc ¶ added in v0.2.0
func (ex ExecStruct) WithProgressExecFunc(cb ProgressCallBackFunc) ExecStruct
func (ExecStruct) WithSSH ¶ added in v0.2.0
func (ex ExecStruct) WithSSH(ssh SSHStruct, cli string) ExecStruct
func (ExecStruct) WithSpinny ¶ added in v0.2.0
func (ex ExecStruct) WithSpinny(b bool) ExecStruct
func (ExecStruct) WithWatcherExecFunc ¶ added in v0.2.0
func (ex ExecStruct) WithWatcherExecFunc(cb WatcherCallBackFunc) ExecStruct
type ProgressCallBackFunc ¶ added in v0.2.0
type ProgressCallBackFunc func(chan bool)
type S3ClientSession ¶ added in v0.2.0
type S3ClientSession struct { Credentials S3credStruct `json:"s3creds"` Bucket string Endpoint string Region string Client *s3.S3 Versioning bool // contains filtered or unexported fields }
func (S3ClientSession) CreateBucket ¶ added in v0.2.0
func (this S3ClientSession) CreateBucket() error
func (S3ClientSession) EstablishSession ¶ added in v0.2.0
func (this S3ClientSession) EstablishSession() S3ClientSession
func (S3ClientSession) HeadBucket ¶ added in v0.2.0
func (this S3ClientSession) HeadBucket() (bool, error)
func (S3ClientSession) KeepBucket ¶ added in v0.2.0
func (s3c S3ClientSession) KeepBucket() S3ClientSession
func (S3ClientSession) RecursiveBucketDelete ¶ added in v0.2.0
func (this S3ClientSession) RecursiveBucketDelete() error
func (S3ClientSession) RemoveBucket ¶ added in v0.2.0
func (this S3ClientSession) RemoveBucket() error
func (S3ClientSession) SetBucket ¶ added in v0.2.0
func (this S3ClientSession) SetBucket(b string) S3ClientSession
func (S3ClientSession) SetEndpoint ¶ added in v0.2.0
func (this S3ClientSession) SetEndpoint(sep string) S3ClientSession
func (S3ClientSession) SetRegion ¶ added in v0.2.0
func (this S3ClientSession) SetRegion(r string) S3ClientSession
func (S3ClientSession) SetVersioning ¶ added in v0.2.0
func (this S3ClientSession) SetVersioning(v bool) S3ClientSession
func (S3ClientSession) Sync ¶ added in v0.2.0
func (this S3ClientSession) Sync(localPath string) error
type S3credStruct ¶ added in v0.2.0
type S3credStruct struct { AccessKey string `json:"accessKey"` Active bool `json:"active"` CreateDate int64 `json:"createDate"` ExpireDate int64 `json:"expireDate"` SecretKey string `json:"secretKey"` Profile string `json:"profile"` }
func (S3credStruct) CredentialsStanza ¶ added in v0.2.0
func (s3c S3credStruct) CredentialsStanza() string
func (S3credStruct) GenerateAWSCLItoString ¶ added in v0.2.0
func (s3c S3credStruct) GenerateAWSCLItoString(endpoint string, region string, useSSL bool) string
type SSHStruct ¶
type SSHStruct struct { Key string `json:"key"` User string `json:"user"` Host string `json:"host"` // contains filtered or unexported fields }
func (SSHStruct) BackgroundedRemoteExecute ¶
func (SSHStruct) DownloadCLI ¶
remote, local
func (SSHStruct) GetRemoteDir ¶ added in v0.2.0
func (SSHStruct) GetRemoteHostname ¶
func (SSHStruct) RemoteExecuteAndSpin ¶
func (SSHStruct) RemoteFileExists ¶
return false on error or file doesn't exist (easy mode)
func (SSHStruct) SecureDownload ¶
func (SSHStruct) SecureDownloadAndSpin ¶
func (*SSHStruct) SecureRemoteExecution ¶
func (SSHStruct) SecureUpload ¶
func (SSHStruct) SecureUploadAndSpin ¶
func (*SSHStruct) SetCapture ¶ added in v0.2.0
func (*SSHStruct) SetDefaults ¶
func (this *SSHStruct) SetDefaults()
func (SSHStruct) WithCapture ¶ added in v0.2.0
func (SSHStruct) WithRemoteDir ¶ added in v0.2.0
func (SSHStruct) WithSilent ¶ added in v0.2.0
type WatcherCallBackFunc ¶ added in v0.2.0
type WatcherCallBackFunc func(*ExecStruct) error