ca8324e62a
Rules created in the new api makes the rule have no group in the database, but the rule is returned in the old group api with a sentinel group name formatted with the rule uid for compatiblity with the old api. This makes the UI continue to work with the rules without a group, and the ruler will continue to work with the rules without a group. Rules are not allowed to be created in the provisioning api with a NoGroup sentinel mask, but NoGroup rules can be manipulated through both the new and old apis. Co-authored-by: William Wernert <william.wernert@grafana.com>
18 lines
548 B
Go
18 lines
548 B
Go
package alertrule
|
|
|
|
import (
|
|
"k8s.io/apiserver/pkg/registry/rest"
|
|
|
|
grafanarest "github.com/grafana/grafana/pkg/apiserver/rest"
|
|
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
|
"github.com/grafana/grafana/pkg/services/ngalert/provisioning"
|
|
)
|
|
|
|
func NewStorage(legacySvc provisioning.AlertRuleService, namespacer request.NamespaceMapper) grafanarest.Storage {
|
|
return &legacyStorage{
|
|
service: legacySvc,
|
|
namespacer: namespacer,
|
|
tableConverter: rest.NewDefaultTableConvertor(ResourceInfo.GroupResource()),
|
|
}
|
|
}
|