Alerting: Rule Modify Export APIs (#75322)
* extend RuleStore interface to get namespace by UID * add new export API endpoints * implement request handlers * update authorization and wire handlers to paths * add folder error matchers to errorToResponse * add tests for export methods
This commit is contained in:
@@ -11,6 +11,9 @@ import (
|
||||
|
||||
var (
|
||||
errUnexpectedDatasourceType = errors.New("unexpected datasource type")
|
||||
|
||||
// errFolderAccess is used as a wrapper to propagate folder related errors and correctly map to the response status
|
||||
errFolderAccess = errors.New("cannot get folder")
|
||||
)
|
||||
|
||||
func unexpectedDatasourceTypeError(actual string, expected string) error {
|
||||
@@ -34,5 +37,8 @@ func errorToResponse(err error) response.Response {
|
||||
if errors.Is(err, ErrAuthorization) {
|
||||
return ErrResp(401, err, "")
|
||||
}
|
||||
if errors.Is(err, errFolderAccess) {
|
||||
return toNamespaceErrorResponse(err)
|
||||
}
|
||||
return ErrResp(500, err, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user