Port over 162 and 165 to master (#176)
Co-authored-by: Jim Lambert <jlambert@hashicorp.com> Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
This commit is contained in:
48 files changed
+2791
-772
No files matched your search
@@ -6,27 +6,39 @@ type Type int
|
||||
|
||||
// not using iota intentionally, since the values are stored in the db as well.
|
||||
const (
|
||||
Unknown Type = 0
|
||||
List Type = 1
|
||||
Create Type = 2
|
||||
Update Type = 3
|
||||
Read Type = 4
|
||||
Delete Type = 5
|
||||
Authen Type = 6
|
||||
All Type = 7
|
||||
Connect Type = 8
|
||||
Unknown Type = 0
|
||||
List Type = 1
|
||||
Create Type = 2
|
||||
Update Type = 3
|
||||
Read Type = 4
|
||||
Delete Type = 5
|
||||
Authenticate Type = 6
|
||||
All Type = 7
|
||||
Connect Type = 8
|
||||
AddGrants Type = 9
|
||||
RemoveGrants Type = 10
|
||||
SetGrants Type = 11
|
||||
AddPrincipals Type = 12
|
||||
SetPrincipals Type = 13
|
||||
RemovePrincipals Type = 14
|
||||
)
|
||||
|
||||
var Map = map[string]Type{
|
||||
"unknown": Unknown,
|
||||
"list": List,
|
||||
"create": Create,
|
||||
"update": Update,
|
||||
"read": Read,
|
||||
"delete": Delete,
|
||||
"authen": Authen,
|
||||
"*": All,
|
||||
"connect": Connect,
|
||||
"unknown": Unknown,
|
||||
"list": List,
|
||||
"create": Create,
|
||||
"update": Update,
|
||||
"read": Read,
|
||||
"delete": Delete,
|
||||
"authenticate": Authenticate,
|
||||
"*": All,
|
||||
"connect": Connect,
|
||||
"add-grants": AddGrants,
|
||||
"remove-grants": RemoveGrants,
|
||||
"set-grants": SetGrants,
|
||||
"add-principals": AddPrincipals,
|
||||
"set-principals": SetPrincipals,
|
||||
"remove-principals": RemovePrincipals,
|
||||
}
|
||||
|
||||
func (a Type) String() string {
|
||||
@@ -37,8 +49,14 @@ func (a Type) String() string {
|
||||
"update",
|
||||
"read",
|
||||
"delete",
|
||||
"authen",
|
||||
"authenticate",
|
||||
"*",
|
||||
"connect",
|
||||
"add-grants",
|
||||
"remove-grants",
|
||||
"set-grants",
|
||||
"add-principals",
|
||||
"set-principals",
|
||||
"remove-principals",
|
||||
}[a]
|
||||
}
|
||||
@@ -36,8 +36,8 @@ func TestAction(t *testing.T) {
|
||||
want: "delete",
|
||||
},
|
||||
{
|
||||
action: Authen,
|
||||
want: "authen",
|
||||
action: Authenticate,
|
||||
want: "authenticate",
|
||||
},
|
||||
{
|
||||
action: All,
|
||||
@@ -47,6 +47,30 @@ func TestAction(t *testing.T) {
|
||||
action: Connect,
|
||||
want: "connect",
|
||||
},
|
||||
{
|
||||
action: AddGrants,
|
||||
want: "add-grants",
|
||||
},
|
||||
{
|
||||
action: RemoveGrants,
|
||||
want: "remove-grants",
|
||||
},
|
||||
{
|
||||
action: SetGrants,
|
||||
want: "set-grants",
|
||||
},
|
||||
{
|
||||
action: AddPrincipals,
|
||||
want: "add-principals",
|
||||
},
|
||||
{
|
||||
action: RemovePrincipals,
|
||||
want: "remove-principals",
|
||||
},
|
||||
{
|
||||
action: SetPrincipals,
|
||||
want: "set-principals",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.want, func(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user