alarm.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package v1
  4. import (
  5. "smart-site-management-gateway/param/base"
  6. "smart-site-management-gateway/pb/v1"
  7. )
  8. type AlarmListQuery struct {
  9. Page int32 `form:"page" json:"page"`
  10. Start int64 `form:"start" json:"start"`
  11. End int64 `form:"end" json:"end"`
  12. Sn string `form:"sn" json:"sn"`
  13. // 0 不过滤 1 已处理 2 未处理
  14. Filter int32 `form:"filter"`
  15. PageSize int32 `form:"page_size"`
  16. Timestamp int64 `form:"timestamp"`
  17. DeviceCode int32 `form:"device_code"`
  18. }
  19. type AlarmListRequest struct {
  20. base.Header
  21. AlarmListQuery
  22. }
  23. type AlarmListResponse struct {
  24. base.Result
  25. Data v1.AlarmListReply `json:"data"`
  26. }
  27. // 添加告警规则
  28. type AlarmRuleAddBody struct {
  29. Sn string `form:"sn" json:"sn" binding:"required" description:"设备唯一编号"`
  30. AlarmCount int32 `form:"alarm_count" json:"alarm_count" binding:"required" description:"连续告警数"`
  31. SilencePeriod int32 `form:"silence_period" json:"silence_period" binding:"required" description:"静默时间,发送间隔(单位分)"`
  32. IsOn bool `form:"is_on" json:"is_on" binding:"required" description:"是否启用"`
  33. ContinuePeriod int32 `form:"continue_period" json:"continue_period" binding:"required" description:"持续周期"`
  34. }
  35. type AlarmRuleAddRequest struct {
  36. base.Header
  37. AlarmRuleAddBody
  38. }
  39. type AlarmRuleAddResponse struct {
  40. base.Result
  41. Data v1.AlarmRuleAddReply `json:"data"`
  42. }
  43. // 告警规则列表
  44. type AlarmRuleListQuery struct {
  45. Sn string `form:"sn" json:"sn"`
  46. Page int32 `form:"page"`
  47. }
  48. type AlarmRuleListRequest struct {
  49. base.Header
  50. AlarmRuleListQuery
  51. }
  52. type AlarmRuleListResponse struct {
  53. base.Result
  54. Data v1.AlarmRuleListReply `json:"data"`
  55. }
  56. // 告警规则删除
  57. type AlarmRuleDeletePath struct {
  58. Id int64 `uri:"id" json:"id" binding:"required" description:"id"`
  59. }
  60. type AlarmRuleDeleteRequest struct {
  61. base.Header
  62. AlarmRuleDeletePath
  63. }
  64. type AlarmRuleDeleteResponse struct {
  65. base.Result
  66. }
  67. // 告警规则开关
  68. type AlarmRuleOnOffBody struct {
  69. Id int64 `form:"id" json:"id" binding:"required" description:"id"`
  70. Is0n bool `form:"is_on" json:"is_on" binding:"required" description:"是否启用"`
  71. }
  72. type AlarmRuleOnOffRequest struct {
  73. base.Header
  74. AlarmRuleOnOffBody
  75. }
  76. type AlarmRuleOnOffResponse struct {
  77. base.Result
  78. }
  79. // 告警规则更新
  80. type AlarmRuleUpdateBody struct {
  81. Id int64 `form:"id" json:"id" binding:"required" description:"id"`
  82. Sn string `form:"sn" json:"sn" binding:"required" description:"设备唯一编号"`
  83. AlarmCount int32 `form:"alarm_count" json:"alarm_count" binding:"required" description:"连续告警数"`
  84. SilencePeriod int32 `form:"silence_period" json:"silence_period" binding:"required" description:"静默时间,发送间隔(单位分)"`
  85. IsOn bool `form:"is_on" json:"is_on" binding:"required" description:"是否启用"`
  86. ContinuePeriod int32 `form:"continue_period" json:"continue_period" binding:"required" description:"持续周期"`
  87. }
  88. type AlarmRuleUpdateRequest struct {
  89. base.Header
  90. AlarmRuleUpdateBody
  91. }
  92. type AlarmRuleUpdateResponse struct {
  93. base.Result
  94. }
  95. // 告警联系人添加
  96. type AlarmContactAddBody struct {
  97. Phone string `form:"phone" json:"phone" binding:"required" description:"告警联系人电话"`
  98. Email string `form:"email" json:"email" binding:"required" description:"告警联系人邮箱"`
  99. }
  100. type AlarmContactAddRequest struct {
  101. base.Header
  102. AlarmContactAddBody
  103. }
  104. type AlarmContactAddResponse struct {
  105. base.Result
  106. Data v1.AlarmContactAddReply `json:"data"`
  107. }
  108. // 告警联系人列表
  109. type AlarmContactListQuery struct {
  110. ProjectId int64 `form:"project_id" json:"project_id"`
  111. }
  112. type AlarmContactListRequest struct {
  113. base.Header
  114. AlarmContactListQuery
  115. }
  116. type AlarmContactListResponse struct {
  117. base.Result
  118. Data v1.AlarmContactListReply `json:"data"`
  119. }
  120. // 告警联系人删除
  121. type AlarmContactDeletePath struct {
  122. Id int64 `uri:"id" json:"id" binding:"required" description:"id"`
  123. }
  124. type AlarmContactDeleteRequest struct {
  125. base.Header
  126. AlarmContactDeletePath
  127. }
  128. type AlarmContactDeleteResponse struct {
  129. base.Result
  130. }
  131. // 告警联系人添加
  132. type AlarmContactUpdateBody struct {
  133. Id int64 `form:"id" json:"id" binding:"required" description:"id"`
  134. Phone string `form:"phone" json:"phone" binding:"required" description:"告警联系人电话"`
  135. Email string `form:"email" json:"email" binding:"required" description:"告警联系人邮箱"`
  136. }
  137. type AlarmContactUpdateRequest struct {
  138. base.Header
  139. AlarmContactUpdateBody
  140. }
  141. type AlarmContactUpdateResponse struct {
  142. base.Result
  143. Data v1.AlarmContactUpdateReply `json:"data"`
  144. }