api

package
v0.0.85-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 118 Imported by: 210

Documentation

Overview

Package api contains API logic.

Index

Constants

View Source
const (
	ActionProvisioningReload = "provisioning:reload"

	ActionOrgsRead             = "orgs:read"
	ActionOrgsPreferencesRead  = "orgs.preferences:read"
	ActionOrgsQuotasRead       = "orgs.quotas:read"
	ActionOrgsWrite            = "orgs:write"
	ActionOrgsPreferencesWrite = "orgs.preferences:write"
	ActionOrgsQuotasWrite      = "orgs.quotas:write"
	ActionOrgsDelete           = "orgs:delete"
	ActionOrgsCreate           = "orgs:create"
)

API related actions

View Source
const (
	OauthStateCookieName = "oauth_state"
	OauthPKCECookieName  = "oauth_code_verifier"
)

Variables

View Source
var (
	ScopeProvisionersAll           = ac.Scope("provisioners", "*")
	ScopeProvisionersDashboards    = ac.Scope("provisioners", "dashboards")
	ScopeProvisionersPlugins       = ac.Scope("provisioners", "plugins")
	ScopeProvisionersDatasources   = ac.Scope("provisioners", "datasources")
	ScopeProvisionersNotifications = ac.Scope("provisioners", "notifications")
)

API related scopes

Functions

func AnnotationTypeScopeResolver

func AnnotationTypeScopeResolver() (string, accesscontrol.AttributeScopeResolveFunc)

AnnotationTypeScopeResolver provides an AttributeScopeResolver able to resolve annotation types. Scope "annotations:id:<id>" will be translated to "annotations:type:<type>, where <type> is the type of annotation with id <id>.

func AppPluginRoute

func AppPluginRoute(route *plugins.Route, appID string, hs *HTTPServer) web.Handler

func BasicAuthenticatedRequest

func BasicAuthenticatedRequest(req *http.Request, expectedUser, expectedPass string) bool

BasicAuthenticatedRequest parses the provided HTTP request for basic authentication credentials and returns true if the provided credentials match the expected username and password. Returns false if the request is unauthenticated. Uses constant-time comparison in order to mitigate timing attacks.

func GenStateString

func GenStateString() (string, error)

func GetAuthProviderLabel

func GetAuthProviderLabel(authModule string) string

func GetSharingOptions

func GetSharingOptions(c *models.ReqContext)

func GetSignUpOptions

func GetSignUpOptions(c *models.ReqContext) response.Response

GET /api/user/signup/options

func NewFrontendLogMessageHandler

func NewFrontendLogMessageHandler(store *frontendlogging.SourceMapStore) frontendLogMessageHandler

func ReverseProxyGnetReq

func ReverseProxyGnetReq(logger log.Logger, proxyPath string, version string) *httputil.ReverseProxy

func ValidateAndNormalizeEmail

func ValidateAndNormalizeEmail(email string) (string, error)

Types

type AnnotationError

type AnnotationError struct {
	// contains filtered or unexported fields
}

func (*AnnotationError) Error

func (e *AnnotationError) Error() string

type CreateExternalSnapshotResponse

type CreateExternalSnapshotResponse struct {
	Key       string `json:"key"`
	DeleteKey string `json:"deleteKey"`
	Url       string `json:"url"`
	DeleteUrl string `json:"deleteUrl"`
}

type EnabledPlugins

type EnabledPlugins map[plugins.Type]map[string]plugins.PluginDTO

EnabledPlugins represents a mapping from plugin types (panel, data source, etc.) to plugin IDs to plugins For example ["panel"] -> ["piechart"] -> {pie chart plugin DTO}

func (EnabledPlugins) Get

func (ep EnabledPlugins) Get(pluginType plugins.Type, pluginID string) (plugins.PluginDTO, bool)

type HTTPServer

type HTTPServer struct {
	PluginContextProvider  *plugincontext.Provider
	RouteRegister          routing.RouteRegister
	RenderService          rendering.Service
	Cfg                    *setting.Cfg
	Features               *featuremgmt.FeatureManager
	SettingsProvider       setting.Provider
	HooksService           *hooks.HooksService
	CacheService           *localcache.CacheService
	DataSourceCache        datasources.CacheService
	AuthTokenService       models.UserTokenService
	QuotaService           *quota.QuotaService
	RemoteCacheService     *remotecache.RemoteCache
	ProvisioningService    provisioning.ProvisioningService
	Login                  login.Service
	License                models.Licensing
	AccessControl          accesscontrol.AccessControl
	DataProxy              *datasourceproxy.DataSourceProxyService
	PluginRequestValidator models.PluginRequestValidator

	SearchService         search.Service
	ShortURLService       shorturls.Service
	QueryHistoryService   queryhistory.Service
	Live                  *live.GrafanaLive
	LivePushGateway       *pushhttp.Gateway
	ThumbService          thumbs.Service
	StorageService        store.HTTPStorageService
	ContextHandler        *contexthandler.ContextHandler
	SQLStore              sqlstore.Store
	AlertEngine           *alerting.AlertEngine
	LoadSchemaService     *schemaloader.SchemaLoaderService
	AlertNG               *ngalert.AlertNG
	LibraryPanelService   librarypanels.Service
	LibraryElementService libraryelements.Service
	SocialService         social.Service
	Listener              net.Listener
	EncryptionService     encryption.Internal
	SecretsService        secrets.Service
	DataSourcesService    datasources.DataSourceService

	NotificationService *notifications.NotificationService

	DatasourcePermissionsService permissions.DatasourcePermissionsService

	AlertNotificationService  *alerting.AlertNotificationService
	DashboardsnapshotsService *dashboardsnapshots.Service
	PluginSettings            *pluginSettings.Service
	AvatarCacheServer         *avatar.AvatarCacheServer
	Csrf                      csrf.Service
	// contains filtered or unexported fields
}

func ProvideHTTPServer

func ProvideHTTPServer(opts ServerOptions, cfg *setting.Cfg, routeRegister routing.RouteRegister,
	renderService rendering.Service, licensing models.Licensing, hooksService *hooks.HooksService,
	cacheService *localcache.CacheService, sqlStore *sqlstore.SQLStore, alertEngine *alerting.AlertEngine,
	pluginRequestValidator models.PluginRequestValidator, pluginStaticRouteResolver plugins.StaticRouteResolver,
	pluginDashboardService plugindashboards.Service, pluginStore plugins.Store, pluginClient plugins.Client,
	pluginErrorResolver plugins.ErrorResolver, settingsProvider setting.Provider,
	dataSourceCache datasources.CacheService, userTokenService models.UserTokenService,
	cleanUpService *cleanup.CleanUpService, shortURLService shorturls.Service, queryHistoryService queryhistory.Service,
	thumbService thumbs.Service, remoteCache *remotecache.RemoteCache, provisioningService provisioning.ProvisioningService,
	loginService login.Service, authenticator loginpkg.Authenticator, accessControl accesscontrol.AccessControl,
	dataSourceProxy *datasourceproxy.DataSourceProxyService, searchService *search.SearchService,
	live *live.GrafanaLive, livePushGateway *pushhttp.Gateway, plugCtxProvider *plugincontext.Provider,
	contextHandler *contexthandler.ContextHandler, features *featuremgmt.FeatureManager,
	schemaService *schemaloader.SchemaLoaderService, alertNG *ngalert.AlertNG,
	libraryPanelService librarypanels.Service, libraryElementService libraryelements.Service,
	quotaService *quota.QuotaService, socialService social.Service, tracer tracing.Tracer,
	encryptionService encryption.Internal, grafanaUpdateChecker *updatechecker.GrafanaService,
	pluginsUpdateChecker *updatechecker.PluginsService, searchUsersService searchusers.Service,
	dataSourcesService datasources.DataSourceService, secretsService secrets.Service, queryDataService *query.Service,
	ldapGroups ldap.Groups, teamGuardian teamguardian.TeamGuardian, serviceaccountsService serviceaccounts.Service,
	authInfoService login.AuthInfoService, permissionsServices accesscontrol.PermissionsServices, storageService store.HTTPStorageService,
	notificationService *notifications.NotificationService, dashboardService dashboards.DashboardService,
	dashboardProvisioningService dashboards.DashboardProvisioningService, folderService dashboards.FolderService,
	datasourcePermissionsService permissions.DatasourcePermissionsService, alertNotificationService *alerting.AlertNotificationService,
	dashboardsnapshotsService *dashboardsnapshots.Service, commentsService *comments.Service, pluginSettings *pluginSettings.Service,
	avatarCacheServer *avatar.AvatarCacheServer, csrfService csrf.Service,
) (*HTTPServer, error)

func (*HTTPServer) AddAPIKey

func (hs *HTTPServer) AddAPIKey(c *models.ReqContext) response.Response

AddAPIKey adds an API key

func (*HTTPServer) AddDataSource

func (hs *HTTPServer) AddDataSource(c *models.ReqContext) response.Response

POST /api/datasources/

func (*HTTPServer) AddMiddleware

func (hs *HTTPServer) AddMiddleware(middleware web.Handler)

func (*HTTPServer) AddNamedMiddleware

func (hs *HTTPServer) AddNamedMiddleware(middleware routing.RegisterNamedMiddleware)

func (*HTTPServer) AddOrgInvite

func (hs *HTTPServer) AddOrgInvite(c *models.ReqContext) response.Response

func (*HTTPServer) AddOrgUser

func (hs *HTTPServer) AddOrgUser(c *models.ReqContext) response.Response

POST /api/orgs/:orgId/users

func (*HTTPServer) AddOrgUserToCurrentOrg

func (hs *HTTPServer) AddOrgUserToCurrentOrg(c *models.ReqContext) response.Response

POST /api/org/users

func (*HTTPServer) AddTeamMember

func (hs *HTTPServer) AddTeamMember(c *models.ReqContext) response.Response

POST /api/teams/:teamId/members

func (*HTTPServer) AdminCreateUser

func (hs *HTTPServer) AdminCreateUser(c *models.ReqContext) response.Response

func (*HTTPServer) AdminDeleteUser

func (hs *HTTPServer) AdminDeleteUser(c *models.ReqContext) response.Response

func (*HTTPServer) AdminDisableUser

func (hs *HTTPServer) AdminDisableUser(c *models.ReqContext) response.Response

POST /api/admin/users/:id/disable

func (*HTTPServer) AdminEnableUser

func (hs *HTTPServer) AdminEnableUser(c *models.ReqContext) response.Response

POST /api/admin/users/:id/enable

func (*HTTPServer) AdminGetSettings

func (hs *HTTPServer) AdminGetSettings(c *models.ReqContext) response.Response

func (*HTTPServer) AdminGetStats

func (hs *HTTPServer) AdminGetStats(c *models.ReqContext) response.Response

func (*HTTPServer) AdminGetUserAuthTokens

func (hs *HTTPServer) AdminGetUserAuthTokens(c *models.ReqContext) response.Response

GET /api/admin/users/:id/auth-tokens

func (*HTTPServer) AdminLogoutUser

func (hs *HTTPServer) AdminLogoutUser(c *models.ReqContext) response.Response

POST /api/admin/users/:id/logout

func (*HTTPServer) AdminProvisioningReloadDashboards

func (hs *HTTPServer) AdminProvisioningReloadDashboards(c *models.ReqContext) response.Response

func (*HTTPServer) AdminProvisioningReloadDatasources

func (hs *HTTPServer) AdminProvisioningReloadDatasources(c *models.ReqContext) response.Response

func (*HTTPServer) AdminProvisioningReloadNotifications

func (hs *HTTPServer) AdminProvisioningReloadNotifications(c *models.ReqContext) response.Response

func (*HTTPServer) AdminProvisioningReloadPlugins

func (hs *HTTPServer) AdminProvisioningReloadPlugins(c *models.ReqContext) response.Response

func (*HTTPServer) AdminRevokeUserAuthToken

func (hs *HTTPServer) AdminRevokeUserAuthToken(c *models.ReqContext) response.Response

POST /api/admin/users/:id/revoke-auth-token

func (*HTTPServer) AdminUpdateUserPassword

func (hs *HTTPServer) AdminUpdateUserPassword(c *models.ReqContext) response.Response

func (*HTTPServer) AdminUpdateUserPermissions

func (hs *HTTPServer) AdminUpdateUserPermissions(c *models.ReqContext) response.Response

PUT /api/admin/users/:id/permissions

func (*HTTPServer) AlertTest

func (hs *HTTPServer) AlertTest(c *models.ReqContext) response.Response

POST /api/alerts/test

func (*HTTPServer) CalculateDashboardDiff

func (hs *HTTPServer) CalculateDashboardDiff(c *models.ReqContext) response.Response

POST /api/dashboards/calculate-diff performs diffs on two dashboards

func (*HTTPServer) CallDatasourceResource

func (hs *HTTPServer) CallDatasourceResource(c *models.ReqContext)

/api/datasources/:id/resources/*

func (*HTTPServer) CallResource

func (hs *HTTPServer) CallResource(c *models.ReqContext)

CallResource passes a resource call from a plugin to the backend plugin.

/api/plugins/:pluginId/resources/*

func (*HTTPServer) ChangeActiveOrgAndRedirectToHome

func (hs *HTTPServer) ChangeActiveOrgAndRedirectToHome(c *models.ReqContext)

GET /profile/switch-org/:id

func (*HTTPServer) ChangeUserPassword

func (hs *HTTPServer) ChangeUserPassword(c *models.ReqContext) response.Response

func (*HTTPServer) CheckDatasourceHealth

func (hs *HTTPServer) CheckDatasourceHealth(c *models.ReqContext) response.Response

CheckDatasourceHealth sends a health check request to the plugin datasource /api/datasource/:id/health

func (*HTTPServer) CheckHealth

func (hs *HTTPServer) CheckHealth(c *models.ReqContext) response.Response

CheckHealth returns the health of a plugin. /api/plugins/:pluginId/health

func (*HTTPServer) ClearHelpFlags

func (hs *HTTPServer) ClearHelpFlags(c *models.ReqContext) response.Response

func (*HTTPServer) CollectPluginMetrics

func (hs *HTTPServer) CollectPluginMetrics(c *models.ReqContext) response.Response

CollectPluginMetrics collect metrics from a plugin.

/api/plugins/:pluginId/metrics

func (*HTTPServer) CompleteInvite

func (hs *HTTPServer) CompleteInvite(c *models.ReqContext) response.Response

func (*HTTPServer) CookieOptionsFromCfg

func (hs *HTTPServer) CookieOptionsFromCfg() cookies.CookieOptions

func (*HTTPServer) CreateAlertNotification

func (hs *HTTPServer) CreateAlertNotification(c *models.ReqContext) response.Response

func (*HTTPServer) CreateDashboardSnapshot

func (hs *HTTPServer) CreateDashboardSnapshot(c *models.ReqContext) response.Response

swagger:route POST /snapshots snapshots createDashboardSnapshot

When creating a snapshot using the API, you have to provide the full dashboard payload including the snapshot data. This endpoint is designed for the Grafana UI.

Snapshot public mode should be enabled or authentication is required.

Responses: 200: createDashboardSnapshotResponse 401: unauthorisedError 403: forbiddenError 500: internalServerError

func (*HTTPServer) CreateFolder

func (hs *HTTPServer) CreateFolder(c *models.ReqContext) response.Response

func (*HTTPServer) CreateOrg

func (hs *HTTPServer) CreateOrg(c *models.ReqContext) response.Response

POST /api/orgs

func (*HTTPServer) CreatePlaylist

func (hs *HTTPServer) CreatePlaylist(c *models.ReqContext) response.Response

func (*HTTPServer) CreateTeam

func (hs *HTTPServer) CreateTeam(c *models.ReqContext) response.Response

POST /api/teams

func (*HTTPServer) DeleteAPIKey

func (hs *HTTPServer) DeleteAPIKey(c *models.ReqContext) response.Response

DeleteAPIKey deletes an API key

func (*HTTPServer) DeleteAlertNotification

func (hs *HTTPServer) DeleteAlertNotification(c *models.ReqContext) response.Response

func (*HTTPServer) DeleteAlertNotificationByUID

func (hs *HTTPServer) DeleteAlertNotificationByUID(c *models.ReqContext) response.Response

func (*HTTPServer) DeleteAnnotationByID

func (hs *HTTPServer) DeleteAnnotationByID(c *models.ReqContext) response.Response

func (*HTTPServer) DeleteDashboardByUID

func (hs *HTTPServer) DeleteDashboardByUID(c *models.ReqContext) response.Response

func (*HTTPServer) DeleteDashboardSnapshot

func (hs *HTTPServer) DeleteDashboardSnapshot(c *models.ReqContext) response.Response

DELETE /api/snapshots/:key

func (*HTTPServer) DeleteDashboardSnapshotByDeleteKey

func (hs *HTTPServer) DeleteDashboardSnapshotByDeleteKey(c *models.ReqContext) response.Response

GET /api/snapshots-delete/:deleteKey

func (*HTTPServer) DeleteDataSourceById

func (hs *HTTPServer) DeleteDataSourceById(c *models.ReqContext) response.Response

DELETE /api/datasources/:id

func (*HTTPServer) DeleteDataSourceByName

func (hs *HTTPServer) DeleteDataSourceByName(c *models.ReqContext) response.Response

DELETE /api/datasources/name/:name

func (*HTTPServer) DeleteDataSourceByUID

func (hs *HTTPServer) DeleteDataSourceByUID(c *models.ReqContext) response.Response

DELETE /api/datasources/uid/:uid

func (*HTTPServer) DeleteFolder

func (hs *HTTPServer) DeleteFolder(c *models.ReqContext) response.Response

func (*HTTPServer) DeleteOrgByID

func (hs *HTTPServer) DeleteOrgByID(c *models.ReqContext) response.Response

DELETE /api/orgs/:orgId

func (*HTTPServer) DeletePlaylist

func (hs *HTTPServer) DeletePlaylist(c *models.ReqContext) response.Response

func (*HTTPServer) DeleteTeamByID

func (hs *HTTPServer) DeleteTeamByID(c *models.ReqContext) response.Response

DELETE /api/teams/:teamId

func (*HTTPServer) GetAPIKeys

func (hs *HTTPServer) GetAPIKeys(c *models.ReqContext) response.Response

GetAPIKeys returns a list of API keys

func (*HTTPServer) GetAlert

func (hs *HTTPServer) GetAlert(c *models.ReqContext) response.Response

GET /api/alerts/:id

func (*HTTPServer) GetAlertNotificationByID

func (hs *HTTPServer) GetAlertNotificationByID(c *models.ReqContext) response.Response

func (*HTTPServer) GetAlertNotificationByUID

func (hs *HTTPServer) GetAlertNotificationByUID(c *models.ReqContext) response.Response

func (*HTTPServer) GetAlertNotificationLookup

func (hs *HTTPServer) GetAlertNotificationLookup(c *models.ReqContext) response.Response

func (*HTTPServer) GetAlertNotifications

func (hs *HTTPServer) GetAlertNotifications(c *models.ReqContext) response.Response

func (*HTTPServer) GetAlertNotifiers

func (hs *HTTPServer) GetAlertNotifiers(ngalertEnabled bool) func(*models.ReqContext) response.Response

func (*HTTPServer) GetAlertStatesForDashboard

func (hs *HTTPServer) GetAlertStatesForDashboard(c *models.ReqContext) response.Response

func (*HTTPServer) GetAlerts

func (hs *HTTPServer) GetAlerts(c *models.ReqContext) response.Response

GET /api/alerts

func (*HTTPServer) GetAnnotationTags

func (hs *HTTPServer) GetAnnotationTags(c *models.ReqContext) response.Response

func (*HTTPServer) GetAnnotations

func (hs *HTTPServer) GetAnnotations(c *models.ReqContext) response.Response

func (*HTTPServer) GetCurrentOrg

func (hs *HTTPServer) GetCurrentOrg(c *models.ReqContext) response.Response

GET /api/org

func (*HTTPServer) GetCurrentOrgQuotas

func (hs *HTTPServer) GetCurrentOrgQuotas(c *models.ReqContext) response.Response

func (*HTTPServer) GetDashboard

func (hs *HTTPServer) GetDashboard(c *models.ReqContext) response.Response

func (*HTTPServer) GetDashboardPermissionList

func (hs *HTTPServer) GetDashboardPermissionList(c *models.ReqContext) response.Response

func (*HTTPServer) GetDashboardSnapshot

func (hs *HTTPServer) GetDashboardSnapshot(c *models.ReqContext) response.Response

GET /api/snapshots/:key

func (*HTTPServer) GetDashboardTags

func (hs *HTTPServer) GetDashboardTags(c *models.ReqContext)

func (*HTTPServer) GetDashboardVersion

func (hs *HTTPServer) GetDashboardVersion(c *models.ReqContext) response.Response

GetDashboardVersion returns the dashboard version with the given ID.

func (*HTTPServer) GetDashboardVersions

func (hs *HTTPServer) GetDashboardVersions(c *models.ReqContext) response.Response

GetDashboardVersions returns all dashboard versions as JSON

func (*HTTPServer) GetDataSourceById

func (hs *HTTPServer) GetDataSourceById(c *models.ReqContext) response.Response

GET /api/datasources/:id

func (*HTTPServer) GetDataSourceByName

func (hs *HTTPServer) GetDataSourceByName(c *models.ReqContext) response.Response

Get /api/datasources/name/:name

func (*HTTPServer) GetDataSourceByUID

func (hs *HTTPServer) GetDataSourceByUID(c *models.ReqContext) response.Response

GET /api/datasources/uid/:uid

func (*HTTPServer) GetDataSourceIdByName

func (hs *HTTPServer) GetDataSourceIdByName(c *models.ReqContext) response.Response

Get /api/datasources/id/:name

func (*HTTPServer) GetDataSources

func (hs *HTTPServer) GetDataSources(c *models.ReqContext) response.Response

func (*HTTPServer) GetFolderByID

func (hs *HTTPServer) GetFolderByID(c *models.ReqContext) response.Response

func (*HTTPServer) GetFolderByUID

func (hs *HTTPServer) GetFolderByUID(c *models.ReqContext) response.Response

func (*HTTPServer) GetFolderPermissionList

func (hs *HTTPServer) GetFolderPermissionList(c *models.ReqContext) response.Response

func (*HTTPServer) GetFolders

func (hs *HTTPServer) GetFolders(c *models.ReqContext) response.Response

func (*HTTPServer) GetFrontendSettings

func (hs *HTTPServer) GetFrontendSettings(c *models.ReqContext)

func (*HTTPServer) GetHomeDashboard

func (hs *HTTPServer) GetHomeDashboard(c *models.ReqContext) response.Response

GetHomeDashboard returns the home dashboard.

func (*HTTPServer) GetInviteInfoByCode

func (hs *HTTPServer) GetInviteInfoByCode(c *models.ReqContext) response.Response

GetInviteInfoByCode gets a pending user invite corresponding to a certain code. A response containing an InviteInfo object is returned if the invite is found. If a (pending) invite is not found, 404 is returned.

func (*HTTPServer) GetLDAPStatus

func (hs *HTTPServer) GetLDAPStatus(c *models.ReqContext) response.Response

GetLDAPStatus attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not.

func (*HTTPServer) GetOrgByID

func (hs *HTTPServer) GetOrgByID(c *models.ReqContext) response.Response

GET /api/orgs/:orgId

func (*HTTPServer) GetOrgByName

func (hs *HTTPServer) GetOrgByName(c *models.ReqContext) response.Response

GET /api/orgs/name/:name

func (*HTTPServer) GetOrgPreferences

func (hs *HTTPServer) GetOrgPreferences(c *models.ReqContext) response.Response

GET /api/org/preferences

func (*HTTPServer) GetOrgQuotas

func (hs *HTTPServer) GetOrgQuotas(c *models.ReqContext) response.Response

func (*HTTPServer) GetOrgUsers

func (hs *HTTPServer) GetOrgUsers(c *models.ReqContext) response.Response

GET /api/orgs/:orgId/users

func (*HTTPServer) GetOrgUsersForCurrentOrg

func (hs *HTTPServer) GetOrgUsersForCurrentOrg(c *models.ReqContext) response.Response

GET /api/org/users

func (*HTTPServer) GetOrgUsersForCurrentOrgLookup

func (hs *HTTPServer) GetOrgUsersForCurrentOrgLookup(c *models.ReqContext) response.Response

GET /api/org/users/lookup

func (*HTTPServer) GetPendingOrgInvites

func (hs *HTTPServer) GetPendingOrgInvites(c *models.ReqContext) response.Response

func (*HTTPServer) GetPlaylist

func (hs *HTTPServer) GetPlaylist(c *models.ReqContext) response.Response

func (*HTTPServer) GetPlaylistDashboards

func (hs *HTTPServer) GetPlaylistDashboards(c *models.ReqContext) response.Response

func (*HTTPServer) GetPlaylistItems

func (hs *HTTPServer) GetPlaylistItems(c *models.ReqContext) response.Response

func (*HTTPServer) GetPluginDashboards

func (hs *HTTPServer) GetPluginDashboards(c *models.ReqContext) response.Response

GetPluginDashboards get plugin dashboards.

/api/plugins/:pluginId/dashboards

func (*HTTPServer) GetPluginErrorsList

func (hs *HTTPServer) GetPluginErrorsList(_ *models.ReqContext) response.Response

func (*HTTPServer) GetPluginList

func (hs *HTTPServer) GetPluginList(c *models.ReqContext) response.Response

func (*HTTPServer) GetPluginMarkdown

func (hs *HTTPServer) GetPluginMarkdown(c *models.ReqContext) response.Response

func (*HTTPServer) GetPluginSettingByID

func (hs *HTTPServer) GetPluginSettingByID(c *models.ReqContext) response.Response

func (*HTTPServer) GetSignedInUser

func (hs *HTTPServer) GetSignedInUser(c *models.ReqContext) response.Response

GET /api/user (current authenticated user)

func (*HTTPServer) GetSignedInUserOrgList

func (hs *HTTPServer) GetSignedInUserOrgList(c *models.ReqContext) response.Response

GET /api/user/orgs

func (*HTTPServer) GetSignedInUserTeamList

func (hs *HTTPServer) GetSignedInUserTeamList(c *models.ReqContext) response.Response

GET /api/user/teams

func (*HTTPServer) GetTeamByID

func (hs *HTTPServer) GetTeamByID(c *models.ReqContext) response.Response

GET /api/teams/:teamId

func (*HTTPServer) GetTeamMembers

func (hs *HTTPServer) GetTeamMembers(c *models.ReqContext) response.Response

GET /api/teams/:teamId/members

func (*HTTPServer) GetTeamPreferences

func (hs *HTTPServer) GetTeamPreferences(c *models.ReqContext) response.Response

GET /api/teams/:teamId/preferences

func (*HTTPServer) GetUserAuthTokens

func (hs *HTTPServer) GetUserAuthTokens(c *models.ReqContext) response.Response

GET /api/user/auth-tokens

func (*HTTPServer) GetUserByID

func (hs *HTTPServer) GetUserByID(c *models.ReqContext) response.Response

GET /api/users/:id

func (*HTTPServer) GetUserByLoginOrEmail

func (hs *HTTPServer) GetUserByLoginOrEmail(c *models.ReqContext) response.Response

GET /api/users/lookup

func (*HTTPServer) GetUserFromLDAP

func (hs *HTTPServer) GetUserFromLDAP(c *models.ReqContext) response.Response

GetUserFromLDAP finds an user based on a username in LDAP. This helps illustrate how would the particular user be mapped in Grafana when synced.

func (*HTTPServer) GetUserOrgList

func (hs *HTTPServer) GetUserOrgList(c *models.ReqContext) response.Response

GET /api/users/:id/orgs

func (*HTTPServer) GetUserPreferences

func (hs *HTTPServer) GetUserPreferences(c *models.ReqContext) response.Response

GET /api/user/preferences

func (*HTTPServer) GetUserQuotas

func (hs *HTTPServer) GetUserQuotas(c *models.ReqContext) response.Response

func (*HTTPServer) GetUserTeams

func (hs *HTTPServer) GetUserTeams(c *models.ReqContext) response.Response

GET /api/users/:id/teams

func (*HTTPServer) Index

func (hs *HTTPServer) Index(c *models.ReqContext)

func (*HTTPServer) InstallPlugin

func (hs *HTTPServer) InstallPlugin(c *models.ReqContext) response.Response

func (*HTTPServer) ListSortOptions

func (hs *HTTPServer) ListSortOptions(c *models.ReqContext) response.Response

func (*HTTPServer) LoadPlaylistDashboards

func (hs *HTTPServer) LoadPlaylistDashboards(ctx context.Context, orgID int64, signedInUser *models.SignedInUser, playlistID int64) (dtos.PlaylistDashboardsSlice, error)

func (*HTTPServer) LoadPlaylistItemDTOs

func (hs *HTTPServer) LoadPlaylistItemDTOs(ctx context.Context, id int64) ([]models.PlaylistItemDTO, error)

func (*HTTPServer) LoadPlaylistItems

func (hs *HTTPServer) LoadPlaylistItems(ctx context.Context, id int64) ([]models.PlaylistItem, error)

func (*HTTPServer) LoginAPIPing

func (hs *HTTPServer) LoginAPIPing(c *models.ReqContext) response.Response

func (*HTTPServer) LoginPost

func (hs *HTTPServer) LoginPost(c *models.ReqContext) response.Response

func (*HTTPServer) LoginView

func (hs *HTTPServer) LoginView(c *models.ReqContext)

func (*HTTPServer) Logout

func (hs *HTTPServer) Logout(c *models.ReqContext)

func (*HTTPServer) MassDeleteAnnotations

func (hs *HTTPServer) MassDeleteAnnotations(c *models.ReqContext) response.Response

func (*HTTPServer) NotFoundHandler

func (hs *HTTPServer) NotFoundHandler(c *models.ReqContext)

func (*HTTPServer) NotificationTest

func (hs *HTTPServer) NotificationTest(c *models.ReqContext) response.Response

POST /api/alert-notifications/test

func (*HTTPServer) OAuthLogin

func (hs *HTTPServer) OAuthLogin(ctx *models.ReqContext) response.Response

func (*HTTPServer) PatchAnnotation

func (hs *HTTPServer) PatchAnnotation(c *models.ReqContext) response.Response

func (*HTTPServer) PatchOrgPreferences

func (hs *HTTPServer) PatchOrgPreferences(c *models.ReqContext) response.Response

PATCH /api/org/preferences

func (*HTTPServer) PatchUserPreferences

func (hs *HTTPServer) PatchUserPreferences(c *models.ReqContext) response.Response

PATCH /api/user/preferences

func (*HTTPServer) PauseAlert

func (hs *HTTPServer) PauseAlert(c *models.ReqContext) response.Response

POST /api/alerts/:alertId/pause

func (*HTTPServer) PauseAllAlerts

func (hs *HTTPServer) PauseAllAlerts(c *models.ReqContext) response.Response

POST /api/admin/pause-all-alerts

func (*HTTPServer) PostAnnotation

func (hs *HTTPServer) PostAnnotation(c *models.ReqContext) response.Response

func (*HTTPServer) PostDashboard

func (hs *HTTPServer) PostDashboard(c *models.ReqContext) response.Response

func (*HTTPServer) PostFrontendMetrics

func (hs *HTTPServer) PostFrontendMetrics(c *models.ReqContext) response.Response

func (*HTTPServer) PostGraphiteAnnotation

func (hs *HTTPServer) PostGraphiteAnnotation(c *models.ReqContext) response.Response

func (*HTTPServer) PostSyncUserWithLDAP

func (hs *HTTPServer) PostSyncUserWithLDAP(c *models.ReqContext) response.Response

PostSyncUserWithLDAP enables a single Grafana user to be synchronized against LDAP

func (*HTTPServer) ProxyDataSourceRequest

func (hs *HTTPServer) ProxyDataSourceRequest(c *models.ReqContext)

func (*HTTPServer) ProxyGnetRequest

func (hs *HTTPServer) ProxyGnetRequest(c *models.ReqContext)

func (*HTTPServer) QueryMetrics

func (hs *HTTPServer) QueryMetrics(c *models.ReqContext) response.Response

QueryMetrics returns query metrics POST /api/tsdb/query nolint: staticcheck // legacydata.DataResponse deprecated nolint: staticcheck // legacydata.DataQueryResult deprecated Deprecated: use QueryMetricsV2 instead.

func (*HTTPServer) QueryMetricsFromDashboard

func (hs *HTTPServer) QueryMetricsFromDashboard(c *models.ReqContext) response.Response

QueryMetricsFromDashboard returns query metrics. POST /dashboards/org/:orgId/uid/:dashboardUid/panels/:panelId/query DataSource query w/ expressions

func (*HTTPServer) QueryMetricsV2

func (hs *HTTPServer) QueryMetricsV2(c *models.ReqContext) response.Response

QueryMetricsV2 returns query metrics. POST /api/ds/query DataSource query w/ expressions

func (*HTTPServer) RedirectResponseWithError

func (hs *HTTPServer) RedirectResponseWithError(ctx *models.ReqContext, err error, v ...interface{}) *response.RedirectResponse

func (*HTTPServer) ReloadLDAPCfg

func (hs *HTTPServer) ReloadLDAPCfg(c *models.ReqContext) response.Response

ReloadLDAPCfg reloads the LDAP configuration

func (*HTTPServer) RemoveOrgUser

func (hs *HTTPServer) RemoveOrgUser(c *models.ReqContext) response.Response

DELETE /api/orgs/:orgId/users/:userId

func (*HTTPServer) RemoveOrgUserForCurrentOrg

func (hs *HTTPServer) RemoveOrgUserForCurrentOrg(c *models.ReqContext) response.Response

DELETE /api/org/users/:userId

func (*HTTPServer) RemoveTeamMember

func (hs *HTTPServer) RemoveTeamMember(c *models.ReqContext) response.Response

DELETE /api/teams/:teamId/members/:userId

func (*HTTPServer) RenderToPng

func (hs *HTTPServer) RenderToPng(c *models.ReqContext)

func (*HTTPServer) ReqCanAdminTeams

func (hs *HTTPServer) ReqCanAdminTeams(c *models.ReqContext) bool

func (*HTTPServer) ResetPassword

func (hs *HTTPServer) ResetPassword(c *models.ReqContext) response.Response

func (*HTTPServer) RestoreDashboardVersion

func (hs *HTTPServer) RestoreDashboardVersion(c *models.ReqContext) response.Response

RestoreDashboardVersion restores a dashboard to the given version.

func (*HTTPServer) RevokeInvite

func (hs *HTTPServer) RevokeInvite(c *models.ReqContext) response.Response

func (*HTTPServer) RevokeUserAuthToken

func (hs *HTTPServer) RevokeUserAuthToken(c *models.ReqContext) response.Response

POST /api/user/revoke-auth-token

func (*HTTPServer) Run

func (hs *HTTPServer) Run(ctx context.Context) error

func (*HTTPServer) Search

func (hs *HTTPServer) Search(c *models.ReqContext) response.Response

func (*HTTPServer) SearchDashboardSnapshots

func (hs *HTTPServer) SearchDashboardSnapshots(c *models.ReqContext) response.Response

GET /api/dashboard/snapshots

func (*HTTPServer) SearchOrgUsersWithPaging

func (hs *HTTPServer) SearchOrgUsersWithPaging(c *models.ReqContext) response.Response

SearchOrgUsersWithPaging is an HTTP handler to search for org users with paging. GET /api/org/users/search

func (*HTTPServer) SearchOrgs

func (hs *HTTPServer) SearchOrgs(c *models.ReqContext) response.Response

func (*HTTPServer) SearchPlaylists

func (hs *HTTPServer) SearchPlaylists(c *models.ReqContext) response.Response

func (*HTTPServer) SearchTeams

func (hs *HTTPServer) SearchTeams(c *models.ReqContext) response.Response

GET /api/teams/search

func (*HTTPServer) SendResetPasswordEmail

func (hs *HTTPServer) SendResetPasswordEmail(c *models.ReqContext) response.Response

func (*HTTPServer) SetHelpFlag

func (hs *HTTPServer) SetHelpFlag(c *models.ReqContext) response.Response

func (*HTTPServer) SetHomeDashboard

func (hs *HTTPServer) SetHomeDashboard(c *models.ReqContext) response.Response

POST /api/preferences/set-home-dash

func (*HTTPServer) SignUp

func (hs *HTTPServer) SignUp(c *models.ReqContext) response.Response

POST /api/user/signup

func (*HTTPServer) SignUpStep2

func (hs *HTTPServer) SignUpStep2(c *models.ReqContext) response.Response

func (*HTTPServer) StarDashboard

func (hs *HTTPServer) StarDashboard(c *models.ReqContext) response.Response

func (*HTTPServer) SyncUser

func (hs *HTTPServer) SyncUser(
	ctx *models.ReqContext,
	extUser *models.ExternalUserInfo,
	connect social.SocialConnector,
) (*models.User, error)

SyncUser syncs a Grafana user profile with the corresponding OAuth profile.

func (*HTTPServer) TrimDashboard

func (hs *HTTPServer) TrimDashboard(c *models.ReqContext) response.Response

func (*HTTPServer) UninstallPlugin

func (hs *HTTPServer) UninstallPlugin(c *models.ReqContext) response.Response

func (*HTTPServer) UnstarDashboard

func (hs *HTTPServer) UnstarDashboard(c *models.ReqContext) response.Response

func (*HTTPServer) UpdateAlertNotification

func (hs *HTTPServer) UpdateAlertNotification(c *models.ReqContext) response.Response

func (*HTTPServer) UpdateAlertNotificationByUID

func (hs *HTTPServer) UpdateAlertNotificationByUID(c *models.ReqContext) response.Response

func (*HTTPServer) UpdateAnnotation

func (hs *HTTPServer) UpdateAnnotation(c *models.ReqContext) response.Response

func (*HTTPServer) UpdateCurrentOrg

func (hs *HTTPServer) UpdateCurrentOrg(c *models.ReqContext) response.Response

PUT /api/org

func (*HTTPServer) UpdateCurrentOrgAddress

func (hs *HTTPServer) UpdateCurrentOrgAddress(c *models.ReqContext) response.Response

PUT /api/org/address

func (*HTTPServer) UpdateDashboardPermissions

func (hs *HTTPServer) UpdateDashboardPermissions(c *models.ReqContext) response.Response

func (*HTTPServer) UpdateDataSource

func (hs *HTTPServer) UpdateDataSource(c *models.ReqContext) response.Response

PUT /api/datasources/:id

func (*HTTPServer) UpdateFolder

func (hs *HTTPServer) UpdateFolder(c *models.ReqContext) response.Response

func (*HTTPServer) UpdateFolderPermissions

func (hs *HTTPServer) UpdateFolderPermissions(c *models.ReqContext) response.Response

func (*HTTPServer) UpdateOrg

func (hs *HTTPServer) UpdateOrg(c *models.ReqContext) response.Response

PUT /api/orgs/:orgId

func (*HTTPServer) UpdateOrgAddress

func (hs *HTTPServer) UpdateOrgAddress(c *models.ReqContext) response.Response

PUT /api/orgs/:orgId/address

func (*HTTPServer) UpdateOrgPreferences

func (hs *HTTPServer) UpdateOrgPreferences(c *models.ReqContext) response.Response

PUT /api/org/preferences

func (*HTTPServer) UpdateOrgQuota

func (hs *HTTPServer) UpdateOrgQuota(c *models.ReqContext) response.Response

func (*HTTPServer) UpdateOrgUser

func (hs *HTTPServer) UpdateOrgUser(c *models.ReqContext) response.Response

PATCH /api/orgs/:orgId/users/:userId

func (*HTTPServer) UpdateOrgUserForCurrentOrg

func (hs *HTTPServer) UpdateOrgUserForCurrentOrg(c *models.ReqContext) response.Response

PATCH /api/org/users/:userId

func (*HTTPServer) UpdatePlaylist

func (hs *HTTPServer) UpdatePlaylist(c *models.ReqContext) response.Response

func (*HTTPServer) UpdatePluginSetting

func (hs *HTTPServer) UpdatePluginSetting(c *models.ReqContext) response.Response

func (*HTTPServer) UpdateSignedInUser

func (hs *HTTPServer) UpdateSignedInUser(c *models.ReqContext) response.Response

POST /api/user

func (*HTTPServer) UpdateTeam

func (hs *HTTPServer) UpdateTeam(c *models.ReqContext) response.Response

PUT /api/teams/:teamId

func (*HTTPServer) UpdateTeamMember

func (hs *HTTPServer) UpdateTeamMember(c *models.ReqContext) response.Response

PUT /:teamId/members/:userId

func (*HTTPServer) UpdateTeamPreferences

func (hs *HTTPServer) UpdateTeamPreferences(c *models.ReqContext) response.Response

PUT /api/teams/:teamId/preferences

func (*HTTPServer) UpdateUser

func (hs *HTTPServer) UpdateUser(c *models.ReqContext) response.Response

POST /api/users/:id

func (*HTTPServer) UpdateUserActiveOrg

func (hs *HTTPServer) UpdateUserActiveOrg(c *models.ReqContext) response.Response

POST /api/users/:id/using/:orgId

func (*HTTPServer) UpdateUserPreferences

func (hs *HTTPServer) UpdateUserPreferences(c *models.ReqContext) response.Response

PUT /api/user/preferences

func (*HTTPServer) UpdateUserQuota

func (hs *HTTPServer) UpdateUserQuota(c *models.ReqContext) response.Response

func (*HTTPServer) UserSetUsingOrg

func (hs *HTTPServer) UserSetUsingOrg(c *models.ReqContext) response.Response

POST /api/user/using/:id

func (*HTTPServer) ValidateOrgAlert

func (hs *HTTPServer) ValidateOrgAlert(c *models.ReqContext)

func (*HTTPServer) ValidateOrgPlaylist

func (hs *HTTPServer) ValidateOrgPlaylist(c *models.ReqContext)

func (*HTTPServer) ValidateRedirectTo

func (hs *HTTPServer) ValidateRedirectTo(redirectTo string) error

type LDAPAttribute

type LDAPAttribute struct {
	ConfigAttributeValue string `json:"cfgAttrValue"`
	LDAPAttributeValue   string `json:"ldapValue"`
}

LDAPAttribute is a serializer for user attributes mapped from LDAP. Is meant to display both the serialized value and the LDAP key we received it from.

type LDAPRoleDTO

type LDAPRoleDTO struct {
	OrgId   int64           `json:"orgId"`
	OrgName string          `json:"orgName"`
	OrgRole models.RoleType `json:"orgRole"`
	GroupDN string          `json:"groupDN"`
}

RoleDTO is a serializer for mapped roles from LDAP

type LDAPServerDTO

type LDAPServerDTO struct {
	Host      string `json:"host"`
	Port      int    `json:"port"`
	Available bool   `json:"available"`
	Error     string `json:"error"`
}

LDAPServerDTO is a serializer for LDAP server statuses

type LDAPUserDTO

type LDAPUserDTO struct {
	Name           *LDAPAttribute           `json:"name"`
	Surname        *LDAPAttribute           `json:"surname"`
	Email          *LDAPAttribute           `json:"email"`
	Username       *LDAPAttribute           `json:"login"`
	IsGrafanaAdmin *bool                    `json:"isGrafanaAdmin"`
	IsDisabled     bool                     `json:"isDisabled"`
	OrgRoles       []LDAPRoleDTO            `json:"roles"`
	Teams          []models.TeamOrgGroupDTO `json:"teams"`
}

LDAPUserDTO is a serializer for users mapped from LDAP

func (*LDAPUserDTO) FetchOrgs

func (user *LDAPUserDTO) FetchOrgs(ctx context.Context, sqlstore sqlstore.Store) error

FetchOrgs fetches the organization(s) information by executing a single query to the database. Then, populating the DTO with the information retrieved.

type LoginError

type LoginError struct {
	HttpStatus    int
	PublicMessage string
	Err           error
}

type ServerOptions

type ServerOptions struct {
	Listener net.Listener
}

Directories

Path Synopsis
docs
definitions
Package api Grafana HTTP API.
Package api Grafana HTTP API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL