mirror of
https://github.com/grafana/grafana.git
synced 2026-08-13 06:34:55 -05:00
backend/datasources: move datasources models into the datasources service package (#51267)
* backend/datasources: move datasources models into the datasources service pkg
This commit is contained in:
@@ -92,18 +92,18 @@ func (p *DataSourceProxyService) ProxyDatasourceRequestWithID(c *models.ReqConte
|
||||
}
|
||||
|
||||
func toAPIError(c *models.ReqContext, err error) {
|
||||
if errors.Is(err, models.ErrDataSourceAccessDenied) {
|
||||
if errors.Is(err, datasources.ErrDataSourceAccessDenied) {
|
||||
c.JsonApiErr(http.StatusForbidden, "Access denied to datasource", err)
|
||||
return
|
||||
}
|
||||
if errors.Is(err, models.ErrDataSourceNotFound) {
|
||||
if errors.Is(err, datasources.ErrDataSourceNotFound) {
|
||||
c.JsonApiErr(http.StatusNotFound, "Unable to find datasource", err)
|
||||
return
|
||||
}
|
||||
c.JsonApiErr(http.StatusInternalServerError, "Unable to load datasource meta data", err)
|
||||
}
|
||||
|
||||
func (p *DataSourceProxyService) proxyDatasourceRequest(c *models.ReqContext, ds *models.DataSource) {
|
||||
func (p *DataSourceProxyService) proxyDatasourceRequest(c *models.ReqContext, ds *datasources.DataSource) {
|
||||
err := p.PluginRequestValidator.Validate(ds.Url, c.Req)
|
||||
if err != nil {
|
||||
c.JsonApiErr(http.StatusForbidden, "Access denied", err)
|
||||
|
||||
Reference in New Issue
Block a user