owner.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 db
  15. type SOwnerId struct {
  16. Domain string `json:"project_domain"`
  17. DomainId string `json:"project_domain_id"`
  18. Project string `json:"tenant"`
  19. ProjectId string `json:"tenant_id"`
  20. User string `json:"user"`
  21. UserId string `json:"user_id"`
  22. UserDomain string `json:"domain"`
  23. UserDomainId string `json:"domain_id"`
  24. }
  25. func (o *SOwnerId) GetProjectId() string {
  26. return o.ProjectId
  27. }
  28. func (o *SOwnerId) GetUserId() string {
  29. return o.UserId
  30. }
  31. func (o *SOwnerId) GetTenantId() string {
  32. return o.ProjectId
  33. }
  34. func (o *SOwnerId) GetProjectDomainId() string {
  35. return o.DomainId
  36. }
  37. func (o *SOwnerId) GetUserName() string {
  38. return o.User
  39. }
  40. func (o *SOwnerId) GetProjectName() string {
  41. return o.Project
  42. }
  43. func (o *SOwnerId) GetTenantName() string {
  44. return o.Project
  45. }
  46. func (o *SOwnerId) GetProjectDomain() string {
  47. return o.Domain
  48. }
  49. func (o *SOwnerId) GetDomainId() string {
  50. return o.UserDomainId
  51. }
  52. func (o *SOwnerId) GetDomainName() string {
  53. return o.UserDomain
  54. }
  55. func (ownerId SOwnerId) IsValid() bool {
  56. if len(ownerId.User) > 0 && len(ownerId.UserId) > 0 &&
  57. len(ownerId.UserDomain) > 0 && len(ownerId.UserDomainId) > 0 &&
  58. len(ownerId.Project) > 0 && len(ownerId.ProjectId) > 0 &&
  59. len(ownerId.Domain) > 0 && len(ownerId.DomainId) > 0 {
  60. return true
  61. }
  62. return false
  63. }