2
0

monitor.go 851 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package models
  2. import (
  3. "time"
  4. "github.com/porter-dev/porter/api/types"
  5. "gorm.io/gorm"
  6. )
  7. type MonitorTestResult struct {
  8. gorm.Model
  9. ProjectID uint
  10. ClusterID uint
  11. Category string
  12. ObjectID string
  13. LastStatusChange *time.Time
  14. LastTested *time.Time
  15. LastRunResult string
  16. Title string
  17. Message string
  18. Severity string
  19. }
  20. func (m *MonitorTestResult) ToMonitorTestResultType() *types.MonitorTestResult {
  21. return &types.MonitorTestResult{
  22. ProjectID: m.ProjectID,
  23. ClusterID: m.ClusterID,
  24. Category: m.Category,
  25. ObjectID: m.ObjectID,
  26. LastStatusChange: m.LastStatusChange,
  27. LastTested: m.LastTested,
  28. LastRunResult: types.MonitorTestStatus(m.LastRunResult),
  29. Title: m.Title,
  30. Message: m.Message,
  31. Severity: types.MonitorTestSeverity(m.Severity),
  32. }
  33. }