The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/services/provisioning/utils/utils.go

26 lines
635 B

package utils
import (
"context"
"errors"
"fmt"
"github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/org"
)
type DashboardStore interface {
GetDashboard(context.Context, *dashboards.GetDashboardQuery) (*dashboards.Dashboard, error)
}
func CheckOrgExists(ctx context.Context, orgService org.Service, orgID int64) error {
query := org.GetOrgByIDQuery{ID: orgID}
_, err := orgService.GetByID(ctx, &query)
if err != nil {
if errors.Is(err, org.ErrOrgNotFound) {
return err
}
return fmt.Errorf("failed to check whether org. with the given ID exists: %w", err)
}
return nil
}