clouduser.go 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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 "yunion.io/x/onecloud/pkg/apis"
  16. const (
  17. CLOUD_USER_STATUS_RESET_PASSWORD = "reset_password" // 重置密码中
  18. CLOUD_USER_STATUS_RESET_PASSWORD_FAILED = "reset_password_failed" // 重置密码失败
  19. )
  20. type ClouduserCreateInput struct {
  21. apis.StatusDomainLevelUserResourceCreateInput
  22. apis.StatusBaseResourceCreateInput
  23. // 云订阅ID
  24. ManagerId string `json:"manager_id"`
  25. // 云账号ID
  26. // Azure云账号需要有User administrator权限,否则删操作会出现Insufficient privileges to complete the operation错误信息
  27. CloudaccountId string `json:"cloudaccount_id"`
  28. // 用户密码, 若is_console_login = true时, 此参数不传时会生成12位随机密码
  29. //
  30. //
  31. //
  32. // | 云平台 | 说明 |
  33. // |----------|---------------------------------------------|
  34. // | Google | 不支持此参数 |
  35. // | Aliyun | 支持 |
  36. // | Huawei | 支持 |
  37. // | Azure | 支持 |
  38. // | 腾讯云 | 支持 |
  39. Password string `json:"password"`
  40. // 是否可控制台登录
  41. // default: false
  42. IsConsoleLogin *bool `json:"is_console_login"`
  43. // 邮箱地址
  44. // example: test@example.com
  45. Email string `json:"email"`
  46. // 手机号码
  47. // example: 86-1868888****
  48. MobilePhone string `json:"mobile_phone"`
  49. // 初始的权限Id列表, 权限必须属于指定的云账号
  50. //
  51. //
  52. //
  53. // | 云平台 | 说明 |
  54. // |----------|---------------------------------------------|
  55. // | Google | 至少需要一个初始权限 |
  56. // | Aliyun | 支持 |
  57. // | Huawei | 不支持 |
  58. // | Azure | 支持 |
  59. // | 腾讯云 | 支持 |
  60. CloudpolicyIds []string `json:"cloudpolicy_ids"`
  61. // 初始化权限组Id列表, 权限组必须和云账号平台属性相同
  62. CloudgroupIds []string `json:"cloudgroup_ids"`
  63. // swagger:ignore
  64. ExternalId string `json:"external_id"`
  65. // 是否发送邮件通知(仅设置email不为空生效)
  66. // default: false
  67. Notify bool `json:"notify"`
  68. }
  69. type ClouduserListInput struct {
  70. apis.StatusDomainLevelUserResourceListInput
  71. CloudaccountResourceListInput
  72. CloudproviderResourceListInput
  73. // 过滤绑定权限的子账号
  74. CloudpolicyId string `json:"cloudpolicy_id"`
  75. // 过滤属于指定权限组的子账号
  76. CloudgroupId string `json:"cloudgroup_id"`
  77. }
  78. type ClouduserDetails struct {
  79. apis.StatusDomainLevelUserResourceDetails
  80. SClouduser
  81. CloudaccountResourceDetails
  82. CloudproviderResourceDetails
  83. // 权限数量
  84. CloudpolicyCount int `json:"cloudpolicy_count"`
  85. // 权限组数量
  86. CloudgroupCount int `json:"cloudgroup_count"`
  87. Cloudgroups []SCloudIdBaseResource `json:"cloudgroups"`
  88. Cloudpolicies []SCloudIdBaseResource `json:"cloudpolicies"`
  89. }
  90. type ClouduserJointResourceDetails struct {
  91. apis.JointResourceBaseDetails
  92. ClouduserResourceDetails
  93. }
  94. type ClouduserJointsListInput struct {
  95. apis.JointResourceBaseListInput
  96. ClouduserResourceListInput
  97. }
  98. type ClouduserJointBaseUpdateInput struct {
  99. apis.JointResourceBaseUpdateInput
  100. }
  101. type ClouduserPolicyDetails struct {
  102. ClouduserJointResourceDetails
  103. CloudpolicyResourceDetails
  104. }
  105. type ClouduserPolicyListInput struct {
  106. ClouduserJointsListInput
  107. CloudpolicyResourceListInput
  108. }
  109. type ClouduserResourceListInput struct {
  110. // 根据公有云用户过滤资源
  111. Clouduser string `json:"clouduser"`
  112. // swagger:ignore
  113. ClouduserId string `json:"clouduser_id" yunion-deprecated-by:"clouduser"`
  114. }
  115. type ClouduserResourceDetails struct {
  116. // 公有云用户名称
  117. Clouduser string `json:"clouduser"`
  118. // 云账号名称
  119. Cloudaccount string `json:"cloudaccount"`
  120. // 云订阅名称
  121. Cloudprovider string `json:"cloudprovider"`
  122. }
  123. type ClouduserAttachPolicyInput struct {
  124. // 权限Id
  125. //
  126. //
  127. //
  128. // | 云平台 | 说明 |
  129. // |----------|---------------------------------------------|
  130. // | Google | 支持 |
  131. // | Aliyun | 支持 |
  132. // | Huawei | 不支持 |
  133. // | Azure | 支持 |
  134. // | 腾讯云 | 支持 |
  135. CloudpolicyId string `json:"cloudpolicy_id"`
  136. }
  137. type ClouduserSetPoliciesInput struct {
  138. // 权限Ids
  139. CloudpolicyIds []string `json:"cloudpolicy_ids"`
  140. }
  141. type ClouduserSetGroupsInput struct {
  142. // 权限组Ids
  143. CloudgroupIds []string `json:"cloudgroup_ids"`
  144. }
  145. type ClouduserJoinGroupInput struct {
  146. // 权限组Id
  147. CloudgroupId string `json:"cloudgroup_id"`
  148. }
  149. type ClouduserLeaveGroupInput struct {
  150. // 权限组Id
  151. CloudgroupId string `json:"cloudgroup_id"`
  152. }
  153. type ClouduserDetachPolicyInput struct {
  154. // 权限Id
  155. //
  156. //
  157. //
  158. // | 云平台 | 说明 |
  159. // |----------|---------------------------------------------|
  160. // | Google | 支持,但最少需要保留一个权限 |
  161. // | Aliyun | 支持 |
  162. // | Huawei | 不支持 |
  163. // | Azure | 不支持 |
  164. // | 腾讯云 | 支持 |
  165. CloudpolicyId string `json:"cloudpolicy_id"`
  166. }
  167. type ClouduserSyncstatusInput struct {
  168. }
  169. type ClouduserSyncInput struct {
  170. }
  171. type ClouduserUpdateInput struct {
  172. }
  173. type ClouduserResetPasswordInput struct {
  174. // 若此参数为空, 默认会生成随机12位密码
  175. //
  176. //
  177. //
  178. // | 云平台 | 说明 |
  179. // |----------|---------------------------------------------|
  180. // | Google | 不支持 |
  181. // | Aliyun | 支持 |
  182. // | Huawei | 支持 |
  183. // | Azure | 支持 |
  184. // | 腾讯云 | 支持 |
  185. Password string `json:"password"`
  186. }
  187. type ClouduserChangeOwnerInput struct {
  188. // 本地用户Id
  189. UserId string `json:"user_id"`
  190. }
  191. type ClouduserCreateAccessKeyInput struct {
  192. Name string `json:"name"`
  193. }
  194. type ClouduserDeleteAccessKeyInput struct {
  195. AccessKey string `json:"access_key"`
  196. }
  197. type ClouduserListAccessKeyInput struct {
  198. }