Skip to content

Rule🔗

Definition🔗

type Rule struct {
    Annotations map[string]string `json:"annotations,omitempty"`
    Condition string `json:"condition"`
    Data []alerting.Query `json:"data"`
    ExecErrState alerting.RuleExecErrState `json:"execErrState"`
    FolderUID string `json:"folderUID"`
    // The amount of time, in seconds, for which the rule must be breached for the rule to be considered to be Firing.
    // Before this time has elapsed, the rule is only considered to be Pending.
    For string `json:"for"`
    Id *int64 `json:"id,omitempty"`
    IsPaused *bool `json:"isPaused,omitempty"`
    Labels map[string]string `json:"labels,omitempty"`
    NoDataState alerting.RuleNoDataState `json:"noDataState"`
    NotificationSettings *alerting.NotificationSettings `json:"notification_settings,omitempty"`
    OrgID int64 `json:"orgID"`
    Provenance *alerting.Provenance `json:"provenance,omitempty"`
    Record *alerting.RecordRule `json:"record,omitempty"`
    RuleGroup string `json:"ruleGroup"`
    Title string `json:"title"`
    Uid *string `json:"uid,omitempty"`
    Updated *time.Time `json:"updated,omitempty"`
}

Methods🔗

UnmarshalJSONStrict🔗

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode Rule from JSON.

Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (rule *Rule) UnmarshalJSONStrict(raw []byte) error

Equals🔗

Equals tests the equality of two Rule objects.

func (rule *Rule) Equals(other Rule) bool

Validate🔗

Validate checks all the validation constraints that may be defined on Rule fields for violations and returns them.

func (rule *Rule) Validate() error

See also🔗