grafana-iam: Skeleton of the resource permission api backend (#110218)
* Extract from #108753 Co-Authored-By: mohammad-hamid <mohammad.hamid@grafana.com> * Tackle create Co-Authored-By: mohammad-hamid <mohammad.hamid@grafana.com> * WIP use identity store to resolve role names * Commit empty service for now * Clean * For now only show name and created at --------- Co-authored-by: mohammad-hamid <mohammad.hamid@grafana.com>
This commit is contained in:
co-authored by
mohammad-hamid
parent
a0075ffdd6
commit
b6226c6173
@@ -72,6 +72,30 @@ var RoleInfo = utils.NewResourceInfo(GROUP, VERSION,
|
||||
},
|
||||
)
|
||||
|
||||
var ResourcePermissionInfo = utils.NewResourceInfo(GROUP, VERSION,
|
||||
"resourcepermissions", "resourcepermission", "ResourcePermission",
|
||||
func() runtime.Object { return &ResourcePermission{} },
|
||||
func() runtime.Object { return &ResourcePermissionList{} },
|
||||
utils.TableColumns{
|
||||
Definition: []metav1.TableColumnDefinition{
|
||||
{Name: "Name", Type: "string", Format: "name"},
|
||||
{Name: "Created At", Type: "date"},
|
||||
},
|
||||
Reader: func(obj any) ([]interface{}, error) {
|
||||
perm, ok := obj.(*ResourcePermission)
|
||||
if ok {
|
||||
if perm != nil {
|
||||
return []interface{}{
|
||||
perm.Name,
|
||||
perm.CreationTimestamp.UTC().Format(time.RFC3339),
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("expected resource permission")
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
var (
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
@@ -90,6 +114,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
&CoreRoleList{},
|
||||
&Role{},
|
||||
&RoleList{},
|
||||
&ResourcePermission{},
|
||||
&ResourcePermissionList{},
|
||||
|
||||
// What is this about?
|
||||
&metav1.PartialObjectMetadata{},
|
||||
|
||||
Reference in New Issue
Block a user