cloudpolicy.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 cloudid
  15. import (
  16. "yunion.io/x/cloudmux/pkg/apis/cloudid"
  17. "yunion.io/x/jsonutils"
  18. "yunion.io/x/onecloud/pkg/apis"
  19. )
  20. const (
  21. CLOUD_POLICY_TYPE_SYSTEM = string(cloudid.PolicyTypeSystem)
  22. CLOUD_POLICY_TYPE_CUSTOM = string(cloudid.PolicyTypeCustom)
  23. )
  24. type CloudpolicyListInput struct {
  25. apis.StatusInfrasResourceBaseListInput
  26. CloudaccountResourceListInput
  27. CloudproviderResourceListInput
  28. // 根据平台过滤
  29. Provider []string `json:"provider"`
  30. // 根据子账号过滤权限
  31. ClouduserId string `json:"clouduser_id"`
  32. // 根据权限组过滤权限
  33. CloudgroupId string `json:"cloudgroup_id"`
  34. // 根据订阅过滤权限
  35. ManagerId string `json:"manager_id"`
  36. // 权限类型
  37. //
  38. //
  39. // | 类型 | 说明 |
  40. // |---------| ------------ |
  41. // | system | 过滤系统权限 |
  42. // | custom | 过滤自定义权限 |
  43. PolicyType string `json:"policy_type"`
  44. }
  45. type PolicyUsage struct {
  46. CloudgroupCount int `json:"cloudgroup_count"`
  47. ClouduserCount int `json:"clouduser_count"`
  48. }
  49. type CloudpolicyDetails struct {
  50. apis.StatusInfrasResourceBaseDetails
  51. CloudaccountResourceDetails
  52. CloudproviderResourceDetails
  53. SCloudpolicy
  54. PolicyUsage
  55. }
  56. type CloudpolicyCreateInput struct {
  57. apis.StatusInfrasResourceBaseCreateInput
  58. // default: custom
  59. PolicyType string `json:"policy_type"`
  60. // 策略详情
  61. Document *jsonutils.JSONDict `json:"document"`
  62. }
  63. type CloudpolicyResourceListInput struct {
  64. // 根据公有云权限过滤资源
  65. Cloudpolicy string `json:"cloudpolicy"`
  66. // swagger:ignore
  67. CloudpolicyId string `json:"cloudpolicy_id" yunion-deprecated-by:"cloudpolicy"`
  68. }
  69. type CloudpolicyResourceDetails struct {
  70. // 公有云权限名称
  71. Cloudpolicy string `json:"cloudpolicy"`
  72. }
  73. type CloudpolicyUpdateInput struct {
  74. apis.StatusInfrasResourceBaseUpdateInput
  75. Document *jsonutils.JSONDict `json:"document"`
  76. // swagger:ignore
  77. OriginDocument *jsonutils.JSONDict `json:"origin_document"`
  78. }
  79. type CloudpolicyAssignGroupInput struct {
  80. // 权限组Id
  81. CloudgroupId string `json:"cloudgroup_id"`
  82. }
  83. type CloudpolicyRevokeGroupInput struct {
  84. // 权限组Id
  85. CloudgroupId string `json:"cloudgroup_id"`
  86. }