util

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 21 Imported by: 48

Documentation

Index

Constants

View Source
const ContainerAppDirectoryName = "/app"

ContainerAppDirectoryName --.

View Source
const ContainerLibDirectoryName = "/lib/main"

ContainerLibDirectoryName --.

View Source
const ContainerQuarkusDirectoryName = "/quarkus"

ContainerQuarkusDirectoryName --.

View Source
const CustomAppDirectoryName = "app"

CustomAppDirectoryName --.

View Source
const CustomLibDirectoryName = "lib/main"

CustomLibDirectoryName --.

View Source
const CustomQuarkusDirectoryName = "quarkus"

CustomQuarkusDirectoryName --.

View Source
const DefaultDependenciesDirectoryName = "dependencies"

DefaultDependenciesDirectoryName --.

View Source
const DefaultPropertiesDirectoryName = "properties"

DefaultPropertiesDirectoryName --.

View Source
const DefaultRoutesDirectoryName = "routes"

DefaultRoutesDirectoryName --.

View Source
const DefaultWorkingDirectoryName = "workspace"

DefaultWorkingDirectoryName --.

Variables

View Source
var CLIEnvVars = make([]string, 0)

CLIEnvVars -- List of CLI provided environment variables. They take precedence over any environment variables with the same name.

View Source
var ContainerDependenciesDirectory = "/deployments/dependencies"

ContainerDependenciesDirectory --.

View Source
var ContainerPropertiesDirectory = "/etc/camel/conf.d"

ContainerPropertiesDirectory --.

View Source
var ContainerResourcesDirectory = "/etc/camel/resources"

ContainerResourcesDirectory --.

View Source
var ContainerRoutesDirectory = "/etc/camel/sources"

ContainerRoutesDirectory --.

View Source
var ListOfLazyEvaluatedEnvVars = []string{}

ListOfLazyEvaluatedEnvVars -- List of unevaluated environment variables. These are sensitive values or values that may have different values depending on where the integration is run (locally vs. the cloud). These environment variables are evaluated at the time of the integration invocation.

View Source
var MavenWorkingDirectory = ""

MavenWorkingDirectory is the directory used by Maven for an invocation of the kamel local command. By default, a temporary folder will be used.

View Source
var QuarkusDependenciesBaseDirectory = "/quarkus-app"

QuarkusDependenciesBaseDirectory --.

Functions

func Close added in v1.8.0

func Close(err error, closer io.Closer) error

func CloseQuietly added in v1.8.0

func CloseQuietly(closer io.Closer)

CloseQuietly unconditionally close an io.Closer It should not be used to replace the Close statement(s).

func ConfigTreePropertySplit added in v1.8.0

func ConfigTreePropertySplit(property string) []string

Parses a property spec and returns its parts.

func CopyAppFile added in v1.7.0

func CopyAppFile(localDependenciesDirectory string, localAppDirectory string) error

func CopyFile

func CopyFile(src, dst string) (nBytes int64, err error)

func CopyIntegrationFilesToDirectory added in v1.4.0

func CopyIntegrationFilesToDirectory(files []string, directory string) ([]string, error)

func CopyLibFiles added in v1.7.0

func CopyLibFiles(localDependenciesDirectory string, localLibDirectory string) error

func CopyMap added in v1.5.0

func CopyMap(source map[string]string) map[string]string

CopyMap clones a map of strings.

func CopyQuarkusAppFiles added in v1.7.0

func CopyQuarkusAppFiles(localDependenciesDirectory string, localQuarkusDir string) error

func CreateDirectory added in v1.3.0

func CreateDirectory(directory string) error

func CreateLocalAppDirectory added in v1.7.0

func CreateLocalAppDirectory() error

func CreateLocalDependenciesDirectory added in v1.3.0

func CreateLocalDependenciesDirectory() error

func CreateLocalLibDirectory added in v1.7.0

func CreateLocalLibDirectory() error

func CreateLocalPropertiesDirectory added in v1.3.0

func CreateLocalPropertiesDirectory() error

func CreateLocalQuarkusDirectory added in v1.7.0

func CreateLocalQuarkusDirectory() error

func CreateLocalRoutesDirectory added in v1.3.0

func CreateLocalRoutesDirectory() error

func DependenciesToJSON added in v1.3.0

func DependenciesToJSON(list []string) ([]byte, error)

func DependenciesToYAML added in v1.3.0

func DependenciesToYAML(list []string) ([]byte, error)

func DirectoryEmpty added in v1.7.0

func DirectoryEmpty(directory string) (ok bool, err error)

func DirectoryExists added in v1.3.0

func DirectoryExists(directory string) (bool, error)

func EncodeXML

func EncodeXML(content interface{}) ([]byte, error)

func EvaluateCLIAndLazyEnvVars added in v1.4.0

func EvaluateCLIAndLazyEnvVars() ([]string, error)

EvaluateCLIAndLazyEnvVars creates a list of environment variables with entries VAR=value that can be passed when running the integration.

func FileExists

func FileExists(name string) (bool, error)

func FindAllDistinctStringSubmatch

func FindAllDistinctStringSubmatch(data string, regexps ...*regexp.Regexp) []string

func FindNamedMatches added in v1.3.0

func FindNamedMatches(expr string, str string) map[string]string

func GetEnvironmentVariable added in v1.3.0

func GetEnvironmentVariable(variable string) (string, error)

func GetLocalAppDir added in v1.7.0

func GetLocalAppDir() string

GetLocalAppDir -- <mavenWorkingDirectory>/app.

func GetLocalDependenciesDir added in v1.3.0

func GetLocalDependenciesDir() string

GetLocalDependenciesDir --<mavenWorkingDirectory>/dependencies.

func GetLocalLibDir added in v1.7.0

func GetLocalLibDir() string

GetLocalLibDir -- <mavenWorkingDirectory>/lib/main.

func GetLocalPropertiesDir added in v1.3.0

func GetLocalPropertiesDir() string

GetLocalPropertiesDir -- <mavenWorkingDirectory>/properties.

func GetLocalQuarkusDir added in v1.7.0

func GetLocalQuarkusDir() string

GetLocalQuarkusDir -- <mavenWorkingDirectory>/quarkus.

func GetLocalRoutesDir added in v1.3.0

func GetLocalRoutesDir() string

GetLocalRoutesDir -- <mavenWorkingDirectory>/routes.

func JSONToMap added in v1.7.0

func JSONToMap(src []byte) (map[string]interface{}, error)

func JSONToYAML added in v1.3.0

func JSONToYAML(src []byte) ([]byte, error)

func MapToYAML added in v1.7.0

func MapToYAML(src map[string]interface{}) ([]byte, error)
func NavigateConfigTree(current interface{}, nodes []string) (interface{}, error)

NavigateConfigTree switch to the element in the tree represented by the "nodes" spec and creates intermediary nodes if missing. Nodes specs starting with "[" and ending in "]" are treated as slice indexes.

func Open added in v1.8.0

func Open(name string) (*os.File, error)

Open a safe wrapper of os.Open.

func OpenFile added in v1.8.0

func OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)

OpenFile a safe wrapper of os.OpenFile.

func ReadFile added in v1.8.0

func ReadFile(filename string) ([]byte, error)

ReadFile a safe wrapper of os.ReadFile.

func RunAndLog added in v1.8.0

func RunAndLog(ctx context.Context, cmd *exec.Cmd, stdOutF func(string), stdErrF func(string)) (err error)

RunAndLog starts the provided command, scans its standard and error outputs line by line, to feed the provided handlers, and waits until the scans complete and the command returns.

func SortedMapKeys

func SortedMapKeys(m map[string]interface{}) []string

func SortedStringMapKeys

func SortedStringMapKeys(m map[string]string) []string

func StringContainsPrefix added in v1.7.0

func StringContainsPrefix(slice []string, prefix string) bool

func StringSliceContains

func StringSliceContains(slice []string, items []string) bool

func StringSliceContainsAnyOf

func StringSliceContainsAnyOf(slice []string, items ...string) bool

func StringSliceExists

func StringSliceExists(slice []string, item string) bool

func StringSliceJoin

func StringSliceJoin(slices ...[]string) []string

func StringSliceUniqueAdd

func StringSliceUniqueAdd(slice *[]string, item string) bool

StringSliceUniqueAdd appends the given item if not already present in the slice.

func StringSliceUniqueConcat

func StringSliceUniqueConcat(slice *[]string, items []string) bool

StringSliceUniqueConcat appends all the items of the "items" slice if they are not already present in the slice.

func SubstringFrom added in v1.4.0

func SubstringFrom(s string, substr string) string

func WithFile added in v1.8.0

func WithFile(name string, flag int, perm os.FileMode, consumer func(file *os.File) error) error

WithFile a safe wrapper to process a file.

func WithFileContent added in v1.8.0

func WithFileContent(name string, consumer func(file *os.File, data []byte) error) error

WithFileContent a safe wrapper to process a file content.

func WithFileReader added in v1.8.0

func WithFileReader(name string, consumer func(reader io.Reader) error) error

WithFileReader a safe wrapper to process a file.

func WithTempDir added in v1.8.0

func WithTempDir(pattern string, consumer func(string) error) error

WithTempDir a safe wrapper to deal with temporary directories.

func WriteFileWithBytesMarshallerContent

func WriteFileWithBytesMarshallerContent(basePath string, filePath string, content BytesMarshaller) error

func WriteFileWithContent

func WriteFileWithContent(filePath string, content []byte) error

WriteFileWithContent a safe wrapper to write content to a file.

func WriteToFile added in v1.3.0

func WriteToFile(filePath string, fileContents string) error

Types

type BytesMarshaller

type BytesMarshaller interface {
	MarshalBytes() ([]byte, error)
}

Directories

Path Synopsis
Package bindings provides APIs to transform Kubernetes objects into Camel URIs equivalents
Package bindings provides APIs to transform Kubernetes objects into Camel URIs equivalents
log
Package minikube contains utilities for Minikube deployments
Package minikube contains utilities for Minikube deployments
Package sync provides useful tools to get notified when a file system resource changes
Package sync provides useful tools to get notified when a file system resource changes

Jump to

Keyboard shortcuts

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