Documentation ¶
Index ¶
- Constants
- Variables
- func NewIDScopeResolver(db Store) (string, ac.AttributeScopeResolveFunc)
- func NewNameScopeResolver(db Store) (string, ac.AttributeScopeResolveFunc)
- type DashboardProvisioningService
- type DashboardService
- type FakeDashboardProvisioning
- func (_m *FakeDashboardProvisioning) DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
- func (_m *FakeDashboardProvisioning) DeleteProvisionedDashboard(ctx context.Context, dashboardID int64, orgID int64) error
- func (_m *FakeDashboardProvisioning) GetProvisionedDashboardData(name string) ([]*models.DashboardProvisioning, error)
- func (_m *FakeDashboardProvisioning) GetProvisionedDashboardDataByDashboardID(dashboardID int64) (*models.DashboardProvisioning, error)
- func (_m *FakeDashboardProvisioning) GetProvisionedDashboardDataByDashboardUID(orgID int64, dashboardUID string) (*models.DashboardProvisioning, error)
- func (_m *FakeDashboardProvisioning) SaveFolderForProvisionedDashboards(_a0 context.Context, _a1 *SaveDashboardDTO) (*models.Dashboard, error)
- func (_m *FakeDashboardProvisioning) SaveProvisionedDashboard(ctx context.Context, dto *SaveDashboardDTO, ...) (*models.Dashboard, error)
- func (_m *FakeDashboardProvisioning) UnprovisionDashboard(ctx context.Context, dashboardID int64) error
- type FakeDashboardService
- func (s *FakeDashboardService) DeleteDashboard(ctx context.Context, dashboardId int64, orgId int64) error
- func (s *FakeDashboardService) DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
- func (s *FakeDashboardService) GetProvisionedDashboardDataByDashboardID(id int64) (*models.DashboardProvisioning, error)
- func (s *FakeDashboardService) ImportDashboard(ctx context.Context, dto *SaveDashboardDTO) (*models.Dashboard, error)
- func (s *FakeDashboardService) SaveDashboard(ctx context.Context, dto *SaveDashboardDTO, allowUiUpdate bool) (*models.Dashboard, error)
- type FakeDashboardStore
- func (_m *FakeDashboardStore) DeleteDashboard(ctx context.Context, cmd *models.DeleteDashboardCommand) error
- func (_m *FakeDashboardStore) DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
- func (_m *FakeDashboardStore) GetDashboardsByPluginID(ctx context.Context, query *models.GetDashboardsByPluginIdQuery) error
- func (_m *FakeDashboardStore) GetFolderByID(ctx context.Context, orgID int64, id int64) (*models.Folder, error)
- func (_m *FakeDashboardStore) GetFolderByTitle(ctx context.Context, orgID int64, title string) (*models.Folder, error)
- func (_m *FakeDashboardStore) GetFolderByUID(ctx context.Context, orgID int64, uid string) (*models.Folder, error)
- func (_m *FakeDashboardStore) GetProvisionedDashboardData(name string) ([]*models.DashboardProvisioning, error)
- func (_m *FakeDashboardStore) GetProvisionedDataByDashboardID(dashboardID int64) (*models.DashboardProvisioning, error)
- func (_m *FakeDashboardStore) GetProvisionedDataByDashboardUID(orgID int64, dashboardUID string) (*models.DashboardProvisioning, error)
- func (_m *FakeDashboardStore) SaveAlerts(ctx context.Context, dashID int64, alerts []*models.Alert) error
- func (_m *FakeDashboardStore) SaveDashboard(cmd models.SaveDashboardCommand) (*models.Dashboard, error)
- func (_m *FakeDashboardStore) SaveProvisionedDashboard(cmd models.SaveDashboardCommand, provisioning *models.DashboardProvisioning) (*models.Dashboard, error)
- func (_m *FakeDashboardStore) UnprovisionDashboard(ctx context.Context, id int64) error
- func (_m *FakeDashboardStore) UpdateDashboardACL(ctx context.Context, uid int64, items []*models.DashboardAcl) error
- func (_m *FakeDashboardStore) ValidateDashboardBeforeSave(dashboard *models.Dashboard, overwrite bool) (bool, error)
- type FakeFolderService
- func (_m *FakeFolderService) CreateFolder(ctx context.Context, user *models.SignedInUser, orgID int64, title string, ...) (*models.Folder, error)
- func (_m *FakeFolderService) DeleteFolder(ctx context.Context, user *models.SignedInUser, orgID int64, uid string, ...) (*models.Folder, error)
- func (_m *FakeFolderService) GetFolderByID(ctx context.Context, user *models.SignedInUser, id int64, orgID int64) (*models.Folder, error)
- func (_m *FakeFolderService) GetFolderByTitle(ctx context.Context, user *models.SignedInUser, orgID int64, title string) (*models.Folder, error)
- func (_m *FakeFolderService) GetFolderByUID(ctx context.Context, user *models.SignedInUser, orgID int64, uid string) (*models.Folder, error)
- func (_m *FakeFolderService) GetFolders(ctx context.Context, user *models.SignedInUser, orgID int64, limit int64, ...) ([]*models.Folder, error)
- func (_m *FakeFolderService) MakeUserAdmin(ctx context.Context, orgID int64, userID int64, folderID int64, ...) error
- func (_m *FakeFolderService) UpdateFolder(ctx context.Context, user *models.SignedInUser, orgID int64, ...) error
- type FakeFolderStore
- func (_m *FakeFolderStore) GetFolderByID(ctx context.Context, orgID int64, id int64) (*models.Folder, error)
- func (_m *FakeFolderStore) GetFolderByTitle(ctx context.Context, orgID int64, title string) (*models.Folder, error)
- func (_m *FakeFolderStore) GetFolderByUID(ctx context.Context, orgID int64, uid string) (*models.Folder, error)
- type FolderService
- type FolderStore
- type PluginService
- type SaveDashboardDTO
- type Store
Constants ¶
const ( ScopeFoldersRoot = "folders" ScopeFoldersPrefix = "folders:uid:" ActionDashboardsCreate = "dashboards:create" ActionFoldersCreate = "folders:create" ActionFoldersRead = "folders:read" ActionFoldersWrite = "folders:write" ActionFoldersDelete = "folders:delete" ActionFoldersPermissionsRead = "folders.permissions:read" ActionFoldersPermissionsWrite = "folders.permissions:write" ScopeDashboardsRoot = "dashboards" ScopeDashboardsPrefix = "dashboards:uid:" )
Variables ¶
var ( ScopeFoldersAll = ac.GetResourceAllScope(ScopeFoldersRoot) ScopeFoldersProvider = ac.NewScopeProvider(ScopeFoldersRoot) )
Functions ¶
func NewIDScopeResolver ¶
func NewIDScopeResolver(db Store) (string, ac.AttributeScopeResolveFunc)
NewIDScopeResolver provides an AttributeScopeResolver that is able to convert a scope prefixed with "folders:id:" into an uid based scope.
func NewNameScopeResolver ¶
func NewNameScopeResolver(db Store) (string, ac.AttributeScopeResolveFunc)
NewNameScopeResolver provides an AttributeScopeResolver that is able to convert a scope prefixed with "folders:name:" into an uid based scope.
Types ¶
type DashboardProvisioningService ¶
type DashboardProvisioningService interface { SaveProvisionedDashboard(ctx context.Context, dto *SaveDashboardDTO, provisioning *models.DashboardProvisioning) (*models.Dashboard, error) SaveFolderForProvisionedDashboards(context.Context, *SaveDashboardDTO) (*models.Dashboard, error) GetProvisionedDashboardData(name string) ([]*models.DashboardProvisioning, error) GetProvisionedDashboardDataByDashboardUID(orgID int64, dashboardUID string) (*models.DashboardProvisioning, error) GetProvisionedDashboardDataByDashboardID(dashboardID int64) (*models.DashboardProvisioning, error) UnprovisionDashboard(ctx context.Context, dashboardID int64) error DeleteProvisionedDashboard(ctx context.Context, dashboardID int64, orgID int64) error DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error }
DashboardProvisioningService is a service for operating on provisioned dashboards.
type DashboardService ¶
type DashboardService interface { SaveDashboard(ctx context.Context, dto *SaveDashboardDTO, allowUiUpdate bool) (*models.Dashboard, error) ImportDashboard(ctx context.Context, dto *SaveDashboardDTO) (*models.Dashboard, error) DeleteDashboard(ctx context.Context, dashboardId int64, orgId int64) error MakeUserAdmin(ctx context.Context, orgID int64, userID, dashboardID int64, setViewAndEditPermissions bool) error BuildSaveDashboardCommand(ctx context.Context, dto *SaveDashboardDTO, shouldValidateAlerts bool, validateProvisionedDashboard bool) (*models.SaveDashboardCommand, error) UpdateDashboardACL(ctx context.Context, uid int64, items []*models.DashboardAcl) error }
DashboardService is a service for operating on dashboards.
type FakeDashboardProvisioning ¶
FakeDashboardProvisioning is an autogenerated mock type for the DashboardProvisioningService type
func (*FakeDashboardProvisioning) DeleteOrphanedProvisionedDashboards ¶
func (_m *FakeDashboardProvisioning) DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
DeleteOrphanedProvisionedDashboards provides a mock function with given fields: ctx, cmd
func (*FakeDashboardProvisioning) DeleteProvisionedDashboard ¶
func (_m *FakeDashboardProvisioning) DeleteProvisionedDashboard(ctx context.Context, dashboardID int64, orgID int64) error
DeleteProvisionedDashboard provides a mock function with given fields: ctx, dashboardID, orgID
func (*FakeDashboardProvisioning) GetProvisionedDashboardData ¶
func (_m *FakeDashboardProvisioning) GetProvisionedDashboardData(name string) ([]*models.DashboardProvisioning, error)
GetProvisionedDashboardData provides a mock function with given fields: name
func (*FakeDashboardProvisioning) GetProvisionedDashboardDataByDashboardID ¶
func (_m *FakeDashboardProvisioning) GetProvisionedDashboardDataByDashboardID(dashboardID int64) (*models.DashboardProvisioning, error)
GetProvisionedDashboardDataByDashboardID provides a mock function with given fields: dashboardID
func (*FakeDashboardProvisioning) GetProvisionedDashboardDataByDashboardUID ¶
func (_m *FakeDashboardProvisioning) GetProvisionedDashboardDataByDashboardUID(orgID int64, dashboardUID string) (*models.DashboardProvisioning, error)
GetProvisionedDashboardDataByDashboardUID provides a mock function with given fields: orgID, dashboardUID
func (*FakeDashboardProvisioning) SaveFolderForProvisionedDashboards ¶
func (_m *FakeDashboardProvisioning) SaveFolderForProvisionedDashboards(_a0 context.Context, _a1 *SaveDashboardDTO) (*models.Dashboard, error)
SaveFolderForProvisionedDashboards provides a mock function with given fields: _a0, _a1
func (*FakeDashboardProvisioning) SaveProvisionedDashboard ¶
func (_m *FakeDashboardProvisioning) SaveProvisionedDashboard(ctx context.Context, dto *SaveDashboardDTO, provisioning *models.DashboardProvisioning) (*models.Dashboard, error)
SaveProvisionedDashboard provides a mock function with given fields: ctx, dto, provisioning
func (*FakeDashboardProvisioning) UnprovisionDashboard ¶
func (_m *FakeDashboardProvisioning) UnprovisionDashboard(ctx context.Context, dashboardID int64) error
UnprovisionDashboard provides a mock function with given fields: ctx, dashboardID
type FakeDashboardService ¶
type FakeDashboardService struct { DashboardService SaveDashboardResult *models.Dashboard SaveDashboardError error SavedDashboards []*SaveDashboardDTO ProvisionedDashData *models.DashboardProvisioning }
func (*FakeDashboardService) DeleteDashboard ¶
func (*FakeDashboardService) DeleteOrphanedProvisionedDashboards ¶
func (s *FakeDashboardService) DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
func (*FakeDashboardService) GetProvisionedDashboardDataByDashboardID ¶
func (s *FakeDashboardService) GetProvisionedDashboardDataByDashboardID(id int64) (*models.DashboardProvisioning, error)
func (*FakeDashboardService) ImportDashboard ¶
func (s *FakeDashboardService) ImportDashboard(ctx context.Context, dto *SaveDashboardDTO) (*models.Dashboard, error)
func (*FakeDashboardService) SaveDashboard ¶
func (s *FakeDashboardService) SaveDashboard(ctx context.Context, dto *SaveDashboardDTO, allowUiUpdate bool) (*models.Dashboard, error)
type FakeDashboardStore ¶
FakeDashboardStore is an autogenerated mock type for the Store type
func (*FakeDashboardStore) DeleteDashboard ¶
func (_m *FakeDashboardStore) DeleteDashboard(ctx context.Context, cmd *models.DeleteDashboardCommand) error
DeleteDashboard provides a mock function with given fields: ctx, cmd
func (*FakeDashboardStore) DeleteOrphanedProvisionedDashboards ¶
func (_m *FakeDashboardStore) DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
DeleteOrphanedProvisionedDashboards provides a mock function with given fields: ctx, cmd
func (*FakeDashboardStore) GetDashboardsByPluginID ¶
func (_m *FakeDashboardStore) GetDashboardsByPluginID(ctx context.Context, query *models.GetDashboardsByPluginIdQuery) error
GetDashboardsByPluginID provides a mock function with given fields: ctx, query
func (*FakeDashboardStore) GetFolderByID ¶
func (_m *FakeDashboardStore) GetFolderByID(ctx context.Context, orgID int64, id int64) (*models.Folder, error)
GetFolderByID provides a mock function with given fields: ctx, orgID, id
func (*FakeDashboardStore) GetFolderByTitle ¶
func (_m *FakeDashboardStore) GetFolderByTitle(ctx context.Context, orgID int64, title string) (*models.Folder, error)
GetFolderByTitle provides a mock function with given fields: ctx, orgID, title
func (*FakeDashboardStore) GetFolderByUID ¶
func (_m *FakeDashboardStore) GetFolderByUID(ctx context.Context, orgID int64, uid string) (*models.Folder, error)
GetFolderByUID provides a mock function with given fields: ctx, orgID, uid
func (*FakeDashboardStore) GetProvisionedDashboardData ¶
func (_m *FakeDashboardStore) GetProvisionedDashboardData(name string) ([]*models.DashboardProvisioning, error)
GetProvisionedDashboardData provides a mock function with given fields: name
func (*FakeDashboardStore) GetProvisionedDataByDashboardID ¶
func (_m *FakeDashboardStore) GetProvisionedDataByDashboardID(dashboardID int64) (*models.DashboardProvisioning, error)
GetProvisionedDataByDashboardID provides a mock function with given fields: dashboardID
func (*FakeDashboardStore) GetProvisionedDataByDashboardUID ¶
func (_m *FakeDashboardStore) GetProvisionedDataByDashboardUID(orgID int64, dashboardUID string) (*models.DashboardProvisioning, error)
GetProvisionedDataByDashboardUID provides a mock function with given fields: orgID, dashboardUID
func (*FakeDashboardStore) SaveAlerts ¶
func (_m *FakeDashboardStore) SaveAlerts(ctx context.Context, dashID int64, alerts []*models.Alert) error
SaveAlerts provides a mock function with given fields: ctx, dashID, alerts
func (*FakeDashboardStore) SaveDashboard ¶
func (_m *FakeDashboardStore) SaveDashboard(cmd models.SaveDashboardCommand) (*models.Dashboard, error)
SaveDashboard provides a mock function with given fields: cmd
func (*FakeDashboardStore) SaveProvisionedDashboard ¶
func (_m *FakeDashboardStore) SaveProvisionedDashboard(cmd models.SaveDashboardCommand, provisioning *models.DashboardProvisioning) (*models.Dashboard, error)
SaveProvisionedDashboard provides a mock function with given fields: cmd, provisioning
func (*FakeDashboardStore) UnprovisionDashboard ¶
func (_m *FakeDashboardStore) UnprovisionDashboard(ctx context.Context, id int64) error
UnprovisionDashboard provides a mock function with given fields: ctx, id
func (*FakeDashboardStore) UpdateDashboardACL ¶
func (_m *FakeDashboardStore) UpdateDashboardACL(ctx context.Context, uid int64, items []*models.DashboardAcl) error
UpdateDashboardACL provides a mock function with given fields: ctx, uid, items
func (*FakeDashboardStore) ValidateDashboardBeforeSave ¶
func (_m *FakeDashboardStore) ValidateDashboardBeforeSave(dashboard *models.Dashboard, overwrite bool) (bool, error)
ValidateDashboardBeforeSave provides a mock function with given fields: dashboard, overwrite
type FakeFolderService ¶
FakeFolderService is an autogenerated mock type for the FolderService type
func (*FakeFolderService) CreateFolder ¶
func (_m *FakeFolderService) CreateFolder(ctx context.Context, user *models.SignedInUser, orgID int64, title string, uid string) (*models.Folder, error)
CreateFolder provides a mock function with given fields: ctx, user, orgID, title, uid
func (*FakeFolderService) DeleteFolder ¶
func (_m *FakeFolderService) DeleteFolder(ctx context.Context, user *models.SignedInUser, orgID int64, uid string, forceDeleteRules bool) (*models.Folder, error)
DeleteFolder provides a mock function with given fields: ctx, user, orgID, uid, forceDeleteRules
func (*FakeFolderService) GetFolderByID ¶
func (_m *FakeFolderService) GetFolderByID(ctx context.Context, user *models.SignedInUser, id int64, orgID int64) (*models.Folder, error)
GetFolderByID provides a mock function with given fields: ctx, user, id, orgID
func (*FakeFolderService) GetFolderByTitle ¶
func (_m *FakeFolderService) GetFolderByTitle(ctx context.Context, user *models.SignedInUser, orgID int64, title string) (*models.Folder, error)
GetFolderByTitle provides a mock function with given fields: ctx, user, orgID, title
func (*FakeFolderService) GetFolderByUID ¶
func (_m *FakeFolderService) GetFolderByUID(ctx context.Context, user *models.SignedInUser, orgID int64, uid string) (*models.Folder, error)
GetFolderByUID provides a mock function with given fields: ctx, user, orgID, uid
func (*FakeFolderService) GetFolders ¶
func (_m *FakeFolderService) GetFolders(ctx context.Context, user *models.SignedInUser, orgID int64, limit int64, page int64) ([]*models.Folder, error)
GetFolders provides a mock function with given fields: ctx, user, orgID, limit, page
func (*FakeFolderService) MakeUserAdmin ¶
func (_m *FakeFolderService) MakeUserAdmin(ctx context.Context, orgID int64, userID int64, folderID int64, setViewAndEditPermissions bool) error
MakeUserAdmin provides a mock function with given fields: ctx, orgID, userID, folderID, setViewAndEditPermissions
func (*FakeFolderService) UpdateFolder ¶
func (_m *FakeFolderService) UpdateFolder(ctx context.Context, user *models.SignedInUser, orgID int64, existingUid string, cmd *models.UpdateFolderCommand) error
UpdateFolder provides a mock function with given fields: ctx, user, orgID, existingUid, cmd
type FakeFolderStore ¶
FakeFolderStore is an autogenerated mock type for the FolderStore type
func (*FakeFolderStore) GetFolderByID ¶
func (_m *FakeFolderStore) GetFolderByID(ctx context.Context, orgID int64, id int64) (*models.Folder, error)
GetFolderByID provides a mock function with given fields: ctx, orgID, id
func (*FakeFolderStore) GetFolderByTitle ¶
func (_m *FakeFolderStore) GetFolderByTitle(ctx context.Context, orgID int64, title string) (*models.Folder, error)
GetFolderByTitle provides a mock function with given fields: ctx, orgID, title
func (*FakeFolderStore) GetFolderByUID ¶
func (_m *FakeFolderStore) GetFolderByUID(ctx context.Context, orgID int64, uid string) (*models.Folder, error)
GetFolderByUID provides a mock function with given fields: ctx, orgID, uid
type FolderService ¶
type FolderService interface { GetFolders(ctx context.Context, user *models.SignedInUser, orgID int64, limit int64, page int64) ([]*models.Folder, error) GetFolderByID(ctx context.Context, user *models.SignedInUser, id int64, orgID int64) (*models.Folder, error) GetFolderByUID(ctx context.Context, user *models.SignedInUser, orgID int64, uid string) (*models.Folder, error) GetFolderByTitle(ctx context.Context, user *models.SignedInUser, orgID int64, title string) (*models.Folder, error) CreateFolder(ctx context.Context, user *models.SignedInUser, orgID int64, title, uid string) (*models.Folder, error) UpdateFolder(ctx context.Context, user *models.SignedInUser, orgID int64, existingUid string, cmd *models.UpdateFolderCommand) error DeleteFolder(ctx context.Context, user *models.SignedInUser, orgID int64, uid string, forceDeleteRules bool) (*models.Folder, error) MakeUserAdmin(ctx context.Context, orgID int64, userID, folderID int64, setViewAndEditPermissions bool) error }
FolderService is a service for operating on folders.
type FolderStore ¶
type FolderStore interface { // GetFolderByTitle retrieves a folder by its title GetFolderByTitle(ctx context.Context, orgID int64, title string) (*models.Folder, error) // GetFolderByUID retrieves a folder by its UID GetFolderByUID(ctx context.Context, orgID int64, uid string) (*models.Folder, error) // GetFolderByID retrieves a folder by its ID GetFolderByID(ctx context.Context, orgID int64, id int64) (*models.Folder, error) }
FolderStore is a folder store.
type PluginService ¶
type PluginService interface {
GetDashboardsByPluginID(ctx context.Context, query *models.GetDashboardsByPluginIdQuery) error
}
PluginService is a service for operating on plugin dashboards.
type SaveDashboardDTO ¶
type Store ¶
type Store interface { // ValidateDashboardBeforeSave validates a dashboard before save. ValidateDashboardBeforeSave(dashboard *models.Dashboard, overwrite bool) (bool, error) GetProvisionedDataByDashboardID(dashboardID int64) (*models.DashboardProvisioning, error) GetProvisionedDataByDashboardUID(orgID int64, dashboardUID string) (*models.DashboardProvisioning, error) GetProvisionedDashboardData(name string) ([]*models.DashboardProvisioning, error) SaveProvisionedDashboard(cmd models.SaveDashboardCommand, provisioning *models.DashboardProvisioning) (*models.Dashboard, error) SaveDashboard(cmd models.SaveDashboardCommand) (*models.Dashboard, error) UpdateDashboardACL(ctx context.Context, uid int64, items []*models.DashboardAcl) error DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error // SaveAlerts saves dashboard alerts. SaveAlerts(ctx context.Context, dashID int64, alerts []*models.Alert) error UnprovisionDashboard(ctx context.Context, id int64) error // GetDashboardsByPluginID retrieves dashboards identified by plugin. GetDashboardsByPluginID(ctx context.Context, query *models.GetDashboardsByPluginIdQuery) error DeleteDashboard(ctx context.Context, cmd *models.DeleteDashboardCommand) error FolderStore }
Store is a dashboard store.