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 api managers #156

Merged
merged 2 commits into from
Dec 23, 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
300 changes: 142 additions & 158 deletions api/openapispec/docs.go

Large diffs are not rendered by default.

226 changes: 127 additions & 99 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/cluster.UploadData"
"$ref": "#/definitions/pkg_core_handler_cluster.UploadData"
}
},
"400": {
Expand Down Expand Up @@ -69,7 +69,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cluster.ValidatePayload"
"$ref": "#/definitions/pkg_core_handler_cluster.ValidatePayload"
}
}
],
Expand Down Expand Up @@ -196,7 +196,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cluster.ClusterPayload"
"$ref": "#/definitions/pkg_core_handler_cluster.ClusterPayload"
}
}
],
Expand Down Expand Up @@ -265,7 +265,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cluster.ClusterPayload"
"$ref": "#/definitions/pkg_core_handler_cluster.ClusterPayload"
}
}
],
Expand Down Expand Up @@ -494,7 +494,7 @@
"200": {
"description": "Audit results",
"schema": {
"$ref": "#/definitions/audit.AuditData"
"$ref": "#/definitions/pkg_core_handler_audit.AuditData"
}
},
"400": {
Expand Down Expand Up @@ -761,7 +761,7 @@
"200": {
"description": "Score calculation result",
"schema": {
"$ref": "#/definitions/audit.ScoreData"
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_core_manager_audit.ScoreData"
}
},
"400": {
Expand Down Expand Up @@ -843,7 +843,7 @@
"200": {
"description": "Resource Summary",
"schema": {
"$ref": "#/definitions/resource.ResourceSummary"
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_core_manager_insight.ResourceSummary"
}
},
"400": {
Expand Down Expand Up @@ -933,7 +933,7 @@
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/resource.ResourceTopology"
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_core_manager_insight.ResourceTopology"
}
}
},
Expand Down Expand Up @@ -1063,50 +1063,37 @@
}
},
"definitions": {
"audit.AuditData": {
"github_com_KusionStack_karbour_pkg_core.Locator": {
"type": "object",
"properties": {
"bySeverity": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
"apiVersion": {
"type": "string"
},
"issueGroups": {
"type": "array",
"items": {
"$ref": "#/definitions/audit.IssueGroup"
}
"cluster": {
"type": "string"
},
"issueTotal": {
"type": "integer"
"kind": {
"type": "string"
},
"resourceTotal": {
"type": "integer"
}
}
},
"audit.IssueGroup": {
"type": "object",
"properties": {
"issue": {
"$ref": "#/definitions/scanner.Issue"
"name": {
"type": "string"
},
"locators": {
"type": "array",
"items": {
"$ref": "#/definitions/core.Locator"
}
"namespace": {
"type": "string"
}
}
},
"audit.ScoreData": {
"github_com_KusionStack_karbour_pkg_core_manager_audit.ScoreData": {
"type": "object",
"properties": {
"issuesTotal": {
"description": "IssuesTotal is the total count of all issues found during the audit.\nThis count can be used to understand the overall number of problems\nthat need to be addressed.",
"type": "integer"
},
"resourceTotal": {
"description": "ResourceTotal is the count of unique resources audited during the scan.",
"type": "integer"
},
"score": {
"description": "Score represents the calculated score of the audited manifest based on\nthe number and severity of issues. It provides a quantitative measure\nof the security posture of the resources in the manifest.",
"type": "number"
Expand All @@ -1117,126 +1104,167 @@
"additionalProperties": {
"type": "integer"
}
},
"severitySum": {
"description": "SeveritySum is the sum of severity scores of all issues, which can be\nused to gauge the cumulative severity of all problems found.",
"type": "integer"
}
}
},
"cluster.ClusterPayload": {
"github_com_KusionStack_karbour_pkg_core_manager_insight.ResourceSummary": {
"type": "object",
"properties": {
"description": {
"description": "ClusterDescription is the description of cluster to be created",
"creationTimestamp": {
"type": "string"
},
"displayName": {
"description": "ClusterDisplayName is the display name of cluster to be created",
"resource": {
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_core.Locator"
},
"resourceVersion": {
"type": "string"
},
"kubeconfig": {
"description": "ClusterKubeConfig is the kubeconfig of cluster to be created",
"uid": {
"type": "string"
}
}
},
"cluster.UploadData": {
"github_com_KusionStack_karbour_pkg_core_manager_insight.ResourceTopology": {
"type": "object",
"properties": {
"content": {
"type": "string"
"children": {
"type": "array",
"items": {
"type": "string"
}
},
"fileName": {
"identifier": {
"type": "string"
},
"fileSize": {
"type": "integer"
}
}
},
"cluster.ValidatePayload": {
"type": "object",
"properties": {
"kubeConfig": {
"type": "string"
"parents": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"core.Locator": {
"github_com_KusionStack_karbour_pkg_scanner.Issue": {
"type": "object",
"properties": {
"apiVersion": {
"type": "string"
},
"cluster": {
"message": {
"description": "Message provides a detailed human-readable description of the issue.",
"type": "string"
},
"kind": {
"scanner": {
"description": "Scanner is the name of the scanner that discovered the issue.",
"type": "string"
},
"name": {
"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"
}
]
},
"namespace": {
"title": {
"description": "Title is a brief summary of the issue.",
"type": "string"
}
}
},
"resource.ResourceSummary": {
"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": {
"type": "object",
"properties": {
"creationTimestamp": {
"type": "string"
"bySeverity": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
},
"resource": {
"$ref": "#/definitions/core.Locator"
"issueGroups": {
"type": "array",
"items": {
"$ref": "#/definitions/pkg_core_handler_audit.IssueGroup"
}
},
"resourceVersion": {
"type": "string"
"issueTotal": {
"type": "integer"
},
"uid": {
"type": "string"
"resourceTotal": {
"type": "integer"
}
}
},
"resource.ResourceTopology": {
"pkg_core_handler_audit.IssueGroup": {
"type": "object",
"properties": {
"children": {
"issue": {
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_scanner.Issue"
},
"locators": {
"type": "array",
"items": {
"type": "string"
"$ref": "#/definitions/github_com_KusionStack_karbour_pkg_core.Locator"
}
}
}
},
"pkg_core_handler_cluster.ClusterPayload": {
"type": "object",
"properties": {
"description": {
"description": "ClusterDescription is the description of cluster to be created",
"type": "string"
},
"identifier": {
"displayName": {
"description": "ClusterDisplayName is the display name of cluster to be created",
"type": "string"
},
"parents": {
"type": "array",
"items": {
"type": "string"
}
"kubeconfig": {
"description": "ClusterKubeConfig is the kubeconfig of cluster to be created",
"type": "string"
}
}
},
"scanner.Issue": {
"pkg_core_handler_cluster.UploadData": {
"type": "object",
"properties": {
"message": {
"description": "Message provides a detailed human-readable description of the issue.",
"content": {
"type": "string"
},
"scanner": {
"description": "Scanner is the name of the scanner that discovered the issue.",
"fileName": {
"type": "string"
},
"severity": {
"description": "Severity indicates how critical the issue is, using the IssueSeverityLevel constants.",
"fileSize": {
"type": "integer"
},
"title": {
"description": "Title is a brief summary of the issue.",
}
}
},
"pkg_core_handler_cluster.ValidatePayload": {
"type": "object",
"properties": {
"kubeConfig": {
"type": "string"
}
}
Expand Down
Loading
Loading