enricher

package
v0.0.0-...-80d5f3f Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

******************************************************************************

  • Copyright (c) 2022 Red Hat, Inc.
  • Distributed under license by Red Hat, Inc. All rights reserved.
  • This program is made available under the terms of the
  • Eclipse Public License v2.0 which accompanies this distribution,
  • and is available at http://www.eclipse.org/legal/epl-v20.html *
  • Contributors:
  • Red Hat, Inc. *****************************************************************************

Package enricher implements functions that detect the name and ports of a component. Uses three general strategies: Dockerfile, Compose, and Source. Dockerfile consists of using a dockerfile to extract information. Compose consists of using a compose file to extract information. Source consists of searching for specific statements of function invocations inside the source code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultProjectName

func GetDefaultProjectName(path string) string

func GetPortsFromDockerComposeFile

func GetPortsFromDockerComposeFile(componentPath string, settings model.DetectionSettings) []int

GetPortsFromDockerComposeFile returns a slice of port numbers from a compose file.

func GetPortsFromDockerFile

func GetPortsFromDockerFile(root string) []int

GetPortsFromDockerFile returns a slice of port numbers from Dockerfiles in the given directory.

func IsConfigurationValidForLanguage

func IsConfigurationValidForLanguage(language string, file string) bool

IsConfigurationValidForLanguage checks whether the file is valid for the language.

For example when analyzing a nodejs project, we could find a package.json within the node_modules folder. That is not to be considered valid for component detection.

Types

type DotNetEnricher

type DotNetEnricher struct{}

func (DotNetEnricher) DoEnrichComponent

func (d DotNetEnricher) DoEnrichComponent(component *model.Component, settings model.DetectionSettings, ctx *context.Context)

DoEnrichComponent checks for the port number using a Dockerfile or Compose file

func (DotNetEnricher) DoEnrichLanguage

func (d DotNetEnricher) DoEnrichLanguage(language *model.Language, files *[]string)

DoEnrichLanguage runs DoFrameworkDetection with found dot net project files. dot net project files: https://learn.microsoft.com/en-us/dotnet/core/project-sdk/overview#project-files

func (DotNetEnricher) GetSupportedLanguages

func (d DotNetEnricher) GetSupportedLanguages() []string

func (DotNetEnricher) IsConfigValidForComponentDetection

func (d DotNetEnricher) IsConfigValidForComponentDetection(language string, config string) bool

type Enricher

type Enricher interface {
	GetSupportedLanguages() []string
	DoEnrichLanguage(language *model.Language, files *[]string)
	DoEnrichComponent(component *model.Component, settings model.DetectionSettings, ctx *context.Context)
	IsConfigValidForComponentDetection(language string, configFile string) bool
}

func GetEnricherByLanguage

func GetEnricherByLanguage(language string) Enricher

GetEnricherByLanguage returns an enricher.

type FrameworkDetectorWithConfigFile

type FrameworkDetectorWithConfigFile interface {
	GetSupportedFrameworks() []string
	DoFrameworkDetection(language *model.Language, config string)
	DoPortsDetection(component *model.Component, ctx *context.Context)
}

type FrameworkDetectorWithoutConfigFile

type FrameworkDetectorWithoutConfigFile interface {
	GetSupportedFrameworks() []string
	DoFrameworkDetection(language *model.Language, files *[]string)
	DoPortsDetection(component *model.Component, ctx *context.Context)
}

type GoEnricher

type GoEnricher struct{}

func (GoEnricher) DoEnrichComponent

func (g GoEnricher) DoEnrichComponent(component *model.Component, settings model.DetectionSettings, ctx *context.Context)

DoEnrichComponent checks for the port number using a Dockerfile, Compose file, or Source strategy

func (GoEnricher) DoEnrichLanguage

func (g GoEnricher) DoEnrichLanguage(language *model.Language, files *[]string)

DoEnrichLanguage runs DoFrameworkDetection with found go project files. go project files: go.mod

func (GoEnricher) GetSupportedLanguages

func (g GoEnricher) GetSupportedLanguages() []string

func (GoEnricher) IsConfigValidForComponentDetection

func (g GoEnricher) IsConfigValidForComponentDetection(language string, config string) bool

type GoFrameworkDetector

type GoFrameworkDetector interface {
	GetSupportedFrameworks() []string
	DoFrameworkDetection(language *model.Language, goMod *modfile.File)
	DoPortsDetection(component *model.Component, ctx *context.Context)
}

type JavaEnricher

type JavaEnricher struct{}

func (JavaEnricher) DoEnrichComponent

func (j JavaEnricher) DoEnrichComponent(component *model.Component, settings model.DetectionSettings, ctx *context.Context)

DoEnrichComponent checks for the port number using a Dockerfile, Compose file, or Source strategy

func (JavaEnricher) DoEnrichLanguage

func (j JavaEnricher) DoEnrichLanguage(language *model.Language, files *[]string)

DoEnrichLanguage runs DoFrameworkDetection with found java project files. java project files: build.gradle, pom.xml, build.xml

func (JavaEnricher) GetSupportedLanguages

func (j JavaEnricher) GetSupportedLanguages() []string

func (JavaEnricher) IsConfigValidForComponentDetection

func (j JavaEnricher) IsConfigValidForComponentDetection(language string, config string) bool

type JavaScriptEnricher

type JavaScriptEnricher struct{}

func (JavaScriptEnricher) DoEnrichComponent

func (j JavaScriptEnricher) DoEnrichComponent(component *model.Component, settings model.DetectionSettings, ctx *context.Context)

DoEnrichComponent checks for the port number using a Dockerfile, Compose file, or Source strategy

func (JavaScriptEnricher) DoEnrichLanguage

func (j JavaScriptEnricher) DoEnrichLanguage(language *model.Language, files *[]string)

DoEnrichLanguage runs DoFrameworkDetection with found javascript project files. javascript project files: package.json

func (JavaScriptEnricher) GetSupportedLanguages

func (j JavaScriptEnricher) GetSupportedLanguages() []string

func (JavaScriptEnricher) IsConfigValidForComponentDetection

func (j JavaScriptEnricher) IsConfigValidForComponentDetection(language string, config string) bool

type PHPEnricher

type PHPEnricher struct{}

func (PHPEnricher) DoEnrichComponent

func (p PHPEnricher) DoEnrichComponent(component *model.Component, settings model.DetectionSettings, ctx *context.Context)

DoEnrichComponent checks for the port number using a Dockerfile, Compose file, or Source strategy

func (PHPEnricher) DoEnrichLanguage

func (p PHPEnricher) DoEnrichLanguage(language *model.Language, files *[]string)

DoEnrichLanguage runs DoFrameworkDetection with found php project files. php project files: composer.json

func (PHPEnricher) GetSupportedLanguages

func (p PHPEnricher) GetSupportedLanguages() []string

func (PHPEnricher) IsConfigValidForComponentDetection

func (p PHPEnricher) IsConfigValidForComponentDetection(language string, config string) bool

type PythonEnricher

type PythonEnricher struct{}

func (PythonEnricher) DoEnrichComponent

func (p PythonEnricher) DoEnrichComponent(component *model.Component, settings model.DetectionSettings, ctx *context.Context)

DoEnrichComponent checks for the port number using a Dockerfile, Compose file, or Source strategy

func (PythonEnricher) DoEnrichLanguage

func (p PythonEnricher) DoEnrichLanguage(language *model.Language, files *[]string)

DoEnrichLanguage runs DoFrameworkDetection with files. No specific file is targeted, will use everything in files.

func (PythonEnricher) GetSupportedLanguages

func (p PythonEnricher) GetSupportedLanguages() []string

func (PythonEnricher) IsConfigValidForComponentDetection

func (p PythonEnricher) IsConfigValidForComponentDetection(language string, config string) bool

Directories

Path Synopsis
framework
go
php

Jump to

Keyboard shortcuts

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