Documentation
¶
Index ¶
- Constants
- func AddToArrayIfValueExist(arr *[]string, val string)
- func CloseFile(file *os.File)
- func CloseHttpResponseBody(resp *http.Response)
- func Contains(s []string, str string) bool
- func ConvertPropertiesFileAsPathToMap(path string) (map[string]string, error)
- func ConvertPropertiesFileToMap(fileInBytes []byte) (map[string]string, error)
- func FindAllPortsSubmatch(re *regexp.Regexp, text string, group int) []int
- func FindPortSubmatch(re *regexp.Regexp, text string, group int) int
- func FindPotentialPortGroup(re *regexp.Regexp, text string, group int) string
- func GenLogger(logLevel string) error
- func GenerateApplicationFileFromFilters(files []string, path string, suffix string, ctx *context.Context) []model.ApplicationFileInfo
- func GetAnyApplicationFilePath(root string, propsFiles []model.ApplicationFileInfo, ctx *context.Context) string
- func GetAnyApplicationFilePathExactMatch(root string, propsFiles []model.ApplicationFileInfo) string
- func GetApplicationFileBytes(propsFile model.ApplicationFileInfo) ([]byte, error)
- func GetApplicationFileContents(appFileInfos []model.ApplicationFileInfo) ([]string, error)
- func GetApplicationFileInfo(propsFiles []model.ApplicationFileInfo, filename string) (model.ApplicationFileInfo, error)
- func GetCachedFilePathsFromRoot(root string, ctx *context.Context) ([]string, error)
- func GetComposerJsonSchemaFromFile(path string) (schema.ComposerJson, error)
- func GetEnvVarPortValueFromDockerfile(path string, portPlaceholders []string) ([]int, error)
- func GetEnvVarsFromDockerFile(root string) ([]model.EnvVar, error)
- func GetFile(filePaths *[]string, wantedFile string) string
- func GetFilePathsFromRoot(root string) ([]string, error)
- func GetFilePathsInRoot(root string) ([]string, error)
- func GetFilesByRegex(filePaths *[]string, regexFile string) []string
- func GetLocations(root string) []string
- func GetOrCreateLogger() logr.Logger
- func GetPackageJsonSchemaFromFile(path string) (schema.PackageJson, error)
- func GetPomFileContent(pomFilePath string) (schema.Pom, error)
- func GetPortValueFromEnvFile(root string, regex string) int
- func GetPortValuesFromEnvFile(root string, regexes []string) []int
- func GetStringValueFromEnvFile(root string, regex string) string
- func GetValidPort(port string) (int, error)
- func GetValidPorts(ports []string) []int
- func GetValidPortsFromEnvDockerfile(envs []string, envVars []model.EnvVar) []int
- func GetValidPortsFromEnvs(envs []string) []int
- func IsPathOfWantedFile(path string, wantedFile string) bool
- func IsTagInComposerJsonFile(file string, tag string) bool
- func IsTagInFile(file string, tag string) (bool, error)
- func IsTagInPackageJsonFile(file string, tag string) bool
- func IsTagInPomXMLFile(pomFilePath string, tag string) (bool, error)
- func IsTagInPomXMLFileArtifactId(pomFilePath, groupId, artifactId string) (bool, error)
- func IsValidPort(port int) bool
- func NormalizeSplit(file string) (string, string)
- func PrintNoArgsWarningMessage(command string)
- func PrintPrettifyOutput(value interface{}, err error)
- func PrintWrongLoggingLevelMessage(command string)
- func ReadAnyApplicationFileExactMatch(root string, propsFiles []model.ApplicationFileInfo) ([]byte, error)
- func ReadPortsFromDockerfile(file io.Reader) []int
- func RedirectErrorStringToStdErrAndExit(err string)
- func RedirectErrorToStdErrAndExit(err error)
- type CLILogger
Constants ¶
const FRAMEWORK_WEIGHT = 10
const FROM_PORT = 0
const TOOL_WEIGHT = 5
const TO_PORT = 65535
Variables ¶
This section is empty.
Functions ¶
func AddToArrayIfValueExist ¶
func CloseHttpResponseBody ¶ added in v1.3.1
func ConvertPropertiesFileAsPathToMap ¶
ConvertPropertiesFileAsPathToMap fetches a file from a given path and transforms it into a map
func ConvertPropertiesFileToMap ¶
ConvertPropertiesFileAsPathToMap transforms a slice of bytes it into a map
func FindAllPortsSubmatch ¶
FindAllPortsSubmatch returns a slice of port int values, matching a regex inside a given text
func FindPortSubmatch ¶
FindPortSubMatch returns a port number in case it finds one for a given regex group
func FindPotentialPortGroup ¶
FindPotentialPortGroup returns a placeholder for port if is found
func GenerateApplicationFileFromFilters ¶ added in v1.2.0
func GenerateApplicationFileFromFilters(files []string, path string, suffix string, ctx *context.Context) []model.ApplicationFileInfo
GenerateApplicationFileFromFilters generates a slice of model.ApplicationFileInfo from a given list of files and the root path of a component. If suffix exists it generates items only for files ending with this suffix.
func GetAnyApplicationFilePath ¶
func GetAnyApplicationFilePath(root string, propsFiles []model.ApplicationFileInfo, ctx *context.Context) string
GetAnyApplicationFilePath returns the location of a file if it exists in the directory and the given file name is a substring.
func GetAnyApplicationFilePathExactMatch ¶
func GetAnyApplicationFilePathExactMatch(root string, propsFiles []model.ApplicationFileInfo) string
GetAnyApplicationFilePathExactMatch returns the location of a file if it exists in the directory and matches the given file name.
func GetApplicationFileBytes ¶ added in v1.2.0
func GetApplicationFileBytes(propsFile model.ApplicationFileInfo) ([]byte, error)
GetApplicationFileBytes returns a slice of bytes of a file if it exists in the directory and the given file name is a substring.
func GetApplicationFileContents ¶ added in v1.2.0
func GetApplicationFileContents(appFileInfos []model.ApplicationFileInfo) ([]string, error)
GetApplicationFileContents returns a slice of strings for all file contents found for a given slice of ApplicationFileInfo.
func GetApplicationFileInfo ¶ added in v1.2.0
func GetApplicationFileInfo(propsFiles []model.ApplicationFileInfo, filename string) (model.ApplicationFileInfo, error)
GetApplicationFileInfo returns an item from a slice of applicationFileInfos if it matches the given filename
func GetComposerJsonSchemaFromFile ¶
func GetComposerJsonSchemaFromFile(path string) (schema.ComposerJson, error)
GetComposerJsonSchemaFromFile returns the composer.json found in the path.
func GetEnvVarPortValueFromDockerfile ¶ added in v1.1.5
GetEnvVarPortValueFromDockerfile gets port value defined as env vars.
func GetEnvVarsFromDockerFile ¶ added in v1.1.5
GetEnvVarsFromDockerFile returns a slice of env vars from Dockerfiles in the given directory.
func GetFilePathsFromRoot ¶
GetFilePathsFromRoot walks the file tree starting from root and returns a slice of all file paths found. Ignores files from .gitignore if it exists.
func GetFilePathsInRoot ¶
GetFilePathsInRoot returns a slice of all files in the root.
func GetFilesByRegex ¶
GetFilesByRegex returns a slice of file paths from filePaths if the file name matches the regex.
func GetLocations ¶ added in v1.1.5
GetLocations returns a list of file paths representing common locations where Dockerfiles might be found within the specified 'root' directory and one level down.
It starts with a predefined list of common file names for a Dockerfile ('Dockerfile', 'Containerfile', 'dockerfile', 'containerfile'), and appends such file names to the 'root' subdirectories.
Note that hidden files and directories (starting with a dot, e.g., '.git') are ignored while traversing the 'root' directory.
func GetOrCreateLogger ¶
GetOrCreateLogger: Checks if the CliLogger is already created, otherwise it creates it with errorLevel
func GetPackageJsonSchemaFromFile ¶
func GetPackageJsonSchemaFromFile(path string) (schema.PackageJson, error)
GetPackageJsonSchemaFromFile returns the package.json found in the path.
func GetPomFileContent ¶
GetPomFileContent returns the pom found in the path.
func GetPortValueFromEnvFile ¶
GetPortValueFromEnvFile returns the first port value of a slice of port values declared from env var files.
func GetPortValuesFromEnvFile ¶
GetPortValuesFromEnvFile returns all port values found inside an env var file
func GetStringValueFromEnvFile ¶
GetStringValueFromEnvFile returns port values as string from env file
func GetValidPort ¶
GetValidPort checks if a string is a valid port and returns the port. Returns -1 if not a valid port.
func GetValidPorts ¶
GetValidPorts returns a slice of valid ports.
func GetValidPortsFromEnvDockerfile ¶ added in v1.1.5
GetValidPortsFromEnvs returns a slice of valid ports from a dockerfile.
func GetValidPortsFromEnvs ¶
GetValidPortsFromEnvs returns a slice of valid ports.
func IsPathOfWantedFile ¶
IsPathOfWantedFile checks if the file is in the path.
func IsTagInComposerJsonFile ¶
IsTagInComposerJsonFile checks if the file is a composer.json and contains the tag.
func IsTagInFile ¶
IsTagInFile checks if the file contains the tag.
func IsTagInPackageJsonFile ¶
IsTagInPackageJsonFile checks if the file is a package.json and contains the tag.
func IsTagInPomXMLFile ¶
IsTagInPomXMLFile checks if a pom file contains the tag.
func IsTagInPomXMLFileArtifactId ¶
IsTagInPomXMLFileArtifactId checks if a pom file contains the artifactId.
func IsValidPort ¶
IsValidPort checks if an integer is a valid port.
func NormalizeSplit ¶
NormalizeSplit splits a filepath into dir and filename
func PrintNoArgsWarningMessage ¶
func PrintNoArgsWarningMessage(command string)
func PrintPrettifyOutput ¶
func PrintPrettifyOutput(value interface{}, err error)
func PrintWrongLoggingLevelMessage ¶
func PrintWrongLoggingLevelMessage(command string)
func ReadAnyApplicationFileExactMatch ¶
func ReadAnyApplicationFileExactMatch(root string, propsFiles []model.ApplicationFileInfo) ([]byte, error)
ReadAnyApplicationFileExactMatch returns a byte slice if the exact given file exists in the directory.
func ReadPortsFromDockerfile ¶ added in v1.1.5
ReadPortsFromDockerfile returns a slice of port numbers.
func RedirectErrorStringToStdErrAndExit ¶
func RedirectErrorStringToStdErrAndExit(err string)
func RedirectErrorToStdErrAndExit ¶
func RedirectErrorToStdErrAndExit(err error)