Documentation ¶
Index ¶
- Variables
- func GenerateAccessToken() (string, error)
- func LogQueryFailure(datasources []string, log log.Logger, err error)
- func LogQuerySuccess(datasources []string, log log.Logger)
- func UnmarshalDashboardAnnotations(sj *simplejson.Json) (*models.AnnotationsDto, error)
- type PublicDashboardServiceImpl
- func (pd *PublicDashboardServiceImpl) Create(ctx context.Context, u *user.SignedInUser, dto *SavePublicDashboardDTO) (*PublicDashboard, error)
- func (pd *PublicDashboardServiceImpl) Delete(ctx context.Context, uid string) error
- func (pd *PublicDashboardServiceImpl) DeleteByDashboard(ctx context.Context, dashboard *dashboards.Dashboard) error
- func (pd *PublicDashboardServiceImpl) ExistsEnabledByAccessToken(ctx context.Context, accessToken string) (bool, error)
- func (pd *PublicDashboardServiceImpl) ExistsEnabledByDashboardUid(ctx context.Context, dashboardUid string) (bool, error)
- func (pd *PublicDashboardServiceImpl) Find(ctx context.Context, uid string) (*PublicDashboard, error)
- func (pd *PublicDashboardServiceImpl) FindAllWithPagination(ctx context.Context, query *PublicDashboardListQuery) (*PublicDashboardListResponseWithPagination, error)
- func (pd *PublicDashboardServiceImpl) FindAnnotations(ctx context.Context, reqDTO models.AnnotationsQueryDTO, accessToken string) ([]models.AnnotationEvent, error)
- func (pd *PublicDashboardServiceImpl) FindByAccessToken(ctx context.Context, accessToken string) (*PublicDashboard, error)
- func (pd *PublicDashboardServiceImpl) FindByDashboardUid(ctx context.Context, orgId int64, dashboardUid string) (*PublicDashboard, error)
- func (pd *PublicDashboardServiceImpl) FindDashboard(ctx context.Context, orgId int64, dashboardUid string) (*dashboards.Dashboard, error)
- func (pd *PublicDashboardServiceImpl) FindEnabledPublicDashboardAndDashboardByAccessToken(ctx context.Context, accessToken string) (*PublicDashboard, *dashboards.Dashboard, error)
- func (pd *PublicDashboardServiceImpl) FindPublicDashboardAndDashboardByAccessToken(ctx context.Context, accessToken string) (*PublicDashboard, *dashboards.Dashboard, error)
- func (pd *PublicDashboardServiceImpl) GetMetricRequest(ctx context.Context, dashboard *dashboards.Dashboard, ...) (dtos.MetricRequest, error)
- func (pd *PublicDashboardServiceImpl) GetOrgIdByAccessToken(ctx context.Context, accessToken string) (int64, error)
- func (pd *PublicDashboardServiceImpl) GetQueryDataResponse(ctx context.Context, skipDSCache bool, queryDto models.PublicDashboardQueryDTO, ...) (*backend.QueryDataResponse, error)
- func (pd *PublicDashboardServiceImpl) NewPublicDashboardAccessToken(ctx context.Context) (string, error)
- func (pd *PublicDashboardServiceImpl) NewPublicDashboardUid(ctx context.Context) (string, error)
- func (pd *PublicDashboardServiceImpl) Update(ctx context.Context, u *user.SignedInUser, dto *SavePublicDashboardDTO) (*PublicDashboard, error)
- type PublicDashboardServiceWrapperImpl
Constants ¶
This section is empty.
Variables ¶
var LogPrefix = "publicdashboards.service"
var NewDataTimeRange = legacydata.NewDataTimeRange
NewDataTimeRange declared to be able to stub this function in tests
Functions ¶
func GenerateAccessToken ¶
GenerateAccessToken generates an uuid formatted without dashes to use as access token
func LogQuerySuccess ¶
func UnmarshalDashboardAnnotations ¶
func UnmarshalDashboardAnnotations(sj *simplejson.Json) (*models.AnnotationsDto, error)
Types ¶
type PublicDashboardServiceImpl ¶
type PublicDashboardServiceImpl struct { QueryDataService query.Service AnnotationsRepo annotations.Repository // contains filtered or unexported fields }
PublicDashboardServiceImpl Define the Service Implementation. We're generating mock implementation automatically
func ProvideService ¶
func ProvideService( cfg *setting.Cfg, store publicdashboards.Store, qds query.Service, anno annotations.Repository, ac accesscontrol.AccessControl, serviceWrapper publicdashboards.ServiceWrapper, ) *PublicDashboardServiceImpl
ProvideService Factory for method used by wire to inject dependencies. builds the service, and api, and configures routes
func (*PublicDashboardServiceImpl) Create ¶
func (pd *PublicDashboardServiceImpl) Create(ctx context.Context, u *user.SignedInUser, dto *SavePublicDashboardDTO) (*PublicDashboard, error)
Creates and validates the public dashboard and saves it to the database
func (*PublicDashboardServiceImpl) Delete ¶
func (pd *PublicDashboardServiceImpl) Delete(ctx context.Context, uid string) error
func (*PublicDashboardServiceImpl) DeleteByDashboard ¶
func (pd *PublicDashboardServiceImpl) DeleteByDashboard(ctx context.Context, dashboard *dashboards.Dashboard) error
func (*PublicDashboardServiceImpl) ExistsEnabledByAccessToken ¶
func (*PublicDashboardServiceImpl) ExistsEnabledByDashboardUid ¶
func (*PublicDashboardServiceImpl) Find ¶
func (pd *PublicDashboardServiceImpl) Find(ctx context.Context, uid string) (*PublicDashboard, error)
func (*PublicDashboardServiceImpl) FindAllWithPagination ¶
func (pd *PublicDashboardServiceImpl) FindAllWithPagination(ctx context.Context, query *PublicDashboardListQuery) (*PublicDashboardListResponseWithPagination, error)
FindAllWithPagination Returns a list of public dashboards by orgId, based on permissions and with pagination
func (*PublicDashboardServiceImpl) FindAnnotations ¶
func (pd *PublicDashboardServiceImpl) FindAnnotations(ctx context.Context, reqDTO models.AnnotationsQueryDTO, accessToken string) ([]models.AnnotationEvent, error)
FindAnnotations returns annotations for a public dashboard
func (*PublicDashboardServiceImpl) FindByAccessToken ¶
func (pd *PublicDashboardServiceImpl) FindByAccessToken(ctx context.Context, accessToken string) (*PublicDashboard, error)
FindByAccessToken Gets public dashboard by access token
func (*PublicDashboardServiceImpl) FindByDashboardUid ¶
func (pd *PublicDashboardServiceImpl) FindByDashboardUid(ctx context.Context, orgId int64, dashboardUid string) (*PublicDashboard, error)
FindByDashboardUid this method would be replaced by another implementation for Enterprise version
func (*PublicDashboardServiceImpl) FindDashboard ¶
func (pd *PublicDashboardServiceImpl) FindDashboard(ctx context.Context, orgId int64, dashboardUid string) (*dashboards.Dashboard, error)
FindDashboard Gets a dashboard by Uid
func (*PublicDashboardServiceImpl) FindEnabledPublicDashboardAndDashboardByAccessToken ¶
func (pd *PublicDashboardServiceImpl) FindEnabledPublicDashboardAndDashboardByAccessToken(ctx context.Context, accessToken string) (*PublicDashboard, *dashboards.Dashboard, error)
FindEnabledPublicDashboardAndDashboardByAccessToken Gets public dashboard and a dashboard by access token if public dashboard is enabled
func (*PublicDashboardServiceImpl) FindPublicDashboardAndDashboardByAccessToken ¶
func (pd *PublicDashboardServiceImpl) FindPublicDashboardAndDashboardByAccessToken(ctx context.Context, accessToken string) (*PublicDashboard, *dashboards.Dashboard, error)
FindPublicDashboardAndDashboardByAccessToken Gets public dashboard and a dashboard by access token
func (*PublicDashboardServiceImpl) GetMetricRequest ¶
func (pd *PublicDashboardServiceImpl) GetMetricRequest(ctx context.Context, dashboard *dashboards.Dashboard, publicDashboard *models.PublicDashboard, panelId int64, queryDto models.PublicDashboardQueryDTO) (dtos.MetricRequest, error)
GetMetricRequest returns a metric request for the given panel and query
func (*PublicDashboardServiceImpl) GetOrgIdByAccessToken ¶
func (*PublicDashboardServiceImpl) GetQueryDataResponse ¶
func (pd *PublicDashboardServiceImpl) GetQueryDataResponse(ctx context.Context, skipDSCache bool, queryDto models.PublicDashboardQueryDTO, panelId int64, accessToken string) (*backend.QueryDataResponse, error)
GetQueryDataResponse returns a query data response for the given panel and query
func (*PublicDashboardServiceImpl) NewPublicDashboardAccessToken ¶
func (pd *PublicDashboardServiceImpl) NewPublicDashboardAccessToken(ctx context.Context) (string, error)
NewPublicDashboardAccessToken Generates a unique accessToken to create a public dashboard. Will make 3 attempts and fail if it cannot find an unused access token
func (*PublicDashboardServiceImpl) NewPublicDashboardUid ¶
func (pd *PublicDashboardServiceImpl) NewPublicDashboardUid(ctx context.Context) (string, error)
NewPublicDashboardUid Generates a unique uid to create a public dashboard. Will make 3 attempts and fail if it cannot find an unused uid
func (*PublicDashboardServiceImpl) Update ¶
func (pd *PublicDashboardServiceImpl) Update(ctx context.Context, u *user.SignedInUser, dto *SavePublicDashboardDTO) (*PublicDashboard, error)
Update: updates an existing public dashboard based on publicdashboard.Uid
type PublicDashboardServiceWrapperImpl ¶
type PublicDashboardServiceWrapperImpl struct {
// contains filtered or unexported fields
}
PublicDashboardServiceWrapperImpl Define the Service Implementation. We're generating mock implementation automatically
func ProvideServiceWrapper ¶
func ProvideServiceWrapper( store publicdashboards.Store, ) *PublicDashboardServiceWrapperImpl
ProvideServiceWrapper Factory for method used by wire to inject dependencies. builds the service, and api, and configures routes
func (*PublicDashboardServiceWrapperImpl) Delete ¶
func (pd *PublicDashboardServiceWrapperImpl) Delete(ctx context.Context, uid string) error
func (*PublicDashboardServiceWrapperImpl) FindByDashboardUid ¶
func (pd *PublicDashboardServiceWrapperImpl) FindByDashboardUid(ctx context.Context, orgId int64, dashboardUid string) (*PublicDashboard, error)
FindByDashboardUid is a helper method to retrieve the public dashboard configuration for a given dashboard from the database