grafana/pkg/api/admin_provisioning.go
Gilles De Mey 8765c48389
Alerting: Remove legacy alerting (#83671)
Removes legacy alerting, so long and thanks for all the fish! 🐟

---------

Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
Co-authored-by: Sonia Aguilar <soniaAguilarPeiron@users.noreply.github.com>
Co-authored-by: Armand Grillet <armandgrillet@users.noreply.github.com>
Co-authored-by: William Wernert <rwwiv@users.noreply.github.com>
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
2024-03-14 15:36:35 +01:00

88 lines
3.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package api
import (
"context"
"errors"
"net/http"
"github.com/grafana/grafana/pkg/api/response"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
)
// swagger:route POST /admin/provisioning/dashboards/reload admin_provisioning adminProvisioningReloadDashboards
//
// Reload dashboard provisioning configurations.
//
// Reloads the provisioning config files for dashboards again. It wont return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.
// If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:dashboards`.
//
// Security:
// - basic:
//
// Responses:
// 200: okResponse
// 401: unauthorisedError
// 403: forbiddenError
// 500: internalServerError
func (hs *HTTPServer) AdminProvisioningReloadDashboards(c *contextmodel.ReqContext) response.Response {
err := hs.ProvisioningService.ProvisionDashboards(c.Req.Context())
if err != nil && !errors.Is(err, context.Canceled) {
return response.Error(http.StatusInternalServerError, "", err)
}
return response.Success("Dashboards config reloaded")
}
// swagger:route POST /admin/provisioning/datasources/reload admin_provisioning adminProvisioningReloadDatasources
//
// Reload datasource provisioning configurations.
//
// Reloads the provisioning config files for datasources again. It wont return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.
// If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:datasources`.
//
// Security:
// - basic:
//
// Responses:
// 200: okResponse
// 401: unauthorisedError
// 403: forbiddenError
// 500: internalServerError
func (hs *HTTPServer) AdminProvisioningReloadDatasources(c *contextmodel.ReqContext) response.Response {
err := hs.ProvisioningService.ProvisionDatasources(c.Req.Context())
if err != nil {
return response.Error(http.StatusInternalServerError, "", err)
}
return response.Success("Datasources config reloaded")
}
// swagger:route POST /admin/provisioning/plugins/reload admin_provisioning adminProvisioningReloadPlugins
//
// Reload plugin provisioning configurations.
//
// Reloads the provisioning config files for plugins again. It wont return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.
// If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:plugin`.
//
// Security:
// - basic:
//
// Responses:
// 200: okResponse
// 401: unauthorisedError
// 403: forbiddenError
// 500: internalServerError
func (hs *HTTPServer) AdminProvisioningReloadPlugins(c *contextmodel.ReqContext) response.Response {
err := hs.ProvisioningService.ProvisionPlugins(c.Req.Context())
if err != nil {
return response.Error(http.StatusInternalServerError, "Failed to reload plugins config", err)
}
return response.Success("Plugins config reloaded")
}
func (hs *HTTPServer) AdminProvisioningReloadAlerting(c *contextmodel.ReqContext) response.Response {
err := hs.ProvisioningService.ProvisionAlerting(c.Req.Context())
if err != nil {
return response.Error(http.StatusInternalServerError, "", err)
}
return response.Success("Alerting config reloaded")
}