Files
grafana/pkg/apis/alerting_notifications/v0alpha1/routingtree_spec.go
Yuri Tseretyan 2deced7d40 Alerting: Notifications Routes API (#91550)
* Introduce new models RoutingTree, RouteDefaults and Route and api-server to serve them that is backed by provisioning notification policy service.

* update method UpdatePolicyTree of notification policy service to return route and new version

* declare new actions alert.notifications.routes:read and alert.notifications.routes:write and two corresponding fixed roles.

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
2024-10-24 13:53:03 -04:00

53 lines
1.7 KiB
Go

package v0alpha1
// Defines values for MatcherType.
const (
MatcherTypeNotEqual MatcherType = "!="
MatcherTypeEqual MatcherType = "="
MatcherTypeEqualRegex MatcherType = "=~"
MatcherTypeNotEqualRegex MatcherType = "!~"
)
// Matcher defines model for Matcher.
// +k8s:openapi-gen=true
type Matcher struct {
Label string `json:"label"`
Type MatcherType `json:"type"`
Value string `json:"value"`
}
// MatcherType defines model for Matcher.Type.
// +k8s:openapi-gen=true
type MatcherType string
// Route defines model for Route.
// +k8s:openapi-gen=true
type Route struct {
Continue bool `json:"continue,omitempty"`
GroupBy []string `json:"group_by,omitempty"`
GroupInterval *string `json:"group_interval,omitempty"`
GroupWait *string `json:"group_wait,omitempty"`
Matchers []Matcher `json:"matchers,omitempty"`
MuteTimeIntervals []string `json:"mute_time_intervals,omitempty"`
Receiver *string `json:"receiver,omitempty"`
RepeatInterval *string `json:"repeat_interval,omitempty"`
Routes []Route `json:"routes,omitempty"`
}
// RouteDefaults defines model for RouteDefaults.
// +k8s:openapi-gen=true
type RouteDefaults struct {
GroupBy []string `json:"group_by,omitempty"`
GroupInterval *string `json:"group_interval,omitempty"`
GroupWait *string `json:"group_wait,omitempty"`
Receiver string `json:"receiver"`
RepeatInterval *string `json:"repeat_interval,omitempty"`
}
// Spec defines model for Spec.
// +k8s:openapi-gen=true
type RoutingTreeSpec struct {
Defaults RouteDefaults `json:"defaults"`
Routes []Route `json:"routes"`
}