scaling_trigger.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 "time"
  16. type TimerCreateInput struct {
  17. // description: 执行时间
  18. ExecTime time.Time `json:"exec_time"`
  19. }
  20. type CycleTimerCreateInput struct {
  21. // description: 周期类型
  22. // enum: ["day","week","month"]
  23. CycleType string `json:"cycle_type"`
  24. CycleHour int `json:"cycle_hour"`
  25. // description: 分(0-59)
  26. // example: 13
  27. Minute int `json:"minute"`
  28. // description: 时(0-23)
  29. // example: 13
  30. Hour int `json:"hour"`
  31. // description: 每周的周几; 1-7, 1: Monday, 7: Sunday
  32. // example: [1,3,5,7]
  33. WeekDays []int `json:"week_days"`
  34. // description: 每月的哪几天; 1-31
  35. // example: [1,4,31]
  36. MonthDays []int `json:"month_days"`
  37. // description: 开始时间
  38. StartTime time.Time `json:"start_time"`
  39. // description: 截止时间
  40. EndTime time.Time `json:"end_time"`
  41. }
  42. type ScalingAlarmCreateInput struct {
  43. // description: 累计次数(报警次数达到此累计次数就会触发伸缩活动)
  44. // example: 1
  45. Cumulate int `json:"cumulate"`
  46. // description: 监控周期,单位s
  47. // example: 300
  48. Cycle int `json:"cycle"`
  49. // description: 监控指标
  50. // example: cpu
  51. // enum: ["cpu","disk_read","disk_write","flow_into","flow_out"]
  52. Indicator string `json:"indicator"`
  53. // description: 监控指标的取值方式(比如最大值,最小值,平均值)
  54. // example: max
  55. // enum: ["max","min","average"]
  56. Wrapper string `json:"wrapper"`
  57. // descripion: 监控指标的比较符
  58. // example: ge
  59. // enum: ["ge","le"]
  60. Operator string `json:"operator"`
  61. // description: 监控指标的取值
  62. // example: 3
  63. Value float64 `json:"value"`
  64. }
  65. type TimerDetails struct {
  66. // description: 执行时间
  67. ExecTime time.Time `json:"exec_time"`
  68. }
  69. type CycleTimerDetails struct {
  70. // description: 周期类型:按天/周/月
  71. CycleType string `json:"cycle_type"`
  72. // description: 分钟
  73. Minute int `json:"minute"`
  74. // description: 小时
  75. Hour int `json:"hour"`
  76. // description: 每周的几天
  77. WeekDays []int `json:"week_days"`
  78. // description: 每月的几天
  79. MonthDays []int `json:"month_days"`
  80. // description: 此周期任务的开始时间
  81. StartTime time.Time `json:"start_time"`
  82. // description: 此周期任务的截止时间
  83. EndTime time.Time `json:"end_time"`
  84. }
  85. type ScalingAlarmDetails struct {
  86. // description: 累计次数,只有到达累计次数的报警才会触发伸缩活动
  87. Cumulate int `json:"cumulate"`
  88. // description: 监控周期
  89. Cycle int `json:"cycle"`
  90. // description: 指标
  91. Indicator string `json:"indicator"`
  92. // description: 指标的取值方式,最大值/最小值/平均值
  93. Wrapper string `json:"wrapper"`
  94. // description: 指标和阈值之间的比较关系,>=/<=
  95. Operator string `json:"operator"`
  96. // description: 阈值
  97. Value float64 `json:"value"`
  98. }