dbinstance_account.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 compute
  15. import "yunion.io/x/onecloud/pkg/apis"
  16. type SDBInstanceAccountPrivilege struct {
  17. // 数据库名称或Id
  18. // required: true
  19. Database string `json:"database"`
  20. // swagger:ignore
  21. DBInstancedatabaseId string `json:"db_instancedatabase_id"`
  22. // 权限类型
  23. //
  24. //
  25. //
  26. // | 平台 |Rds引擎 | 支持类型 |
  27. // | ---- |------- | -------- |
  28. // | Aliyun |MySQL, MariaBD | rw, r, ddl, dml |
  29. // | Aliyun |SQLServer | rw, r, owner |
  30. // | Huawei |MySQL, MariaDB | rw, r |
  31. // 同一平台不同的rds类型支持的权限不尽相同
  32. // required: true
  33. Privilege string `json:"privilege"`
  34. }
  35. type DBInstanceAccountCreateInput struct {
  36. apis.StatusStandaloneResourceCreateInput
  37. // rds实例名称或Id,建议使用Id
  38. //
  39. //
  40. //
  41. // | 平台 |支持Rds引擎 |
  42. // | ---- |------- |
  43. // | Aliyun |MySQL, MariaBD, SQLServer |
  44. // | 华为云 |MySQL, MariaBD |
  45. // | 腾讯云 |MySQL |
  46. // required: true
  47. // 阿里云SQL Server 2017集群版不支持创建账号
  48. // 实例状态必须是运行中
  49. DBInstance string `json:"dbinstance"`
  50. // swagger:ignore
  51. DBInstanceId string `json:"dbinstance_id"`
  52. // 账号密码,若不指定,则会随机生成
  53. // required: false
  54. Password string `json:"password"`
  55. // 账号权限
  56. // required: false
  57. Privileges []SDBInstanceAccountPrivilege `json:"privileges"`
  58. }
  59. type SDBInstanceSetPrivilegesInput struct {
  60. Privileges []SDBInstanceAccountPrivilege `json:"privileges"`
  61. }
  62. type DBInstancePrivilege struct {
  63. // 数据库名称
  64. Database string `json:"database"`
  65. // 账号名称
  66. Account string `json:"account"`
  67. // 数据库Id
  68. DBInstancedatabaseId string `json:"dbinstancedatabase_id"`
  69. // 权限
  70. Privileges string `json:"privileges"`
  71. }
  72. type DBInstanceAccountDetails struct {
  73. apis.StatusStandaloneResourceDetails
  74. apis.ProjectizedResourceInfo
  75. DBInstanceResourceInfo
  76. SDBInstanceAccount
  77. // 账号权限列表
  78. DBInstanceprivileges []DBInstancePrivilege `json:"dbinstanceprivileges,allowempty"`
  79. ProjectId string `json:"tenant_id"`
  80. }
  81. type DBInstanceAccountUpdateInput struct {
  82. apis.StatusStandaloneResourceBaseUpdateInput
  83. }