audit

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 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(auditMgr *audit.AuditManager) http.HandlerFunc

Audit handles the auditing process based on the specified locator.

@Summary Audit based on locator. @Description This endpoint audits based on the specified locator. @Tags audit @Accept json @Produce json @Param request body AuditPayload true "Locator for perform the audit" @Success 200 {array} audit.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 /api/v1/audit [post]

func AuditManifest added in v0.2.11

func AuditManifest(auditMgr *audit.AuditManager) http.HandlerFunc

AuditManifest returns an HTTP handler function that performs auditing of manifest data. It utilizes an AuditManager to execute the audit logic.

@Summary      AuditManifest audits the provided manifest.
@Description  This endpoint audits the provided manifest for issues.
@Tags         audit
@Accept       plain
@Accept       json
@Produce      json
@Param        request  body      AuditPayload   true  "Manifest data to audit (either plain text or JSON format)"
@Success      200      {array}   scanner.Issue  "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       /api/v1/audit/manifest [post]

func Score

func Score(auditMgr *audit.AuditManager) 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         audit
@Accept       text/plain
@Accept       application/json
@Produce      json
@Param        request  body      AuditPayload     true  "Manifest data to calculate score for (either plain text or JSON format)"
@Success      200      {object}  audit.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       /api/v1/audit/score [post]

Types

type AuditManifestPayload added in v0.2.11

type AuditManifestPayload struct {
	Manifest string `json:"manifest"` // Manifest is the content to be audited.
}

Payload represents the structure for audit request data. It includes the manifest which is typically a string containing declarative configuration data that needs to be audited.

func (*AuditManifestPayload) Decode added in v0.2.11

func (payload *AuditManifestPayload) Decode(r *http.Request) error

decode detects the correct decoder for use on an HTTP request and marshals into a given interface.

type AuditPayload added in v0.2.8

type AuditPayload struct {
	core.Locator `json:",inline"`
}

Payload represents the structure for audit request data. It includes the manifest which is typically a string containing declarative configuration data that needs to be audited.

func (*AuditPayload) Decode added in v0.2.8

func (payload *AuditPayload) Decode(r *http.Request) error

decode detects the correct decoder for use on an HTTP request and marshals into a given interface.

Jump to

Keyboard shortcuts

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