Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b928fff

Browse files
committed
enums
1 parent 9f9aea9 commit b928fff

File tree

5 files changed

+59
-10
lines changed

5 files changed

+59
-10
lines changed

coderd/apidoc/docs.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,13 +1193,31 @@ const docTemplate = `{
11931193
"type": "object",
11941194
"properties": {
11951195
"action": {
1196-
"type": "string"
1196+
"type": "string",
1197+
"enum": [
1198+
"create",
1199+
"write",
1200+
"delete",
1201+
"start",
1202+
"stop"
1203+
]
11971204
},
11981205
"resource_id": {
11991206
"type": "string"
12001207
},
12011208
"resource_type": {
1202-
"type": "string"
1209+
"type": "string",
1210+
"enum": [
1211+
"organization",
1212+
"template",
1213+
"template_version",
1214+
"user",
1215+
"workspace",
1216+
"workspace_build",
1217+
"git_ssh_key",
1218+
"api_key",
1219+
"group"
1220+
]
12031221
},
12041222
"time": {
12051223
"type": "string"

coderd/apidoc/swagger.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,13 +1059,25 @@
10591059
"type": "object",
10601060
"properties": {
10611061
"action": {
1062-
"type": "string"
1062+
"type": "string",
1063+
"enum": ["create", "write", "delete", "start", "stop"]
10631064
},
10641065
"resource_id": {
10651066
"type": "string"
10661067
},
10671068
"resource_type": {
1068-
"type": "string"
1069+
"type": "string",
1070+
"enum": [
1071+
"organization",
1072+
"template",
1073+
"template_version",
1074+
"user",
1075+
"workspace",
1076+
"workspace_build",
1077+
"git_ssh_key",
1078+
"api_key",
1079+
"group"
1080+
]
10691081
},
10701082
"time": {
10711083
"type": "string"

codersdk/audit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ type AuditLogResponse struct {
121121
}
122122

123123
type CreateTestAuditLogRequest struct {
124-
Action AuditAction `json:"action,omitempty"`
125-
ResourceType ResourceType `json:"resource_type,omitempty"`
124+
Action AuditAction `json:"action,omitempty" enums:"create,write,delete,start,stop"`
125+
ResourceType ResourceType `json:"resource_type,omitempty" enums:"organization,template,template_version,user,workspace,workspace_build,git_ssh_key,api_key,group"`
126126
ResourceID uuid.UUID `json:"resource_id,omitempty"`
127127
Time time.Time `json:"time,omitempty"`
128128
}

docs/api/audit.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ curl -X POST http://coder-server:8080/api/v2/audit/testgenerate \
107107
108108
```json
109109
{
110-
"action": "string",
110+
"action": "create",
111111
"resource_id": "string",
112-
"resource_type": "string",
112+
"resource_type": "organization",
113113
"time": "string"
114114
}
115115
```

docs/api/schemas.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,9 @@ CreateParameterRequest is a structure used to create a new parameter value for a
386386

387387
```json
388388
{
389-
"action": "string",
389+
"action": "create",
390390
"resource_id": "string",
391-
"resource_type": "string",
391+
"resource_type": "organization",
392392
"time": "string"
393393
}
394394
```
@@ -402,6 +402,25 @@ CreateParameterRequest is a structure used to create a new parameter value for a
402402
| `resource_type` | string | false | | |
403403
| `time` | string | false | | |
404404

405+
#### Enumerated Values
406+
407+
| Property | Value |
408+
| --------------- | ------------------ |
409+
| `action` | `create` |
410+
| `action` | `write` |
411+
| `action` | `delete` |
412+
| `action` | `start` |
413+
| `action` | `stop` |
414+
| `resource_type` | `organization` |
415+
| `resource_type` | `template` |
416+
| `resource_type` | `template_version` |
417+
| `resource_type` | `user` |
418+
| `resource_type` | `workspace` |
419+
| `resource_type` | `workspace_build` |
420+
| `resource_type` | `git_ssh_key` |
421+
| `resource_type` | `api_key` |
422+
| `resource_type` | `group` |
423+
405424
## codersdk.DERP
406425

407426
```json

0 commit comments

Comments
 (0)