mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Provisioning message templates (#48665)
* Generate API for writing templates * Persist templates app logic layer * Validate templates * Extract logic, make set and delete methods * Drop post route for templates * Fix response details, wire up remainder of API * Authorize routes * Mirror some existing tests on new APIs * Generate mock for prov store * Wire up prov store mock, add tests using it * Cover cases for both storage paths * Add happy path tests and fix bugs if file contains no template section * Normalize template content with define statement * Tests for deletion * Fix linter error * Move provenance field to DTO * empty commit * ID to name * Fix in auth too
This commit is contained in:
@@ -183,13 +183,15 @@ func (api *API) authorize(method, path string) web.Handler {
|
||||
case http.MethodGet + "/api/provisioning/policies",
|
||||
http.MethodGet + "/api/provisioning/contact-points",
|
||||
http.MethodGet + "/api/provisioning/templates",
|
||||
http.MethodGet + "/api/provisioning/templates/{ID}":
|
||||
http.MethodGet + "/api/provisioning/templates/{name}":
|
||||
return middleware.ReqSignedIn
|
||||
|
||||
case http.MethodPost + "/api/provisioning/policies",
|
||||
http.MethodPost + "/api/provisioning/contact-points",
|
||||
http.MethodPut + "/api/provisioning/contact-points",
|
||||
http.MethodDelete + "/api/provisioning/contact-points/{ID}":
|
||||
http.MethodDelete + "/api/provisioning/contact-points/{ID}",
|
||||
http.MethodPut + "/api/provisioning/templates/{name}",
|
||||
http.MethodDelete + "/api/provisioning/templates/{name}":
|
||||
return middleware.ReqEditorRole
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user