mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* 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>
53 lines
1.7 KiB
Go
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"`
|
|
}
|