From 2515eabfa1a57d534349a3f3af6ebfa70a0c8eba Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Thu, 2 Nov 2023 02:39:35 +0000 Subject: [PATCH] chore: update audit log api docs --- coderd/apidoc/docs.go | 11 +++----- coderd/apidoc/swagger.json | 11 +++----- coderd/audit.go | 4 +-- docs/api/audit.md | 53 +++++--------------------------------- 4 files changed, 14 insertions(+), 65 deletions(-) diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 991f5095870f3..f0f449f3b57b2 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -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 } } }, diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 34c599bb9a04b..68bf8d19d2d37 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -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 } } }, diff --git a/coderd/audit.go b/coderd/audit.go index b0d75d1a5bf91..d6b20a292916c 100644 --- a/coderd/audit.go +++ b/coderd/audit.go @@ -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() diff --git a/docs/api/audit.md b/docs/api/audit.md index 5efe1f3410809..5630372601e5f 100644 --- a/docs/api/audit.md +++ b/docs/api/audit.md @@ -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).