mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
feat: add workspace build start/stop to audit log (#4744)
* adding workspace_build resource * added migration * fix keyword * got rid oof diffs for workspace builds * adding workspace name to string * renamed migrations * fixed lint * pass throough AdditionalFields and fix tests * no need to pass through each handler * cleaned up migrations * generated types; fixed missing cases * logging error
This commit is contained in:
7
coderd/database/dump.sql
generated
7
coderd/database/dump.sql
generated
@ -14,7 +14,9 @@ CREATE TYPE app_sharing_level AS ENUM (
|
||||
CREATE TYPE audit_action AS ENUM (
|
||||
'create',
|
||||
'write',
|
||||
'delete'
|
||||
'delete',
|
||||
'start',
|
||||
'stop'
|
||||
);
|
||||
|
||||
CREATE TYPE build_reason AS ENUM (
|
||||
@ -88,7 +90,8 @@ CREATE TYPE resource_type AS ENUM (
|
||||
'workspace',
|
||||
'git_ssh_key',
|
||||
'api_key',
|
||||
'group'
|
||||
'group',
|
||||
'workspace_build'
|
||||
);
|
||||
|
||||
CREATE TYPE user_status AS ENUM (
|
||||
|
@ -0,0 +1,2 @@
|
||||
-- It's not possible to drop enum values from enum types, so the UP has "IF NOT
|
||||
-- EXISTS".
|
4
coderd/database/migrations/000065_add_audit_enums.up.sql
Normal file
4
coderd/database/migrations/000065_add_audit_enums.up.sql
Normal file
@ -0,0 +1,4 @@
|
||||
ALTER TYPE audit_action ADD VALUE IF NOT EXISTS 'start';
|
||||
ALTER TYPE audit_action ADD VALUE IF NOT EXISTS 'stop';
|
||||
|
||||
ALTER TYPE resource_type ADD VALUE IF NOT EXISTS 'workspace_build';
|
@ -60,6 +60,8 @@ const (
|
||||
AuditActionCreate AuditAction = "create"
|
||||
AuditActionWrite AuditAction = "write"
|
||||
AuditActionDelete AuditAction = "delete"
|
||||
AuditActionStart AuditAction = "start"
|
||||
AuditActionStop AuditAction = "stop"
|
||||
)
|
||||
|
||||
func (e *AuditAction) Scan(src interface{}) error {
|
||||
@ -302,6 +304,7 @@ const (
|
||||
ResourceTypeGitSshKey ResourceType = "git_ssh_key"
|
||||
ResourceTypeApiKey ResourceType = "api_key"
|
||||
ResourceTypeGroup ResourceType = "group"
|
||||
ResourceTypeWorkspaceBuild ResourceType = "workspace_build"
|
||||
)
|
||||
|
||||
func (e *ResourceType) Scan(src interface{}) error {
|
||||
|
Reference in New Issue
Block a user