chore: update audit log api docs (#10486)

This commit is contained in:
Colin Adler 2023-11-02 11:12:38 -05:00 committed by GitHub
parent e756a95759
commit ac9c16864c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 65 deletions

11
coderd/apidoc/docs.go generated
View File

@ -222,14 +222,6 @@ const docTemplate = `{
"type": "string",
"description": "Search query",
"name": "q",
"in": "query",
"required": true
},
{
"type": "string",
"format": "uuid",
"description": "After ID",
"name": "after_id",
"in": "query"
},
{
@ -285,6 +277,9 @@ const docTemplate = `{
"204": {
"description": "No Content"
}
},
"x-apidocgen": {
"skip": true
}
}
},

View File

@ -184,14 +184,6 @@
"type": "string",
"description": "Search query",
"name": "q",
"in": "query",
"required": true
},
{
"type": "string",
"format": "uuid",
"description": "After ID",
"name": "after_id",
"in": "query"
},
{
@ -243,6 +235,9 @@
"204": {
"description": "No Content"
}
},
"x-apidocgen": {
"skip": true
}
}
},

View File

@ -30,8 +30,7 @@ import (
// @Security CoderSessionToken
// @Produce json
// @Tags Audit
// @Param q query string true "Search query"
// @Param after_id query string false "After ID" format(uuid)
// @Param q query string false "Search query"
// @Param limit query int false "Page limit"
// @Param offset query int false "Page offset"
// @Success 200 {object} codersdk.AuditLogResponse
@ -91,6 +90,7 @@ func (api *API) auditLogs(rw http.ResponseWriter, r *http.Request) {
// @Param request body codersdk.CreateTestAuditLogRequest true "Audit log request"
// @Success 204
// @Router /audit/testgenerate [post]
// @x-apidocgen {"skip": true}
func (api *API) generateFakeAuditLog(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()

53
docs/api/audit.md generated
View File

@ -6,7 +6,7 @@
```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/audit?q=string \
curl -X GET http://coder-server:8080/api/v2/audit \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
@ -15,12 +15,11 @@ curl -X GET http://coder-server:8080/api/v2/audit?q=string \
### Parameters
| Name | In | Type | Required | Description |
| ---------- | ----- | ------------ | -------- | ------------ |
| `q` | query | string | true | Search query |
| `after_id` | query | string(uuid) | false | After ID |
| `limit` | query | integer | false | Page limit |
| `offset` | query | integer | false | Page offset |
| Name | In | Type | Required | Description |
| -------- | ----- | ------- | -------- | ------------ |
| `q` | query | string | false | Search query |
| `limit` | query | integer | false | Page limit |
| `offset` | query | integer | false | Page offset |
### Example responses
@ -88,43 +87,3 @@ curl -X GET http://coder-server:8080/api/v2/audit?q=string \
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.AuditLogResponse](schemas.md#codersdkauditlogresponse) |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Generate fake audit log
### Code samples
```shell
# Example request using curl
curl -X POST http://coder-server:8080/api/v2/audit/testgenerate \
-H 'Content-Type: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`POST /audit/testgenerate`
> Body parameter
```json
{
"action": "create",
"additional_fields": [0],
"build_reason": "autostart",
"resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f",
"resource_type": "template",
"time": "2019-08-24T14:15:22Z"
}
```
### Parameters
| Name | In | Type | Required | Description |
| ------ | ---- | ---------------------------------------------------------------------------------- | -------- | ----------------- |
| `body` | body | [codersdk.CreateTestAuditLogRequest](schemas.md#codersdkcreatetestauditlogrequest) | true | Audit log request |
### Responses
| Status | Meaning | Description | Schema |
| ------ | --------------------------------------------------------------- | ----------- | ------ |
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
To perform this operation, you must be authenticated. [Learn more](authentication.md).