Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: consolidate url paths and use locator for api calls #148

Merged
merged 7 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,199 changes: 375 additions & 824 deletions api/openapispec/docs.go

Large diffs are not rendered by default.

1,125 changes: 360 additions & 765 deletions api/openapispec/swagger.json

Large diffs are not rendered by default.

1,105 changes: 317 additions & 788 deletions api/openapispec/swagger.yaml

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions pkg/core/handler/audit/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ import (

// 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 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'"
// @Success 200 {object} 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/insight/audit [get]
// @Summary Audit based on locator.
// @Description This endpoint audits based on the specified locator.
// @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'"
// @Success 200 {object} 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/insight/audit [get]
func Audit(auditMgr *audit.AuditManager) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Extract the context and logger from the request.
Expand Down Expand Up @@ -82,22 +82,22 @@ func Audit(auditMgr *audit.AuditManager) http.HandlerFunc {
// 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'"
// @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/insight/score [get]
// @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'"
// @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/insight/score [get]
func Score(auditMgr *audit.AuditManager) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Extract the context and logger from the request.
Expand Down
Loading
Loading