scanner

package
v0.4.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Audit

func Audit(insight *insight.InsightManager) http.HandlerFunc

Audit handles the auditing process based on the specified resource group.

@Summary Audit based on resource group. @Description This endpoint audits based on the specified resource group. @Tags insight @Produce json @Param cluster query string false "The specified cluster name, such as 'example-cluster'" @Param apiVersion query string false "The specified apiVersion, such as 'apps/v1'" @Param kind query string false "The specified kind, such as 'Deployment'" @Param namespace query string false "The specified namespace, such as 'default'" @Param name query string false "The specified resource name, such as 'foo'" @Param forceNew query bool false "Switch for forced scanning, default is 'false'" @Success 200 {object} AuditData "Audit results" @Failure 400 {string} string "Bad Request" @Failure 401 {string} string "Unauthorized" @Failure 429 {string} string "Too Many Requests" @Failure 404 {string} string "Not Found" @Failure 500 {string} string "Internal Server Error" @Router /rest-api/v1/insight/audit [get]

func Score

func Score(insightMgr *insight.InsightManager) http.HandlerFunc

Score returns an HTTP handler function that calculates a score for the audited manifest. It utilizes an AuditManager to compute the score based on detected issues.

@Summary ScoreHandler calculates a score for the audited manifest. @Description This endpoint calculates a score for the provided manifest based on the number and severity of issues detected during the audit. @Tags insight @Produce json @Param cluster query string false "The specified cluster name, such as 'example-cluster'" @Param apiVersion query string false "The specified apiVersion, such as 'apps/v1'" @Param kind query string false "The specified kind, such as 'Deployment'" @Param namespace query string false "The specified namespace, such as 'default'" @Param name query string false "The specified resource name, such as 'foo'" @Param forceNew query bool false "Switch for forced compute score, default is 'false'" @Success 200 {object} insight.ScoreData "Score calculation result" @Failure 400 {string} string "Bad Request" @Failure 401 {string} string "Unauthorized" @Failure 429 {string} string "Too Many Requests" @Failure 404 {string} string "Not Found" @Failure 500 {string} string "Internal Server Error" @Router /rest-api/v1/insight/score [get]

Types

type AuditData

type AuditData struct {
	IssueTotal    int            `json:"issueTotal"`
	ResourceTotal int            `json:"resourceTotal"`
	BySeverity    map[string]int `json:"bySeverity"`
	IssueGroups   []*IssueGroup  `json:"issueGroups"`
}

AuditData represents the aggregated data of scanner issues, including the original list of issues and their aggregated count based on title.

type IssueGroup

type IssueGroup struct {
	Issue          scanner.Issue          `json:"issue"`
	ResourceGroups []entity.ResourceGroup `json:"resourceGroups"`
}

IssueGroup represents a group of resourceGroups tied to a specific issue.

Jump to

Keyboard shortcuts

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