Documentation
¶
Index ¶
- Variables
- func ConvertTypedSliceToUntypedSlice(typedSlice interface{}) []interface{}
- func CreateDirIfNotExists(fs afero.Afero, path string) error
- func CreateTarArchive(afs afero.Afero, sourceDir, targetFile string) error
- func CurrentFileDirectory() string
- func FileExists(fs afero.Fs, filename string) bool
- func GetDirectorySize(fs afero.Fs, path string) (int64, error)
- func IsSameShallowType(a, b interface{}) bool
- func IsStrictlyContained(leftSlice, rightSlice []interface{}) bool
- func IsStrictlyContainedInt(leftSlice, rightSlice []int) bool
- func MapKeysToSlice[R comparable, T any](m map[R]T) []R
- func PromptForPassphrase(confirm bool) (string, error)
- func PromptReonboard(r io.Reader, w io.Writer) error
- func PromptYesNo(in io.Reader, out io.Writer, prompt string) (bool, error)
- func RandomString(n int) (string, error)
- func SanitizeArchivePath(d, t string) (v string, err error)
- func SliceContains(s []string, str string) bool
- func WriteToFile(fs afero.Fs, data []byte, filePath string) (string, error)
- type HTTPClient
- type SyncMap
Constants ¶
This section is empty.
Variables ¶
var ErrOperationCancelled = errors.New("operation cancelled by user")
Functions ¶
func ConvertTypedSliceToUntypedSlice ¶ added in v0.5.0
func ConvertTypedSliceToUntypedSlice(typedSlice interface{}) []interface{}
func CreateDirIfNotExists ¶ added in v0.6.1
func CreateTarArchive ¶ added in v0.6.0
CreateTarArchive creates a tar archive of the source directory
func CurrentFileDirectory ¶ added in v0.6.1
func CurrentFileDirectory() string
CurrentFileDirectory returns the path of this file
func FileExists ¶ added in v0.5.0
FileExists checks if destination file exists
func GetDirectorySize ¶ added in v0.5.0
func IsSameShallowType ¶ added in v0.5.0
func IsSameShallowType(a, b interface{}) bool
func IsStrictlyContained ¶ added in v0.5.0
func IsStrictlyContained(leftSlice, rightSlice []interface{}) bool
IsStrictlyContained checks if all elements of rightSlice are contained in leftSlice
func IsStrictlyContainedInt ¶ added in v0.5.0
IsStrictlyContainedInt checks if all elements of rightSlice are contained in leftSlice
func MapKeysToSlice ¶ added in v0.6.1
func MapKeysToSlice[R comparable, T any](m map[R]T) []R
func PromptForPassphrase ¶ added in v0.6.0
func PromptReonboard ¶ added in v0.6.0
PromptReonboard is a wrapper of utils.PromptYesNo with custom prompt that return error if user declines reonboard
func PromptYesNo ¶ added in v0.4.159
PromptYesNo loops on confirmation from user until valid answer
func RandomString ¶
RandomString generates a random string of length n
func SanitizeArchivePath ¶ added in v0.5.0
Sanitize archive file pathing from "G305: Zip Slip vulnerability"
func SliceContains ¶ added in v0.4.159
SliceContains checks if a string exists in a slice
Types ¶
type HTTPClient ¶ added in v0.5.0
func NewHTTPClient ¶ added in v0.5.0
func NewHTTPClient(baseURL, version string) *HTTPClient
NewHTTPClient creates a new HTTPClient with APM instrumentation.
func (*HTTPClient) MakeRequest ¶ added in v0.5.0
func (c *HTTPClient) MakeRequest(ctx context.Context, method, relativePath string, body []byte) ([]byte, int, error)
MakeRequest performs an HTTP request with the given method, path, and body. It returns the response body, status code, and an error if any.
type SyncMap ¶ added in v0.5.0
type SyncMap[K comparable, V any] struct { sync.Map }
A SyncMap is a concurrency-safe sync.Map that uses strongly-typed method signatures to ensure the types of its stored data are known.
func SyncMapFromMap ¶ added in v0.5.0
func SyncMapFromMap[K comparable, V any](m map[K]V) *SyncMap[K, V]
SyncMapFromMap converts a standard Go map to a concurrency-safe SyncMap.
func (*SyncMap[K, V]) Get ¶ added in v0.5.0
Get retrieves the value associated with the given key from the map. It returns the value and a boolean indicating whether the key was found.
func (*SyncMap[K, V]) Iter ¶ added in v0.5.0
Iter iterates over each key-value pair in the map, executing the provided function on each pair. The iteration stops if the provided function returns false.
func (*SyncMap[K, V]) Keys ¶ added in v0.5.0
func (m *SyncMap[K, V]) Keys() []K
Keys returns a slice containing all the keys present in the map.