Documentation ¶
Overview ¶
Package recognizer implements functions that are used by every cobra cli command. Uses the enricher and model packages to return a result.
Index ¶
- Constants
- Variables
- func Analyze(path string) ([]model.Language, error)
- func AnalyzeFile(configFile string, targetLanguage string) (model.Language, error)
- func DetectComponents(path string) ([]model.Component, error)
- func DetectComponentsFromFilesList(files []string, settings model.DetectionSettings, ctx *context.Context) []model.Component
- func DetectComponentsInRoot(path string) ([]model.Component, error)
- func DetectComponentsInRootWithPathAndPortStartegy(path string, portDetectionStrategy []model.PortDetectionAlgorithm) ([]model.Component, error)
- func DetectComponentsInRootWithSettings(settings model.DetectionSettings) ([]model.Component, error)
- func DetectComponentsWithPathAndPortStartegy(path string, portDetectionStrategy []model.PortDetectionAlgorithm) ([]model.Component, error)
- func DetectComponentsWithSettings(settings model.DetectionSettings) ([]model.Component, error)
- func DetectComponentsWithoutPortDetection(path string) ([]model.Component, error)
- func GetUrlWithVersions(url, minSchemaVersion, maxSchemaVersion string) (string, error)
- func MatchDevfiles(path string, url string, filter model.DevfileFilter) ([]model.DevfileType, error)
- func SelectDevFileFromTypes(path string, devfileTypes []model.DevfileType) (int, error)
- func SelectDevFilesFromTypes(path string, devfileTypes []model.DevfileType) ([]int, error)
- func SelectDevfileFromRegistry(path string, url string) (model.DevfileType, error)
- func SelectDevfileUsingLanguagesFromTypes(languages []model.Language, devfileTypes []model.DevfileType) (int, error)
- func SelectDevfilesFromRegistry(path string, url string) ([]model.DevfileType, error)
- func SelectDevfilesUsingLanguagesFromTypes(languages []model.Language, devfileTypes []model.DevfileType) ([]int, error)
Constants ¶
const MinimumAllowedVersion = "2.0.0"
Variables ¶
var DownloadDevfileTypesFromRegistry = func(url string, filter model.DevfileFilter) ([]model.DevfileType, error) { url = adaptUrl(url) tmpUrl := appendIndexPath(url) url, err := GetUrlWithVersions(tmpUrl, filter.MinSchemaVersion, filter.MaxSchemaVersion) if err != nil { return nil, err } resp, err := http.Get(url) if err != nil { return []model.DevfileType{}, err } defer utils.CloseHttpResponseBody(resp) if resp.StatusCode != http.StatusOK { return []model.DevfileType{}, errors.New("unable to fetch devfiles from the registry") } body, err2 := io.ReadAll(resp.Body) if err2 != nil { return []model.DevfileType{}, errors.New("unable to fetch devfiles from the registry") } var devfileTypes []model.DevfileType err = json.Unmarshal(body, &devfileTypes) if err != nil { return []model.DevfileType{}, errors.New("unable to fetch devfiles from the registry") } return devfileTypes, nil }
DownloadDevfileTypesFromRegistry is exposed as a global variable for the purpose of running mock tests
Functions ¶
func AnalyzeFile ¶
func DetectComponentsFromFilesList ¶
func DetectComponentsFromFilesList(files []string, settings model.DetectionSettings, ctx *context.Context) []model.Component
DetectComponentsFromFilesList detect components by analyzing all files. Uses the settings to perform component detection on files.
func DetectComponentsInRootWithSettings ¶
func DetectComponentsInRootWithSettings(settings model.DetectionSettings) ([]model.Component, error)
func DetectComponentsWithSettings ¶
func DetectComponentsWithSettings(settings model.DetectionSettings) ([]model.Component, error)
func DetectComponentsWithoutPortDetection ¶ added in v1.1.3
func GetUrlWithVersions ¶ added in v1.0.1
func MatchDevfiles ¶ added in v1.0.1
func MatchDevfiles(path string, url string, filter model.DevfileFilter) ([]model.DevfileType, error)
func SelectDevFileFromTypes ¶
func SelectDevFileFromTypes(path string, devfileTypes []model.DevfileType) (int, error)
DEPRECATION WARNING: This function is deprecated, please use devfile_recognizer.MatchDevfiles instead. func SelectDevFileFromTypes: Returns the first devfile from the list of devfiles returned from SelectDevFilesFromTypes func. It also returns an error if exists.
func SelectDevFilesFromTypes ¶
func SelectDevFilesFromTypes(path string, devfileTypes []model.DevfileType) ([]int, error)
DEPRECATION WARNING: This function is deprecated, please use devfile_recognizer.MatchDevfiles instead. func SelectDevFilesFromTypes: Returns a list of devfiles matched for the given application
func SelectDevfileFromRegistry ¶ added in v1.1.2
func SelectDevfileFromRegistry(path string, url string) (model.DevfileType, error)
func SelectDevfileUsingLanguagesFromTypes ¶ added in v1.1.2
func SelectDevfilesFromRegistry ¶ added in v1.1.2
func SelectDevfilesFromRegistry(path string, url string) ([]model.DevfileType, error)
func SelectDevfilesUsingLanguagesFromTypes ¶ added in v1.1.2
Types ¶
This section is empty.