types

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandExecutor

type CommandExecutor interface {
	// ExecuteCommand executes a command with the given name, arguments, and environment variables.
	// It returns the standard output, standard error, and any error that occurred during execution.
	ExecuteCommand(name string, args []string, env []string) (stdout string, stderr string, err error)
}

CommandExecutor is an interface for executing commands.

type HTTPClientInterface

type HTTPClientInterface interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClientInterface is an abstraction that allows for easier testing by mocking HTTP responses. It defines a single method, Do, which takes an http.Request and returns an http.Response and an error.

type Logger

type Logger interface {
	// Debug logs a debug message with the given fields.
	Debug(msg string, fields ...interface{})
	// Info logs an info message with the given fields.
	Info(msg string, fields ...interface{})
	// Warn logs a warn message with the given fields.
	Warn(msg string, fields ...interface{})
	// Error logs an error message with the given fields.
	Error(msg string, fields ...interface{})
	// Fatalf logs a fatal message with the given fields.
	Fatalf(msg string, fields ...interface{})
}

Logger is the interface that the logger must implement.

type RealHTTPClient

type RealHTTPClient struct {
	Client *http.Client
}

RealHTTPClient is a concrete implementation of HTTPClientInterface that uses a real http.Client to make requests.

func NewRealHTTPClient

func NewRealHTTPClient() *RealHTTPClient

NewRealHTTPClient creates a new instance of RealHTTPClient with a default http.Client. The http.Client can be customized as needed, for example, by setting timeouts.

func (*RealHTTPClient) Do

func (c *RealHTTPClient) Do(req *http.Request) (*http.Response, error)

Do sends an HTTP request using the underlying http.Client and returns the response. It satisfies the HTTPClientInterface by implementing the Do method.

type ScanResult

type ScanResult struct {
	ArtifactName string `json:"ArtifactName"`
	Results      []struct {
		Vulnerabilities []VulnerabilityInfo `json:"Vulnerabilities"`
	} `json:"Results"`
}

ScanResult represents the result of scanning an artifact for vulnerabilities.

type ScanResultReader

type ScanResultReader interface {
	// GetArtifactName returns the name of the scanned artifact.
	GetArtifactName() string
	// GetVulnerabilities returns a slice of VulnerabilityInfo representing the vulnerabilities
	// found in the scanned artifact.
	GetVulnerabilities() []VulnerabilityInfo
	// GetResultsAsCSV returns the scan results in CSV format.
	GetResultsAsCSV() string
}

ScanResultReader is an interface for reading scan results.

type VulnerabilityInfo

type VulnerabilityInfo struct {
	VulnerabilityID  string `json:"VulnerabilityID"`
	PkgName          string `json:"PkgName"`
	InstalledVersion string `json:"InstalledVersion"`
	FixedVersion     string `json:"FixedVersion"`
	Severity         string `json:"Severity"`
	Description      string `json:"Description"`
}

VulnerabilityInfo represents information about a vulnerability found in a scanned artifact.

Jump to

Keyboard shortcuts

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