feat: audit addition and removal of licenses (#6125)

* added license audit resource

* audit delete licenses

* added filtering

* remove logs

* making the best of the current UUID situation

* fixed lint

* fix tests

* regen docs

* PR feedback

* PR feedback
This commit is contained in:
Kira Pilot
2023-02-14 16:34:13 -05:00
committed by GitHub
parent 6e3330a03f
commit 5e60879fb8
15 changed files with 94 additions and 23 deletions
+2 -1
View File
@@ -93,7 +93,8 @@ CREATE TYPE resource_type AS ENUM (
'git_ssh_key',
'api_key',
'group',
'workspace_build'
'workspace_build',
'license'
);
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".
@@ -0,0 +1,3 @@
ALTER TYPE resource_type
ADD VALUE IF NOT EXISTS 'license';
+4 -1
View File
@@ -883,6 +883,7 @@ const (
ResourceTypeApiKey ResourceType = "api_key"
ResourceTypeGroup ResourceType = "group"
ResourceTypeWorkspaceBuild ResourceType = "workspace_build"
ResourceTypeLicense ResourceType = "license"
)
func (e *ResourceType) Scan(src interface{}) error {
@@ -930,7 +931,8 @@ func (e ResourceType) Valid() bool {
ResourceTypeGitSshKey,
ResourceTypeApiKey,
ResourceTypeGroup,
ResourceTypeWorkspaceBuild:
ResourceTypeWorkspaceBuild,
ResourceTypeLicense:
return true
}
return false
@@ -947,6 +949,7 @@ func AllResourceTypeValues() []ResourceType {
ResourceTypeApiKey,
ResourceTypeGroup,
ResourceTypeWorkspaceBuild,
ResourceTypeLicense,
}
}