utils

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: Apache-2.0, Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TempPathPrefix = "zarf-"

Functions

func CheckHostName

func CheckHostName(hostname string) bool

func ColorPrintYAML

func ColorPrintYAML(text string)

func CreateDirectory

func CreateDirectory(path string, mode os.FileMode) error

CreateDirectory

func CreateFilePath

func CreateFilePath(destination string)

func CreatePathAndCopy

func CreatePathAndCopy(source string, destination string)

func Download

func Download(url string) []byte

func DownloadToFile

func DownloadToFile(url string, target string)

func ExecCommand

func ExecCommand(envVariables []string, commandName string, args ...string) (string, error)

ExecCommand performs a process execution outside of Go

func Fetch

func Fetch(url string) io.ReadCloser

func GeneratePKI

func GeneratePKI(config PKIConfig)

GeneratePKI create a CA and signed server keypair

func GetHtpasswdString

func GetHtpasswdString(username string, password string) (string, error)

GetHtpasswdString converts a username and password to a properly formatted and hashed format for `htpasswd`

func GetSha256Sum

func GetSha256Sum(path string) (string, error)

GetSha256Sum returns the computed SHA256 Sum of a given file

func GetValidComponents

func GetValidComponents(allComponents []config.ZarfComponent, requestedComponentNames []string) []config.ZarfComponent

func HandlePKI

func HandlePKI(config PKIConfig)

func InjectServerCert

func InjectServerCert(pkiConfig PKIConfig)

func InvalidPath

func InvalidPath(path string) bool

InvalidPath checks if the given path exists

func IsAMD64

func IsAMD64() bool

func IsLinux

func IsLinux() bool

func IsRHEL

func IsRHEL() bool

func IsUrl

func IsUrl(source string) bool

func IsUserRoot

func IsUserRoot() bool

func IsValidHostName

func IsValidHostName() bool

func ListDirectories

func ListDirectories(directory string) []string

func Login

func Login(serverAddress string, user string, password string) error

Login adds the given creds to the user's Docker config, usually located at $HOME/.docker/config.yaml. It does not try to connect to the given registry, it just simply adds another entry to the config file. This function was mostly adapted from https://github.com/google/go-containerregistry/blob/5c9c442d5d68cd96787559ebf6e984c7eb084913/cmd/crane/cmd/auth.go

func MakeTempDir

func MakeTempDir() string

func RandomString

func RandomString(length int) string

func RecursiveFileList

func RecursiveFileList(root string) []string

func ReplaceText

func ReplaceText(path string, old string, new string)

func RunPreflightChecks

func RunPreflightChecks()

func ValidateSha256Sum

func ValidateSha256Sum(expectedChecksum string, path string)

func VerifyBinary

func VerifyBinary(binary string) bool

VerifyBinary returns true if binary is available

func WriteFile

func WriteFile(path string, data []byte)

Types

type PKIConfig

type PKIConfig struct {
	CertPublicPath  string
	CertPrivatePath string
	Host            string
}

Jump to

Keyboard shortcuts

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