subscriber.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 notify
  15. import "yunion.io/x/onecloud/pkg/apis"
  16. type SubscriberCreateInput struct {
  17. apis.StandaloneAnonResourceCreateInput
  18. // description: Id of Topic
  19. // required
  20. TopicID string `json:"topic_id"`
  21. // description: scope of resource
  22. // enum: ["system","domain","project"]
  23. ResourceScope string `json:"resource_scope"`
  24. // description: project id or domain id of resource
  25. // example: 1e3824756bac4ac084e784ed297ec652
  26. ResourceAttributionId string `json:"resource_attribution_id"`
  27. ResourceAttributionName string `json:"resource_attribution_name"`
  28. // description: domain id of resource
  29. // example: 1e3824756bac4ac084e784ed297ec652
  30. DomainId string `json:"domain_id"`
  31. // description: Type of subscriber
  32. // enum: ["receiver","robot","role"]
  33. Type string `json:"type"`
  34. // description: receivers which is required when the type is 'receiver' will Subscribe TopicID
  35. Receivers []string `json:"receivers"`
  36. // description: Role(Id or Name) which is required when the type is 'role' will Subscribe TopicID
  37. Role string `json:"role"`
  38. // description: The scope of role subscribers
  39. // enum: ["system","domain","project"]
  40. RoleScope string `json:"role_scope"`
  41. // description: Robot(Id or Name) which is required when the type is 'robot' will Subscribe TopicID
  42. Robot string `json:"robot"`
  43. // description: scope
  44. // enum: ["system","domain"]
  45. Scope string `json:"scope"`
  46. // minutes
  47. GroupTimes *uint32 `json:"group_times"`
  48. }
  49. type SubscriberChangeInput struct {
  50. // description: receivers which is required when the type is 'receiver' will Subscribe TopicID
  51. Receivers []string `json:"receivers"`
  52. // description: Role(Id or Name) which is required when the type is 'role' will Subscribe TopicID
  53. Role string `json:"role"`
  54. // description: The scope of role subscribers
  55. // enum: ["system","domain","project"]
  56. RoleScope string `json:"role_scope"`
  57. // description: Robot(Id or Name) which is required when the type is 'robot' will Subscribe TopicID
  58. Robot string `json:"robot"`
  59. // minutes
  60. GroupTimes *uint32 `json:"group_times"`
  61. }
  62. type SubscriberListInput struct {
  63. apis.StandaloneAnonResourceListInput
  64. apis.EnabledResourceBaseListInput
  65. // description: topic id
  66. TopicID string `json:"topic_id"`
  67. // description: scope of resource
  68. // enum: ["system","domain","project"]
  69. ResourceScope string `json:"resource_scope"`
  70. // description: type
  71. // enum: ["receiver","robot","role"]
  72. Type string `json:"type"`
  73. // description: scope
  74. // enum: ["system","domain"]
  75. Scope string `json:"scope"`
  76. }
  77. type Identification struct {
  78. // example: 036fed49483b412888a760c2bc995caa
  79. ID string `json:"id"`
  80. // example: test
  81. Name string `json:"name"`
  82. }
  83. type SubscriberDetails struct {
  84. apis.StandaloneAnonResourceDetails
  85. SSubscriber
  86. // description: receivers
  87. Receivers []Identification `json:"receivers"`
  88. // description: role
  89. Role Identification `json:"role"`
  90. // description: robot
  91. Robot Identification `json:"robot"`
  92. }
  93. type SubscriberSetReceiverInput struct {
  94. Receivers []string `json:"receivers"`
  95. }