utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package utils is for commonly used functions

Index

Constants

View Source
const (

	// ReadWriteExecuteUser is used for any directory or executable not normally used by the end user or containing sensitive data
	ReadWriteExecuteUser = 0700
)

Variables

This section is empty.

Functions

func CreateDirectory added in v0.3.0

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

CreateDirectory creates a directory for the given path and file mode.

func DownloadToFile added in v0.3.0

func DownloadToFile(ctx context.Context, src, dst string) (err error)

DownloadToFile downloads a given URL to the target filepath (including the cosign key if necessary).

func FilterDebianLinux

func FilterDebianLinux(h *cluster.ZarfHost) bool

FilterDebianLinux is a function used to filter whether a host is a Debian based OS

func FilterEngineAlreadyPopulated

func FilterEngineAlreadyPopulated(h *cluster.ZarfHost) bool

FilterEngineAlreadyPopulated is a function used to filter whether a host already has distro files populated

func FilterEnterpriseLinux

func FilterEnterpriseLinux(h *cluster.ZarfHost) bool

FilterEnterpriseLinux is a function used to filter whether a host is an Enterprise Linux OS

func IdentifySource

func IdentifySource(src string) (string, error)

IdentifySource returns the source type for the given source string.

func InvalidPath added in v0.3.0

func InvalidPath(path string) bool

InvalidPath checks if the given path is valid (if it is a permissions error it is there we just don't have access)

func IsDebianLinux

func IsDebianLinux(con os.Configurer) bool

IsDebianLinux is true if the os.Configurer is of a type of Debian based OS

func IsEnterpriseLinux

func IsEnterpriseLinux(con os.Configurer) bool

IsEnterpriseLinux is true if the os.Configurer is of a type of Enterprise Linux

func MakeTempDir added in v0.3.0

func MakeTempDir(basePath string) (string, error)

MakeTempDir creates a temp directory with the zarf- prefix.

func PrintJSON

func PrintJSON(obj any) string

PrintJSON returns a string representation of a given object

func RandomString

func RandomString(length int) (string, error)

RandomString returns a string of hexadecimal characters of a given length that is cryptographically secure, or an error

func ReadByteStrict

func ReadByteStrict(data []byte, destConfig any) error

ReadByteStrict reads a byte array and tries to place it in the provided "destConfig" object

func ReadYAMLStrict

func ReadYAMLStrict(path string, destConfig any) error

ReadYAMLStrict reads a YAML file into a struct, with strict parsing

Types

This section is empty.

Jump to

Keyboard shortcuts

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