Skip to content

Commit

Permalink
docs: add /server-configs (#769)
Browse files Browse the repository at this point in the history
## What type of PR is this?
/kind documentation

<!--
Add one of the following kinds:
/kind bug
/kind cleanup
/kind refactor
/kind documentation
/kind feature
/kind chore
/kind perf
/kind style
/kind test
-->

## What this PR does / why we need it:
Include /server-configs endpoint details in Swagger documentation. 
Missing line breaks in the description field of docs/api.md.


## Which issue(s) this PR fixes:

<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related
issues/tests in a comment and do not use `Fixes`_*
-->

Fixes #
  • Loading branch information
jinjiaKarl authored Feb 2, 2025
1 parent 4dfef39 commit 6a9df0b
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 12 deletions.
21 changes: 21 additions & 0 deletions api/openapispec/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2103,6 +2103,27 @@ var doc = `{
}
}
}
},
"/server-configs": {
"get": {
"description": "Returns server configuration",
"produces": [
"application/json"
],
"tags": [
"debug"
],
"summary": "Get server configurations",
"responses": {
"200": {
"description": "Server configurations",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
},
"definitions": {
Expand Down
21 changes: 21 additions & 0 deletions api/openapispec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2087,6 +2087,27 @@
}
}
}
},
"/server-configs": {
"get": {
"description": "Returns server configuration",
"produces": [
"application/json"
],
"tags": [
"debug"
],
"summary": "Get server configurations",
"responses": {
"200": {
"description": "Server configurations",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
},
"definitions": {
Expand Down
14 changes: 14 additions & 0 deletions api/openapispec/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1658,4 +1658,18 @@ paths:
using the query from context.
tags:
- search
/server-configs:
get:
description: Returns server configuration
produces:
- application/json
responses:
"200":
description: Server configurations
schema:
additionalProperties: true
type: object
summary: Get server configurations
tags:
- debug
swagger: "2.0"
45 changes: 33 additions & 12 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Karpor is a brand new Kubernetes visualization tool that focuses on search, insi
| Method | URI | Name | Summary |
|---------|---------|--------|---------|
| GET | /endpoints | [get endpoints](#get-endpoints) | List all available endpoints |
| GET | /server-configs | [get server configs](#get-server-configs) | Get server configurations |



Expand Down Expand Up @@ -1793,6 +1794,34 @@ Status: Internal Server Error



### <span id="get-server-configs"></span> Get server configurations (*GetServerConfigs*)

```
GET /server-configs
```

Returns server configuration

#### Produces
* application/json

#### All responses
| Code | Status | Description | Has headers | Schema |
|------|--------|-------------|:-----------:|--------|
| [200](#get-server-configs-200) | OK | Server configurations | | [schema](#get-server-configs-200-schema) |

#### Responses


##### <span id="get-server-configs-200"></span> 200 - Server configurations
Status: OK

###### <span id="get-server-configs-200-schema"></span> Schema



any

### <span id="post-insight-aggregator-event-diagnosis-stream"></span> Diagnose events using AI (*PostInsightAggregatorEventDiagnosisStream*)

```
Expand Down Expand Up @@ -2894,16 +2923,10 @@ Status: Internal Server Error

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| issuesTotal | integer| `int64` | | | IssuesTotal is the total count of all issues found during the audit.
This count can be used to understand the overall number of problems
that need to be addressed. | |
| issuesTotal | integer| `int64` | | | IssuesTotal is the total count of all issues found during the audit.</br>This count can be used to understand the overall number of problems</br>that need to be addressed. | |
| resourceTotal | integer| `int64` | | | ResourceTotal is the count of unique resources audited during the scan. | |
| score | number| `float64` | | | Score represents the calculated score of the audited manifest based on
the number and severity of issues. It provides a quantitative measure
of the security posture of the resources in the manifest. | |
| severityStatistic | map of integer| `map[string]int64` | | | SeverityStatistic is a mapping of severity levels to their respective
number of occurrences. It allows for a quick overview of the distribution
of issues across different severity categories. | |
| score | number| `float64` | | | Score represents the calculated score of the audited manifest based on</br>the number and severity of issues. It provides a quantitative measure</br>of the security posture of the resources in the manifest. | |
| severityStatistic | map of integer| `map[string]int64` | | | SeverityStatistic is a mapping of severity levels to their respective</br>number of occurrences. It allows for a quick overview of the distribution</br>of issues across different severity categories. | |



Expand Down Expand Up @@ -2986,8 +3009,6 @@ of issues across different severity categories. | |

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| object | [interface{}](#interface)| `interface{}` | | | Object is a JSON compatible map with string, float, int, bool, []interface{}, or
map[string]interface{}
children. | |
| object | [interface{}](#interface)| `interface{}` | | | Object is a JSON compatible map with string, float, int, bool, []interface{}, or</br>map[string]interface{}</br>children. | |


6 changes: 6 additions & 0 deletions pkg/core/route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ func setupRestAPIV1(
r.Get("/authn", authnhandler.Get())
}

// @Summary Get server configurations
// @Description Returns server configuration
// @Tags debug
// @Produce json
// @Success 200 {object} map[string]interface{} "Server configurations"
// @Router /server-configs [get]
func customVarHandler() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
Expand Down

0 comments on commit 6a9df0b

Please sign in to comment.