scanner

package
v0.3.29-beta.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

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