Skip to content

Commit

Permalink
fix: invalid query parse for audit and score api (#153)
Browse files Browse the repository at this point in the history
## What type of PR is this?
/kind bug

## What this PR does / why we need it:

Fix invalid query parse for audit and score api
  • Loading branch information
elliotxx authored Dec 22, 2023
1 parent 1b4adcc commit 23b3ed2
Show file tree
Hide file tree
Showing 15 changed files with 592 additions and 639 deletions.
292 changes: 154 additions & 138 deletions api/openapispec/docs.go

Large diffs are not rendered by default.

218 changes: 95 additions & 123 deletions api/openapispec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"200": {
"description": "Returns the content of the uploaded KubeConfig file.",
"schema": {
"$ref": "#/definitions/pkg_core_handler_cluster.UploadData"
"$ref": "#/definitions/cluster.UploadData"
}
},
"400": {
Expand Down Expand Up @@ -69,7 +69,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/pkg_core_handler_cluster.ValidatePayload"
"$ref": "#/definitions/cluster.ValidatePayload"
}
}
],
Expand Down Expand Up @@ -196,7 +196,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/pkg_core_handler_cluster.ClusterPayload"
"$ref": "#/definitions/cluster.ClusterPayload"
}
}
],
Expand Down Expand Up @@ -265,7 +265,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/pkg_core_handler_cluster.ClusterPayload"
"$ref": "#/definitions/cluster.ClusterPayload"
}
}
],
Expand Down Expand Up @@ -494,7 +494,7 @@
"200": {
"description": "Audit results",
"schema": {
"$ref": "#/definitions/pkg_core_handler_audit.AuditData"
"$ref": "#/definitions/audit.AuditData"
}
},
"400": {
Expand Down Expand Up @@ -761,7 +761,7 @@
"200": {
"description": "Score calculation result",
"schema": {
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_core_manager_audit.ScoreData"
"$ref": "#/definitions/audit.ScoreData"
}
},
"400": {
Expand Down Expand Up @@ -843,7 +843,7 @@
"200": {
"description": "Resource Summary",
"schema": {
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_core_manager_resource.ResourceSummary"
"$ref": "#/definitions/resource.ResourceSummary"
}
},
"400": {
Expand Down Expand Up @@ -933,7 +933,7 @@
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_core_manager_resource.ResourceTopology"
"$ref": "#/definitions/resource.ResourceTopology"
}
}
},
Expand Down Expand Up @@ -1063,27 +1063,44 @@
}
},
"definitions": {
"github_com_KusionStack_karbour_pkg_core.Locator": {
"audit.AuditData": {
"type": "object",
"properties": {
"apiVersion": {
"type": "string"
"bySeverity": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
},
"cluster": {
"type": "string"
"issueGroups": {
"type": "array",
"items": {
"$ref": "#/definitions/audit.IssueGroup"
}
},
"kind": {
"type": "string"
"issueTotal": {
"type": "integer"
},
"name": {
"type": "string"
"resourceTotal": {
"type": "integer"
}
}
},
"audit.IssueGroup": {
"type": "object",
"properties": {
"issue": {
"$ref": "#/definitions/scanner.Issue"
},
"namespace": {
"type": "string"
"locators": {
"type": "array",
"items": {
"$ref": "#/definitions/core.Locator"
}
}
}
},
"github_com_KusionStack_karbour_pkg_core_manager_audit.ScoreData": {
"audit.ScoreData": {
"type": "object",
"properties": {
"issuesTotal": {
Expand All @@ -1107,164 +1124,119 @@
}
}
},
"github_com_KusionStack_karbour_pkg_core_manager_resource.ResourceSummary": {
"cluster.ClusterPayload": {
"type": "object",
"properties": {
"creationTimestamp": {
"description": {
"description": "ClusterDescription is the description of cluster to be created",
"type": "string"
},
"resource": {
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_core.Locator"
},
"resourceVersion": {
"displayName": {
"description": "ClusterDisplayName is the display name of cluster to be created",
"type": "string"
},
"uid": {
"kubeconfig": {
"description": "ClusterKubeConfig is the kubeconfig of cluster to be created",
"type": "string"
}
}
},
"github_com_KusionStack_karbour_pkg_core_manager_resource.ResourceTopology": {
"cluster.UploadData": {
"type": "object",
"properties": {
"children": {
"type": "array",
"items": {
"type": "string"
}
"content": {
"type": "string"
},
"identifier": {
"fileName": {
"type": "string"
},
"parents": {
"type": "array",
"items": {
"type": "string"
}
"fileSize": {
"type": "integer"
}
}
},
"github_com_KusionStack_karbour_pkg_scanner.Issue": {
"cluster.ValidatePayload": {
"type": "object",
"properties": {
"message": {
"description": "Message provides a detailed human-readable description of the issue.",
"kubeConfig": {
"type": "string"
}
}
},
"core.Locator": {
"type": "object",
"properties": {
"apiVersion": {
"type": "string"
},
"scanner": {
"description": "Scanner is the name of the scanner that discovered the issue.",
"cluster": {
"type": "string"
},
"severity": {
"description": "Severity indicates how critical the issue is, using the IssueSeverityLevel constants.",
"allOf": [
{
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_scanner.IssueSeverityLevel"
}
]
"kind": {
"type": "string"
},
"title": {
"description": "Title is a brief summary of the issue.",
"name": {
"type": "string"
},
"namespace": {
"type": "string"
}
}
},
"github_com_KusionStack_karbour_pkg_scanner.IssueSeverityLevel": {
"type": "integer",
"enum": [
0,
1,
2,
3,
5
],
"x-enum-comments": {
"Critical": "Critical indicates an extremely serious issue that must be addressed immediately.",
"High": "High indicates a serious issue that has a significant impact.",
"Low": "Low indicates a minor issue that should be addressed.",
"Medium": "Medium indicates a potential issue that may have a moderate impact.",
"Safe": "Safe indicates the absence of any security risk or an informational finding that does not require action."
},
"x-enum-varnames": [
"Safe",
"Low",
"Medium",
"High",
"Critical"
]
},
"pkg_core_handler_audit.AuditData": {
"resource.ResourceSummary": {
"type": "object",
"properties": {
"bySeverity": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
"creationTimestamp": {
"type": "string"
},
"issueGroups": {
"type": "array",
"items": {
"$ref": "#/definitions/pkg_core_handler_audit.IssueGroup"
}
"resource": {
"$ref": "#/definitions/core.Locator"
},
"issueTotal": {
"type": "integer"
"resourceVersion": {
"type": "string"
},
"resourceTotal": {
"type": "integer"
"uid": {
"type": "string"
}
}
},
"pkg_core_handler_audit.IssueGroup": {
"resource.ResourceTopology": {
"type": "object",
"properties": {
"issue": {
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_scanner.Issue"
},
"locators": {
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_core.Locator"
"type": "string"
}
}
}
},
"pkg_core_handler_cluster.ClusterPayload": {
"type": "object",
"properties": {
"description": {
"description": "ClusterDescription is the description of cluster to be created",
"type": "string"
},
"displayName": {
"description": "ClusterDisplayName is the display name of cluster to be created",
"identifier": {
"type": "string"
},
"kubeconfig": {
"description": "ClusterKubeConfig is the kubeconfig of cluster to be created",
"type": "string"
"parents": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"pkg_core_handler_cluster.UploadData": {
"scanner.Issue": {
"type": "object",
"properties": {
"content": {
"message": {
"description": "Message provides a detailed human-readable description of the issue.",
"type": "string"
},
"fileName": {
"scanner": {
"description": "Scanner is the name of the scanner that discovered the issue.",
"type": "string"
},
"fileSize": {
"severity": {
"description": "Severity indicates how critical the issue is, using the IssueSeverityLevel constants.",
"type": "integer"
}
}
},
"pkg_core_handler_cluster.ValidatePayload": {
"type": "object",
"properties": {
"kubeConfig": {
},
"title": {
"description": "Title is a brief summary of the issue.",
"type": "string"
}
}
Expand Down
Loading

0 comments on commit 23b3ed2

Please sign in to comment.