Files
grafana/pkg/services/provisioning/utils/utils.go
T
idafurjes 7c2522c477 Chore: Move dashboard models to dashboard pkg (#61458)
* Copy dashboard models to dashboard pkg

* Use some models from current pkg instead of models

* Adjust api pkg

* Adjust pkg services

* Fix lint
2023-01-16 16:33:55 +01:00

27 lines
610 B
Go

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) 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
}