rbac.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package k8s
  15. import (
  16. "yunion.io/x/onecloud/pkg/mcclient/modules"
  17. )
  18. var (
  19. RbacRoles *RbacRoleManager
  20. RbacClusterRoles *RbacClusterRoleManager
  21. RbacRoleBindings *RbacRoleBindingManager
  22. RbacClusterRoleBindings *RbacClusterRoleBindingManager
  23. ServiceAccounts *ServiceAccountManager
  24. )
  25. type RbacRoleManager struct {
  26. *NamespaceResourceManager
  27. }
  28. type RbacClusterRoleManager struct {
  29. *ClusterResourceManager
  30. }
  31. type RbacRoleBindingManager struct {
  32. *NamespaceResourceManager
  33. }
  34. type RbacClusterRoleBindingManager struct {
  35. *ClusterResourceManager
  36. }
  37. type ServiceAccountManager struct {
  38. *NamespaceResourceManager
  39. }
  40. func init() {
  41. RbacRoles = &RbacRoleManager{
  42. NewNamespaceResourceManager("rbacrole", "rbacroles", NewNamespaceCols(), NewColumns())}
  43. RbacClusterRoles = &RbacClusterRoleManager{
  44. NewClusterResourceManager("rbacclusterrole", "rbacclusterroles", NewClusterCols(), NewColumns())}
  45. RbacRoleBindings = &RbacRoleBindingManager{
  46. NewNamespaceResourceManager("rbacrolebinding", "rbacrolebindings", NewNamespaceCols(), NewColumns())}
  47. RbacClusterRoleBindings = &RbacClusterRoleBindingManager{
  48. NewClusterResourceManager("rbacclusterrolebinding", "rbacclusterrolebindings", NewClusterCols(), NewColumns())}
  49. ServiceAccounts = &ServiceAccountManager{
  50. NewNamespaceResourceManager("serviceaccount", "serviceaccounts", NewNamespaceCols(), NewColumns())}
  51. modules.Register(RbacRoles)
  52. modules.Register(RbacClusterRoles)
  53. modules.Register(RbacRoleBindings)
  54. modules.Register(RbacClusterRoleBindings)
  55. modules.Register(ServiceAccounts)
  56. }