Revert "Alerting: Add store level pagination of rules" (#109422)
Revert "Alerting: Add store level pagination of rules (#108633)"
This reverts commit 2f0190d775.
This commit is contained in:
@@ -2,7 +2,6 @@ package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -880,61 +879,6 @@ type GetAlertRulesGroupByRuleUIDQuery struct {
|
||||
OrgID int64
|
||||
}
|
||||
|
||||
type RuleTypeFilter int
|
||||
|
||||
const (
|
||||
RuleTypeFilterAll RuleTypeFilter = iota
|
||||
RuleTypeFilterAlerting
|
||||
RuleTypeFilterRecording
|
||||
)
|
||||
|
||||
type ListAlertRulesByGroupQuery struct {
|
||||
OrgID int64
|
||||
RuleUIDs []string
|
||||
NamespaceUIDs []string
|
||||
ExcludeOrgs []int64
|
||||
RuleGroups []string
|
||||
|
||||
// DashboardUID and PanelID are optional and allow filtering rules
|
||||
// to return just those for a dashboard and panel.
|
||||
DashboardUID string
|
||||
PanelID int64
|
||||
|
||||
ReceiverName string
|
||||
TimeIntervalName string
|
||||
|
||||
HasPrometheusRuleDefinition *bool
|
||||
|
||||
RuleType RuleTypeFilter
|
||||
|
||||
GroupLimit int64 // Number of groups to fetch
|
||||
GroupContinueToken string // Token for per-group pagination
|
||||
}
|
||||
|
||||
type GroupCursor struct {
|
||||
NamespaceUID string `json:"n"`
|
||||
RuleGroup string `json:"g"`
|
||||
}
|
||||
|
||||
func EncodeGroupCursor(c GroupCursor) string {
|
||||
data, _ := json.Marshal(c)
|
||||
return base64.URLEncoding.EncodeToString(data)
|
||||
}
|
||||
|
||||
func DecodeGroupCursor(token string) (GroupCursor, error) {
|
||||
var c GroupCursor
|
||||
data, err := base64.URLEncoding.DecodeString(token)
|
||||
if err != nil {
|
||||
return c, fmt.Errorf("failed to decode group token: %w", err)
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &c); err != nil {
|
||||
return c, fmt.Errorf("failed to unmarshal group cursor: %w", err)
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// ListAlertRulesQuery is the query for listing alert rules
|
||||
type ListAlertRulesQuery struct {
|
||||
OrgID int64
|
||||
|
||||
Reference in New Issue
Block a user