alertresource.go 2.3 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 monitor
  15. import (
  16. "yunion.io/x/onecloud/pkg/apis"
  17. )
  18. type AlertResourceType string
  19. const (
  20. // AlertResourceTypeNode means onecloud system infrastructure controller or host node
  21. AlertResourceTypeNode AlertResourceType = "host"
  22. // AlertResourceTypeCloudaccount means cloudaccount resource
  23. AlertResourceTypeCloudaccount AlertResourceType = "cloudaccount"
  24. // AlertResourceTypeVM means virtual machine guest resource
  25. AlertResourceTypeVM AlertResourceType = "vm"
  26. )
  27. type AlertResourceCreateInput struct {
  28. apis.StandaloneResourceCreateInput
  29. Type AlertResourceType `json:"type"`
  30. }
  31. type AlertResourceListInput struct {
  32. apis.StandaloneResourceListInput
  33. Type string `json:"type"`
  34. }
  35. type AlertResourceAttachInput struct {
  36. apis.Meta
  37. AlertResourceId string `json:"alert_resource_id"`
  38. AlertId string `json:"alert_id"`
  39. AlertRecordId string `json:"alert_record_id"`
  40. Data EvalMatch `json:"data"`
  41. }
  42. type AlertResourceDetails struct {
  43. apis.StandaloneResourceDetails
  44. Count int `json:"count"`
  45. Tags map[string]string `json:"tags"`
  46. }
  47. type AlertResourceAlertListInput struct {
  48. apis.JointResourceBaseListInput
  49. AlertResourceId string `json:"alert_resource_id"`
  50. AlertId string `json:"alert_id"`
  51. }
  52. type AlertResourceJointBaseDetails struct {
  53. apis.JointResourceBaseDetails
  54. AlertResource string `json:"alert_resource"`
  55. Type AlertResourceType `json:"type"`
  56. }
  57. type AlertResourceAlertDetails struct {
  58. AlertResourceJointBaseDetails
  59. Alert string `json:"alert"`
  60. AlertType string `json:"alert_type"`
  61. Level string `json:"level"`
  62. CommonAlertMetricDetails []*CommonAlertMetricDetails `json:"common_alert_metric_details"`
  63. }