models

package
v0.0.0-testrgm6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCannotChangeStateOnPausedAlert = fmt.Errorf("cannot change state on pause alert")
	ErrRequiresNewState               = fmt.Errorf("update alert state requires a new state")
)
View Source
var (
	ErrAlertNotificationNotFound                = errors.New("alert notification not found")
	ErrNotificationFrequencyNotFound            = errors.New("notification frequency not specified")
	ErrAlertNotificationStateVersionConflict    = errors.New("alert notification state update version conflict")
	ErrAlertNotificationFailedGenerateUniqueUid = errors.New("failed to generate unique alert notification uid")
	ErrAlertNotificationFailedTranslateUniqueID = errors.New("failed to translate Notification Id to Uid")
	ErrAlertNotificationWithSameNameExists      = errors.New("alert notification with same name already exists")
	ErrAlertNotificationWithSameUIDExists       = errors.New("alert notification with same uid already exists")
)
View Source
var (
	AlertNotificationStatePending   = AlertNotificationStateType("pending")
	AlertNotificationStateCompleted = AlertNotificationStateType("completed")
	AlertNotificationStateUnknown   = AlertNotificationStateType("unknown")
)

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID             int64 `xorm:"pk autoincr 'id'"`
	Version        int64
	OrgID          int64 `xorm:"org_id"`
	DashboardID    int64 `xorm:"dashboard_id"`
	PanelID        int64 `xorm:"panel_id"`
	Name           string
	Message        string
	Severity       string // Unused
	State          AlertStateType
	Handler        int64 // Unused
	Silenced       bool
	ExecutionError string
	Frequency      int64
	For            time.Duration

	EvalData     *simplejson.Json
	NewStateDate time.Time
	StateChanges int64

	Created time.Time
	Updated time.Time

	Settings *simplejson.Json
}

swagger:model LegacyAlert

func (*Alert) ContainsUpdates

func (a *Alert) ContainsUpdates(other *Alert) bool

func (*Alert) GetTagsFromSettings

func (a *Alert) GetTagsFromSettings() []*tag.Tag

func (*Alert) ValidDashboardPanel

func (a *Alert) ValidDashboardPanel() bool

func (*Alert) ValidTags

func (a *Alert) ValidTags() bool

type AlertListItemDTO

type AlertListItemDTO struct {
	ID             int64            `json:"id" xorm:"id"`
	DashboardID    int64            `json:"dashboardId" xorm:"dashboard_id"`
	DashboardUID   string           `json:"dashboardUid" xorm:"dashboard_uid"`
	DashboardSlug  string           `json:"dashboardSlug"`
	PanelID        int64            `json:"panelId" xorm:"panel_id"`
	Name           string           `json:"name"`
	State          AlertStateType   `json:"state"`
	NewStateDate   time.Time        `json:"newStateDate"`
	EvalDate       time.Time        `json:"evalDate"`
	EvalData       *simplejson.Json `json:"evalData"`
	ExecutionError string           `json:"executionError"`
	URL            string           `json:"url" xorm:"url"`
}

type AlertNotification

type AlertNotification struct {
	ID                    int64             `json:"id" xorm:"pk autoincr 'id'"`
	UID                   string            `json:"-" xorm:"uid"`
	OrgID                 int64             `json:"-" xorm:"org_id"`
	Name                  string            `json:"name"`
	Type                  string            `json:"type"`
	SendReminder          bool              `json:"sendReminder"`
	DisableResolveMessage bool              `json:"disableResolveMessage"`
	Frequency             time.Duration     `json:"frequency"`
	IsDefault             bool              `json:"isDefault"`
	Settings              *simplejson.Json  `json:"settings"`
	SecureSettings        map[string][]byte `json:"secureSettings"`
	Created               time.Time         `json:"created"`
	Updated               time.Time         `json:"updated"`
}

type AlertNotificationState

type AlertNotificationState struct {
	ID                           int64 `xorm:"pk autoincr 'id'"`
	OrgID                        int64 `xorm:"org_id"`
	AlertID                      int64 `xorm:"alert_id"`
	NotifierID                   int64 `xorm:"notifier_id"`
	State                        AlertNotificationStateType
	Version                      int64
	UpdatedAt                    int64
	AlertRuleStateUpdatedVersion int64
}

type AlertNotificationStateType

type AlertNotificationStateType string

type AlertStateInfoDTO

type AlertStateInfoDTO struct {
	ID           int64          `json:"id" xorm:"id"`
	DashboardID  int64          `json:"dashboardId" xorm:"dashboard_id"`
	PanelID      int64          `json:"panelId" xorm:"panel_id"`
	State        AlertStateType `json:"state"`
	NewStateDate time.Time      `json:"newStateDate"`
}

type AlertStateType

type AlertStateType string
const (
	AlertStateNoData   AlertStateType = "no_data"
	AlertStatePaused   AlertStateType = "paused"
	AlertStateAlerting AlertStateType = "alerting"
	AlertStateOK       AlertStateType = "ok"
	AlertStatePending  AlertStateType = "pending"
	AlertStateUnknown  AlertStateType = "unknown"
)

func (AlertStateType) IsValid

func (s AlertStateType) IsValid() bool

type CreateAlertNotificationCommand

type CreateAlertNotificationCommand struct {
	UID                   string            `json:"uid"`
	Name                  string            `json:"name"  binding:"Required"`
	Type                  string            `json:"type"  binding:"Required"`
	SendReminder          bool              `json:"sendReminder"`
	DisableResolveMessage bool              `json:"disableResolveMessage"`
	Frequency             string            `json:"frequency"`
	IsDefault             bool              `json:"isDefault"`
	Settings              *simplejson.Json  `json:"settings"`
	SecureSettings        map[string]string `json:"secureSettings"`

	OrgID                   int64             `json:"-"`
	EncryptedSecureSettings map[string][]byte `json:"-"`
}

type DeleteAlertNotificationCommand

type DeleteAlertNotificationCommand struct {
	ID    int64
	OrgID int64
}

type DeleteAlertNotificationWithUidCommand

type DeleteAlertNotificationWithUidCommand struct {
	UID   string
	OrgID int64

	DeletedAlertNotificationID int64
}

type ExecutionErrorOption

type ExecutionErrorOption string
const (
	ExecutionErrorSetOk       ExecutionErrorOption = "ok"
	ExecutionErrorSetAlerting ExecutionErrorOption = "alerting"
	ExecutionErrorKeepState   ExecutionErrorOption = "keep_state"
)

func (ExecutionErrorOption) IsValid

func (s ExecutionErrorOption) IsValid() bool

func (ExecutionErrorOption) ToAlertState

func (s ExecutionErrorOption) ToAlertState() AlertStateType

type GetAlertByIdQuery

type GetAlertByIdQuery struct {
	ID int64 `xorm:"id"`
}

type GetAlertNotificationUidQuery

type GetAlertNotificationUidQuery struct {
	ID    int64
	OrgID int64
}

type GetAlertNotificationsQuery

type GetAlertNotificationsQuery struct {
	Name  string
	ID    int64
	OrgID int64
}

type GetAlertNotificationsWithUidQuery

type GetAlertNotificationsWithUidQuery struct {
	UID   string
	OrgID int64
}

type GetAlertNotificationsWithUidToSendQuery

type GetAlertNotificationsWithUidToSendQuery struct {
	UIDs  []string
	OrgID int64
}

type GetAlertStatesForDashboardQuery

type GetAlertStatesForDashboardQuery struct {
	OrgID       int64 `xorm:"org_id"`
	DashboardID int64 `xorm:"dashboard_id"`
}

type GetAlertsQuery

type GetAlertsQuery struct {
	OrgID        int64 `xorm:"org_id"`
	State        []string
	DashboardIDs []int64 `xorm:"dashboard_ids"`
	PanelID      int64   `xorm:"panel_id"`
	Limit        int64
	Query        string
	User         *user.SignedInUser
}

Queries

type GetAllAlertNotificationsQuery

type GetAllAlertNotificationsQuery struct {
	OrgID int64
}

type GetAllAlertsQuery

type GetAllAlertsQuery struct{}

type GetOrCreateNotificationStateQuery

type GetOrCreateNotificationStateQuery struct {
	OrgID      int64
	AlertID    int64
	NotifierID int64
}

type NoDataOption

type NoDataOption string
const (
	NoDataSetOK       NoDataOption = "ok"
	NoDataSetNoData   NoDataOption = "no_data"
	NoDataKeepState   NoDataOption = "keep_state"
	NoDataSetAlerting NoDataOption = "alerting"
)

func (NoDataOption) IsValid

func (s NoDataOption) IsValid() bool

func (NoDataOption) ToAlertState

func (s NoDataOption) ToAlertState() AlertStateType

type PauseAlertCommand

type PauseAlertCommand struct {
	OrgID       int64   `xorm:"org_id"`
	AlertIDs    []int64 `xorm:"alert_ids"`
	ResultCount int64
	Paused      bool
}

type PauseAllAlertCommand

type PauseAllAlertCommand struct {
	ResultCount int64
	Paused      bool
}

type SetAlertNotificationStateToCompleteCommand

type SetAlertNotificationStateToCompleteCommand struct {
	ID      int64
	Version int64
}

type SetAlertNotificationStateToPendingCommand

type SetAlertNotificationStateToPendingCommand struct {
	ID                           int64
	AlertRuleStateUpdatedVersion int64
	Version                      int64

	ResultVersion int64
}

type SetAlertStateCommand

type SetAlertStateCommand struct {
	AlertID  int64 `xorm:"alert_id"`
	OrgID    int64 `xorm:"org_id"`
	State    AlertStateType
	Error    string
	EvalData *simplejson.Json
}

type UpdateAlertNotificationCommand

type UpdateAlertNotificationCommand struct {
	ID                    int64             `json:"id"  binding:"Required"`
	UID                   string            `json:"uid"`
	Name                  string            `json:"name"  binding:"Required"`
	Type                  string            `json:"type"  binding:"Required"`
	SendReminder          bool              `json:"sendReminder"`
	DisableResolveMessage bool              `json:"disableResolveMessage"`
	Frequency             string            `json:"frequency"`
	IsDefault             bool              `json:"isDefault"`
	Settings              *simplejson.Json  `json:"settings"  binding:"Required"`
	SecureSettings        map[string]string `json:"secureSettings"`

	OrgID                   int64             `json:"-"`
	EncryptedSecureSettings map[string][]byte `json:"-"`
}

type UpdateAlertNotificationWithUidCommand

type UpdateAlertNotificationWithUidCommand struct {
	UID                   string            `json:"-"`
	NewUID                string            `json:"uid"`
	Name                  string            `json:"name"  binding:"Required"`
	Type                  string            `json:"type"  binding:"Required"`
	SendReminder          bool              `json:"sendReminder"`
	DisableResolveMessage bool              `json:"disableResolveMessage"`
	Frequency             string            `json:"frequency"`
	IsDefault             bool              `json:"isDefault"`
	Settings              *simplejson.Json  `json:"settings"  binding:"Required"`
	SecureSettings        map[string]string `json:"secureSettings"`

	OrgID int64 `json:"-"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL