internal/handlers: add policy list resource type

pull/4239/head
Johan Brandhorst-Satzkorn 2 years ago committed by Louis Ruch
parent dc4ea67d6e
commit b454b28912

@ -176,6 +176,8 @@ func ListTokenResourceToResource(rt pbs.ResourceType) resource.Type {
return resource.User
case pbs.ResourceType_RESOURCE_TYPE_WORKER:
return resource.Worker
case pbs.ResourceType_RESOURCE_TYPE_POLICY:
return resource.Policy
default:
return resource.Unknown
}

@ -444,6 +444,11 @@ func TestListTokenResourceToResource(t *testing.T) {
rt: pbs.ResourceType_RESOURCE_TYPE_WORKER,
want: resource.Worker,
},
{
name: "policy",
rt: pbs.ResourceType_RESOURCE_TYPE_POLICY,
want: resource.Policy,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

@ -49,6 +49,7 @@ const (
ResourceType_RESOURCE_TYPE_TARGET ResourceType = 17
ResourceType_RESOURCE_TYPE_USER ResourceType = 18
ResourceType_RESOURCE_TYPE_WORKER ResourceType = 19
ResourceType_RESOURCE_TYPE_POLICY ResourceType = 20
)
// Enum value maps for ResourceType.
@ -74,6 +75,7 @@ var (
17: "RESOURCE_TYPE_TARGET",
18: "RESOURCE_TYPE_USER",
19: "RESOURCE_TYPE_WORKER",
20: "RESOURCE_TYPE_POLICY",
}
ResourceType_value = map[string]int32{
"RESOURCE_TYPE_UNSPECIFIED": 0,
@ -96,6 +98,7 @@ var (
"RESOURCE_TYPE_TARGET": 17,
"RESOURCE_TYPE_USER": 18,
"RESOURCE_TYPE_WORKER": 19,
"RESOURCE_TYPE_POLICY": 20,
}
)
@ -564,7 +567,7 @@ var file_controller_api_services_v1_list_proto_rawDesc = []byte{
0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
0x74, 0x61, 0x6d, 0x70, 0x52, 0x12, 0x6c, 0x61, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x2a, 0xda, 0x04, 0x0a, 0x0c, 0x52, 0x65, 0x73,
0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x2a, 0xf4, 0x04, 0x0a, 0x0c, 0x52, 0x65, 0x73,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x52, 0x45, 0x53,
0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,
0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x52, 0x45, 0x53, 0x4f,
@ -602,12 +605,14 @@ var file_controller_api_services_v1_list_proto_rawDesc = []byte{
0x54, 0x10, 0x11, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,
0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x10, 0x12, 0x12, 0x18, 0x0a, 0x14, 0x52,
0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x57, 0x4f, 0x52,
0x4b, 0x45, 0x52, 0x10, 0x13, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f,
0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f,
0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61,
0x70, 0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x4b, 0x45, 0x52, 0x10, 0x13, 0x12, 0x18, 0x0a, 0x14, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43,
0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x10, 0x14, 0x42,
0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61,
0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79,
0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f,
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

@ -109,4 +109,5 @@ enum ResourceType {
RESOURCE_TYPE_TARGET = 17;
RESOURCE_TYPE_USER = 18;
RESOURCE_TYPE_WORKER = 19;
RESOURCE_TYPE_POLICY = 20;
}

Loading…
Cancel
Save