util

package
v0.77.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PermissionDenied      = "denied"
	OperationNotPermitted = "not permitted"
	CommandNotFound       = "command not found"
	NoSuchFileOrDirectory = "no such file or directory"
	ProgramCanBeFound     = "can be found in the following packages"
	ErrorIsNotRecoverable = "Error is not recoverable"
	NotInstalled          = "not installed"
	CanNotOpen            = "can't open"
)

Variables

Functions

func Append

func Append(dest, source map[string]interface{}, override bool)

Append source to dest map

func AsDataMap

func AsDataMap(source interface{}) data.Map

func AsExtractable

func AsExtractable(input interface{}) (string, map[string]interface{})

AsExtractable returns text and data structure

func AsPayload

func AsPayload(data []byte) string

AsPayload return string optionally encoded as base64 data has binary data.

func BuildLowerCaseMapping

func BuildLowerCaseMapping(aMap map[string]interface{}) map[string]string

BuildLowerCaseMapping build lowercase key to key map mapping

func CheckCommandNotFound

func CheckCommandNotFound(stdout ...string) bool

CheckCommandNotFound checks for command not found message in the provided stdout.

func CheckNoSuchFileOrDirectory

func CheckNoSuchFileOrDirectory(stdout ...string) bool

CheckNoSuchFileOrDirectory checks for no such file or directory message in the provided stdout.

func ClassifyErrorIfMatched

func ClassifyErrorIfMatched(err error) error

ClassifyErrorIfMatched classify error with concrete implementation if needed

func EscapeStdout

func EscapeStdout(stdout string) string

func EscapedContains

func EscapedContains(stdout, match string) bool

func ExtractColumn

func ExtractColumn(line string, columnIndex int) (string, bool)

ExtractColumn extract a column from the line for provided index

func ExtractColumns

func ExtractColumns(line string) ([]string, bool)

ExtractColumns extract all column from the line

func FromPayload

func FromPayload(payload string) ([]byte, error)

FromPayload return bytes from

func GetArguments

func GetArguments(baseURLs ...string) (map[string]interface{}, error)

GetArguments extract cli arguments into a map

func GetIgnoreList

func GetIgnoreList(ctx context.Context, fs afs.Service, URL string) []string

GetIgnoreList returns ignore list

func GetUsername

func GetUsername(service *secret.Service, credentials string) (string, error)

func IsNotSuchResourceError

func IsNotSuchResourceError(err error) bool

IsNotSuchResourceError returns trus if error is of NotSuchResourceError type

func IsPermitted

func IsPermitted(stdout ...string) bool

IsPermitted returns true when output does not have permission deinied or not permitted

func ListResource

func ListResource(baseURLs []string, URI string) ([]string, error)

ListResource returns list of matcher resource URL

func LoadData

func LoadData(baseURLs []string, URI string) (interface{}, error)

LoadData load and decode URI into a pointer

func LoadMap

func LoadMap(baseURLs []string, URI string) (map[string]interface{}, error)

LoadMap load and decode URI into map

func LoadResource

func LoadResource(baseURL, URI string, result interface{}) (*location.Resource, error)

LoadResource load and decode URI into result pointer

func LoadResourceFromBaseURLs

func LoadResourceFromBaseURLs(baseURLs []string, URI string, result interface{}) (*location.Resource, error)

LoadResourceFromBaseURLs loads resource from base URLs and URI, returns the first successfully loaded resource or error

func MergeMap added in v0.73.0

func MergeMap(dest, source map[string]interface{})

MergeMap merges source map into dest map

func NormalizeMap

func NormalizeMap(keyValuePairs interface{}, deep bool) (map[string]interface{}, error)

NormalizeMap normalizes keyValuePairs from map or slice (map with preserved key order)

func SetNonEmpty

func SetNonEmpty(ptr1, ptr2 *string)

func SetNonZero

func SetNonZero(ptr1, ptr2 *int)

func ShouldIgnoreLocation

func ShouldIgnoreLocation(location string, ignoreList []string) bool

func SimpleTypeName

func SimpleTypeName(typeName string) string

SimpleTypeName returns simple type name

Types

type NotSuchResourceError

type NotSuchResourceError struct {
	Message  string
	Resource string
}

NotSuchResourceError represents generic no such resource error

func NewNotSuchResourceError

func NewNotSuchResourceError(resource string) *NotSuchResourceError

NewNotSuchResourceError create new NewNotSuchResourceError

func (*NotSuchResourceError) Error

func (e *NotSuchResourceError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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