resources.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 policy
  15. import (
  16. api "yunion.io/x/onecloud/pkg/apis/compute"
  17. common_policy "yunion.io/x/onecloud/pkg/cloudcommon/policy"
  18. )
  19. var (
  20. computeSystemResources = []string{
  21. "zones",
  22. "cloudregions",
  23. "serverskus",
  24. "cachedimages",
  25. "dynamicschedtags",
  26. "baremetalagents",
  27. "schedpolicies",
  28. "dnsrecords",
  29. "metadatas",
  30. "loadbalancerclusters",
  31. "loadbalanceragents",
  32. // "reservedips",
  33. "policy_definitions",
  34. "schedtags",
  35. }
  36. computeDomainResources = []string{
  37. "cloudaccounts",
  38. "cloudproviders",
  39. "recyclebins",
  40. // migrate system resources to domain resources
  41. "hosts",
  42. "baremetalnetworks",
  43. "hoststorages",
  44. "hostwires",
  45. "isolated-devices",
  46. "vpcs",
  47. "storages",
  48. "wires",
  49. "globalvpcs",
  50. "route_tables",
  51. "networkinterfaces",
  52. "natgateways",
  53. "natsentries",
  54. "natdentries",
  55. "file_systems",
  56. "access_groups",
  57. "access_group_caches",
  58. "policy_assignments",
  59. "proxysettings",
  60. "project_mappings",
  61. "waf_instances",
  62. "waf_rules",
  63. "waf_rule_groups",
  64. "waf_ipsets",
  65. "waf_regexsets",
  66. "cdn_domains",
  67. "cloud_kube_clusters",
  68. "cloud_kube_node_pools",
  69. "cloud_kube_nodes",
  70. }
  71. computeUserResources = []string{
  72. "keypairs",
  73. }
  74. )
  75. func init() {
  76. common_policy.RegisterSystemResources(api.SERVICE_TYPE, computeSystemResources)
  77. common_policy.RegisterDomainResources(api.SERVICE_TYPE, computeDomainResources)
  78. common_policy.RegisterUserResources(api.SERVICE_TYPE, computeUserResources)
  79. }