Chore: Move swagger definitions to the handlers (#52643)

This commit is contained in:
Sofia Papagiannaki
2022-07-27 09:54:37 -04:00
committed by GitHub
parent c968b76279
commit 7ba076de10
76 changed files with 6022 additions and 6161 deletions
+60
View File
@@ -8,6 +8,21 @@ import (
"github.com/grafana/grafana/pkg/models"
)
// swagger:route POST /admin/provisioning/dashboards/reload admin_provisioning adminProvisioningReloadDashboards
//
// Reload dashboard provisioning configurations.
//
// Reloads the provisioning config files for dashboards again. It won’t 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 *models.ReqContext) response.Response {
err := hs.ProvisioningService.ProvisionDashboards(c.Req.Context())
if err != nil && !errors.Is(err, context.Canceled) {
@@ -16,6 +31,21 @@ func (hs *HTTPServer) AdminProvisioningReloadDashboards(c *models.ReqContext) re
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 won’t 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 *models.ReqContext) response.Response {
err := hs.ProvisioningService.ProvisionDatasources(c.Req.Context())
if err != nil {
@@ -24,6 +54,21 @@ func (hs *HTTPServer) AdminProvisioningReloadDatasources(c *models.ReqContext) r
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 won’t 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 *models.ReqContext) response.Response {
err := hs.ProvisioningService.ProvisionPlugins(c.Req.Context())
if err != nil {
@@ -32,6 +77,21 @@ func (hs *HTTPServer) AdminProvisioningReloadPlugins(c *models.ReqContext) respo
return response.Success("Plugins config reloaded")
}
// swagger:route POST /admin/provisioning/notifications/reload admin_provisioning adminProvisioningReloadNotifications
//
// Reload legacy alert notifier provisioning configurations.
//
// Reloads the provisioning config files for legacy alert notifiers again. It won’t 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:notifications`.
//
// Security:
// - basic:
//
// Responses:
// 200: okResponse
// 401: unauthorisedError
// 403: forbiddenError
// 500: internalServerError
func (hs *HTTPServer) AdminProvisioningReloadNotifications(c *models.ReqContext) response.Response {
err := hs.ProvisioningService.ProvisionNotifications(c.Req.Context())
if err != nil {