monitor_resource_alert.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 monitor
  15. import (
  16. "time"
  17. "yunion.io/x/jsonutils"
  18. "yunion.io/x/onecloud/pkg/mcclient/options"
  19. )
  20. type MonitorResourceAlertListOptions struct {
  21. options.BaseListOptions
  22. MonitorResourceId string `help:"ID of monitor resource" json:"monitor_resource_id"`
  23. AlertId string `help:"ID of alert" json:"alert_id"`
  24. Alerting bool `help:"search alerting resource" json:"alerting"`
  25. SendState string `json:"send_state"`
  26. AllState bool `help:"Show all state" json:"all_state"`
  27. Ip string `help:"IP address" json:"ip"`
  28. StartTime time.Time `help:"start time for top query, format: 2025-01-01 00:00:00" json:"start_time"`
  29. EndTime time.Time `help:"end time for top query, format: 2025-01-01 00:00:00" json:"end_time"`
  30. Top *int `help:"return top N resources by alert count (default: 5)" json:"top"`
  31. }
  32. func (o *MonitorResourceAlertListOptions) GetMasterOpt() string {
  33. return o.MonitorResourceId
  34. }
  35. func (o *MonitorResourceAlertListOptions) GetSlaveOpt() string {
  36. return o.AlertId
  37. }
  38. func (o *MonitorResourceAlertListOptions) Params() (jsonutils.JSONObject, error) {
  39. return options.ListStructToParams(o)
  40. }