api

package
v1.9.2-0...-7c1864d Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderNameNoBackendCache = "X-Grafana-NoCache"
View Source
const (
	VIEW_INDEX = "index"
)

Variables

View Source
var (
	NotFound = func() Response {
		return ApiError(404, "Not found", nil)
	}
	ServerError = func(err error) Response {
		return ApiError(500, "Server error", err)
	}
)
View Source
var (
	ErrProviderDeniedRequest = errors.New("Login provider denied login request")
	ErrEmailNotAllowed       = errors.New("Required email domain not fulfilled")
	ErrSignUpNotAllowed      = errors.New("Signup is not allowed for this adapter")
	ErrUsersQuotaReached     = errors.New("Users quota reached")
	ErrNoEmail               = errors.New("Login provider didn't return an email address")
)

Functions

func AdminCreateUser

func AdminCreateUser(c *m.ReqContext, form dtos.AdminCreateUserForm)

func AdminDeleteUser

func AdminDeleteUser(c *m.ReqContext)

func AdminGetSettings

func AdminGetSettings(c *m.ReqContext)

func AdminGetStats

func AdminGetStats(c *m.ReqContext)

func AdminUpdateUserPassword

func AdminUpdateUserPassword(c *m.ReqContext, form dtos.AdminUpdateUserPasswordForm)

func AdminUpdateUserPermissions

func AdminUpdateUserPermissions(c *m.ReqContext, form dtos.AdminUpdateUserPermissionsForm)

func AppPluginRoute

func AppPluginRoute(route *plugins.AppPluginRoute, appId string) macaron.Handler

func ChangeActiveOrgAndRedirectToHome

func ChangeActiveOrgAndRedirectToHome(c *m.ReqContext)

GET /profile/switch-org/:id

func CreateDashboardSnapshot

func CreateDashboardSnapshot(c *m.ReqContext, cmd m.CreateDashboardSnapshotCommand)

func GenStateString

func GenStateString() string

func GetDashboardSnapshot

func GetDashboardSnapshot(c *m.ReqContext)

GET /api/snapshots/:key

func GetDashboardTags

func GetDashboardTags(c *m.ReqContext)

func GetFrontendSettings

func GetFrontendSettings(c *m.ReqContext)

func GetSharingOptions

func GetSharingOptions(c *m.ReqContext)

func Index

func Index(c *m.ReqContext)

func InitAppPluginRoutes

func InitAppPluginRoutes(r *macaron.Macaron)

func LoadPlaylistDashboards

func LoadPlaylistDashboards(orgId int64, signedInUser *m.SignedInUser, playlistId int64) (dtos.PlaylistDashboardsSlice, error)

func LoadPlaylistItemDTOs

func LoadPlaylistItemDTOs(id int64) ([]m.PlaylistItemDTO, error)

func LoadPlaylistItems

func LoadPlaylistItems(id int64) ([]m.PlaylistItem, error)

func LoginApiPing

func LoginApiPing(c *m.ReqContext)

func LoginView

func LoginView(c *m.ReqContext)

func Logout

func Logout(c *m.ReqContext)

func NotFoundHandler

func NotFoundHandler(c *m.ReqContext)

func OAuthLogin

func OAuthLogin(ctx *m.ReqContext)

func ProxyGnetRequest

func ProxyGnetRequest(c *m.ReqContext)

func RenderToPng

func RenderToPng(c *m.ReqContext)

func ReverseProxyGnetReq

func ReverseProxyGnetReq(proxyPath string) *httputil.ReverseProxy
func Search(c *m.ReqContext)

func ValidateOrgAlert

func ValidateOrgAlert(c *m.ReqContext)

func ValidateOrgPlaylist

func ValidateOrgPlaylist(c *m.ReqContext)

Types

type CreateAnnotationError

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

func (*CreateAnnotationError) Error

func (e *CreateAnnotationError) Error() string

type HttpServer

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

func NewHttpServer

func NewHttpServer() *HttpServer

func (*HttpServer) ProxyDataSourceRequest

func (hs *HttpServer) ProxyDataSourceRequest(c *m.ReqContext)

func (*HttpServer) Shutdown

func (hs *HttpServer) Shutdown(ctx context.Context) error

func (*HttpServer) Start

func (hs *HttpServer) Start(ctx context.Context) error

type NormalResponse

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

func ApiError

func ApiError(status int, message string, err error) *NormalResponse

func ApiSuccess

func ApiSuccess(message string) *NormalResponse

func Empty

func Empty(status int) *NormalResponse

functions to create responses

func Json

func Json(status int, body interface{}) *NormalResponse

func Respond

func Respond(status int, body interface{}) *NormalResponse

func (*NormalResponse) Cache

func (r *NormalResponse) Cache(ttl string) *NormalResponse

func (*NormalResponse) Header

func (r *NormalResponse) Header(key, value string) *NormalResponse

func (*NormalResponse) WriteTo

func (r *NormalResponse) WriteTo(ctx *m.ReqContext)

type RegisterNamedMiddleware

type RegisterNamedMiddleware func(name string) macaron.Handler

type Response

type Response interface {
	WriteTo(ctx *m.ReqContext)
}

func AddApiKey

func AddApiKey(c *m.ReqContext, cmd m.AddApiKeyCommand) Response

func AddDataSource

func AddDataSource(c *m.ReqContext, cmd m.AddDataSourceCommand) Response

func AddOrgInvite

func AddOrgInvite(c *m.ReqContext, inviteDto dtos.AddInviteForm) Response

func AddOrgUser

func AddOrgUser(c *m.ReqContext, cmd m.AddOrgUserCommand) Response

POST /api/orgs/:orgId/users

func AddOrgUserToCurrentOrg

func AddOrgUserToCurrentOrg(c *m.ReqContext, cmd m.AddOrgUserCommand) Response

POST /api/org/users

func AddTeamMember

func AddTeamMember(c *m.ReqContext, cmd m.AddTeamMemberCommand) Response

POST /api/teams/:teamId/members

func AlertTest

func AlertTest(c *m.ReqContext, dto dtos.AlertTestCommand) Response

POST /api/alerts/test

func CalculateDashboardDiff

func CalculateDashboardDiff(c *m.ReqContext, apiOptions dtos.CalculateDiffOptions) Response

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

func ChangeUserPassword

func ChangeUserPassword(c *m.ReqContext, cmd m.ChangeUserPasswordCommand) Response

func ClearHelpFlags

func ClearHelpFlags(c *m.ReqContext) Response

func CompleteInvite

func CompleteInvite(c *m.ReqContext, completeInvite dtos.CompleteInviteForm) Response

func CreateAlertNotification

func CreateAlertNotification(c *m.ReqContext, cmd m.CreateAlertNotificationCommand) Response

func CreateFolder

func CreateFolder(c *m.ReqContext, cmd m.CreateFolderCommand) Response

func CreateOrg

func CreateOrg(c *m.ReqContext, cmd m.CreateOrgCommand) Response

POST /api/orgs

func CreatePlaylist

func CreatePlaylist(c *m.ReqContext, cmd m.CreatePlaylistCommand) Response

func CreateTeam

func CreateTeam(c *m.ReqContext, cmd m.CreateTeamCommand) Response

POST /api/teams

func DeleteAlertNotification

func DeleteAlertNotification(c *m.ReqContext) Response

func DeleteAnnotationById

func DeleteAnnotationById(c *m.ReqContext) Response

func DeleteAnnotationRegion

func DeleteAnnotationRegion(c *m.ReqContext) Response

func DeleteAnnotations

func DeleteAnnotations(c *m.ReqContext, cmd dtos.DeleteAnnotationsCmd) Response

func DeleteApiKey

func DeleteApiKey(c *m.ReqContext) Response

func DeleteDashboard

func DeleteDashboard(c *m.ReqContext) Response

func DeleteDashboardByUid

func DeleteDashboardByUid(c *m.ReqContext) Response

func DeleteDashboardSnapshot

func DeleteDashboardSnapshot(c *m.ReqContext) Response

GET /api/snapshots-delete/:key

func DeleteDataSourceById

func DeleteDataSourceById(c *m.ReqContext) Response

func DeleteDataSourceByName

func DeleteDataSourceByName(c *m.ReqContext) Response

func DeleteFolder

func DeleteFolder(c *m.ReqContext) Response

func DeleteOrgById

func DeleteOrgById(c *m.ReqContext) Response

GET /api/orgs/:orgId

func DeletePlaylist

func DeletePlaylist(c *m.ReqContext) Response

func DeleteTeamById

func DeleteTeamById(c *m.ReqContext) Response

DELETE /api/teams/:teamId

func GenerateError

func GenerateError(c *m.ReqContext) Response

Genereates a index out of range error

func GenerateSqlTestData

func GenerateSqlTestData(c *m.ReqContext) Response

GET /api/tsdb/testdata/gensql

func GetAlert

func GetAlert(c *m.ReqContext) Response

GET /api/alerts/:id

func GetAlertNotificationById

func GetAlertNotificationById(c *m.ReqContext) Response

func GetAlertNotifications

func GetAlertNotifications(c *m.ReqContext) Response

func GetAlertNotifiers

func GetAlertNotifiers(c *m.ReqContext) Response

func GetAlertStatesForDashboard

func GetAlertStatesForDashboard(c *m.ReqContext) Response

func GetAlerts

func GetAlerts(c *m.ReqContext) Response

GET /api/alerts

func GetAnnotations

func GetAnnotations(c *m.ReqContext) Response

func GetApiKeys

func GetApiKeys(c *m.ReqContext) Response

func GetDashboard

func GetDashboard(c *m.ReqContext) Response

func GetDashboardPermissionList

func GetDashboardPermissionList(c *m.ReqContext) Response

func GetDashboardVersion

func GetDashboardVersion(c *m.ReqContext) Response

GetDashboardVersion returns the dashboard version with the given ID.

func GetDashboardVersions

func GetDashboardVersions(c *m.ReqContext) Response

GetDashboardVersions returns all dashboard versions as JSON

func GetDataSourceById

func GetDataSourceById(c *m.ReqContext) Response

func GetDataSourceByName

func GetDataSourceByName(c *m.ReqContext) Response

Get /api/datasources/name/:name

func GetDataSourceIdByName

func GetDataSourceIdByName(c *m.ReqContext) Response

Get /api/datasources/id/:name

func GetDataSources

func GetDataSources(c *m.ReqContext) Response

func GetFolderById

func GetFolderById(c *m.ReqContext) Response

func GetFolderByUid

func GetFolderByUid(c *m.ReqContext) Response

func GetFolderPermissionList

func GetFolderPermissionList(c *m.ReqContext) Response

func GetFolders

func GetFolders(c *m.ReqContext) Response

func GetHomeDashboard

func GetHomeDashboard(c *m.ReqContext) Response

func GetInviteInfoByCode

func GetInviteInfoByCode(c *m.ReqContext) Response

func GetOrgById

func GetOrgById(c *m.ReqContext) Response

GET /api/orgs/:orgId

func GetOrgByName

func GetOrgByName(c *m.ReqContext) Response

Get /api/orgs/name/:name

func GetOrgCurrent

func GetOrgCurrent(c *m.ReqContext) Response

GET /api/org

func GetOrgPreferences

func GetOrgPreferences(c *m.ReqContext) Response

GET /api/org/preferences

func GetOrgQuotas

func GetOrgQuotas(c *m.ReqContext) Response

func GetOrgUsers

func GetOrgUsers(c *m.ReqContext) Response

GET /api/orgs/:orgId/users

func GetOrgUsersForCurrentOrg

func GetOrgUsersForCurrentOrg(c *m.ReqContext) Response

GET /api/org/users

func GetPendingOrgInvites

func GetPendingOrgInvites(c *m.ReqContext) Response

func GetPlaylist

func GetPlaylist(c *m.ReqContext) Response

func GetPlaylistDashboards

func GetPlaylistDashboards(c *m.ReqContext) Response

func GetPlaylistItems

func GetPlaylistItems(c *m.ReqContext) Response

func GetPluginDashboards

func GetPluginDashboards(c *m.ReqContext) Response

func GetPluginList

func GetPluginList(c *m.ReqContext) Response

func GetPluginMarkdown

func GetPluginMarkdown(c *m.ReqContext) Response

func GetPluginSettingById

func GetPluginSettingById(c *m.ReqContext) Response

func GetSignUpOptions

func GetSignUpOptions(c *m.ReqContext) Response

GET /api/user/signup/options

func GetSignedInUser

func GetSignedInUser(c *m.ReqContext) Response

GET /api/user (current authenticated user)

func GetSignedInUserOrgList

func GetSignedInUserOrgList(c *m.ReqContext) Response

GET /api/user/orgs

func GetTeamById

func GetTeamById(c *m.ReqContext) Response

GET /api/teams/:teamId

func GetTeamMembers

func GetTeamMembers(c *m.ReqContext) Response

GET /api/teams/:teamId/members

func GetTestDataRandomWalk

func GetTestDataRandomWalk(c *m.ReqContext) Response

GET /api/tsdb/testdata/random-walk

func GetTestDataScenarios

func GetTestDataScenarios(c *m.ReqContext) Response

GET /api/tsdb/testdata/scenarios

func GetUserById

func GetUserById(c *m.ReqContext) Response

GET /api/users/:id

func GetUserByLoginOrEmail

func GetUserByLoginOrEmail(c *m.ReqContext) Response

GET /api/users/lookup

func GetUserOrgList

func GetUserOrgList(c *m.ReqContext) Response

GET /api/user/:id/orgs

func GetUserPreferences

func GetUserPreferences(c *m.ReqContext) Response

GET /api/user/preferences

func GetUserQuotas

func GetUserQuotas(c *m.ReqContext) Response

func ImportDashboard

func ImportDashboard(c *m.ReqContext, apiCmd dtos.ImportDashboardCommand) Response

func LoginPost

func LoginPost(c *m.ReqContext, cmd dtos.LoginCommand) Response

func NotificationTest

func NotificationTest(c *m.ReqContext, dto dtos.NotificationTestCommand) Response

POST /api/alert-notifications/test

func PauseAlert

func PauseAlert(c *m.ReqContext, dto dtos.PauseAlertCommand) Response

POST /api/alerts/:alertId/pause

func PauseAllAlerts

func PauseAllAlerts(c *m.ReqContext, dto dtos.PauseAllAlertsCommand) Response

POST /api/admin/pause-all-alerts

func PostAnnotation

func PostAnnotation(c *m.ReqContext, cmd dtos.PostAnnotationsCmd) Response

func PostDashboard

func PostDashboard(c *m.ReqContext, cmd m.SaveDashboardCommand) Response

func PostGraphiteAnnotation

func PostGraphiteAnnotation(c *m.ReqContext, cmd dtos.PostGraphiteAnnotationsCmd) Response

func QueryMetrics

func QueryMetrics(c *m.ReqContext, reqDto dtos.MetricRequest) Response

POST /api/tsdb/query

func RemoveOrgUser

func RemoveOrgUser(c *m.ReqContext) Response

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

func RemoveOrgUserForCurrentOrg

func RemoveOrgUserForCurrentOrg(c *m.ReqContext) Response

DELETE /api/org/users/:userId

func RemoveTeamMember

func RemoveTeamMember(c *m.ReqContext) Response

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

func ResetPassword

func ResetPassword(c *m.ReqContext, form dtos.ResetUserPasswordForm) Response

func RestoreDashboardVersion

func RestoreDashboardVersion(c *m.ReqContext, apiCmd dtos.RestoreDashboardVersionCommand) Response

RestoreDashboardVersion restores a dashboard to the given version.

func RevokeInvite

func RevokeInvite(c *m.ReqContext) Response

func SearchDashboardSnapshots

func SearchDashboardSnapshots(c *m.ReqContext) Response

GET /api/dashboard/snapshots

func SearchOrgs

func SearchOrgs(c *m.ReqContext) Response

func SearchPlaylists

func SearchPlaylists(c *m.ReqContext) Response

func SearchTeams

func SearchTeams(c *m.ReqContext) Response

GET /api/teams/search

func SearchUsers

func SearchUsers(c *m.ReqContext) Response

GET /api/users

func SearchUsersWithPaging

func SearchUsersWithPaging(c *m.ReqContext) Response

GET /api/users/search

func SendResetPasswordEmail

func SendResetPasswordEmail(c *m.ReqContext, form dtos.SendResetPasswordEmailForm) Response

func SetHelpFlag

func SetHelpFlag(c *m.ReqContext) Response

func SetHomeDashboard

func SetHomeDashboard(c *m.ReqContext, cmd m.SavePreferencesCommand) Response

POST /api/preferences/set-home-dash

func SignUp

func SignUp(c *m.ReqContext, form dtos.SignUpForm) Response

POST /api/user/signup

func SignUpStep2

func SignUpStep2(c *m.ReqContext, form dtos.SignUpStep2Form) Response

func StarDashboard

func StarDashboard(c *m.ReqContext) Response

func UnstarDashboard

func UnstarDashboard(c *m.ReqContext) Response

func UpdateAlertNotification

func UpdateAlertNotification(c *m.ReqContext, cmd m.UpdateAlertNotificationCommand) Response

func UpdateAnnotation

func UpdateAnnotation(c *m.ReqContext, cmd dtos.UpdateAnnotationsCmd) Response

func UpdateDashboardPermissions

func UpdateDashboardPermissions(c *m.ReqContext, apiCmd dtos.UpdateDashboardAclCommand) Response

func UpdateDataSource

func UpdateDataSource(c *m.ReqContext, cmd m.UpdateDataSourceCommand) Response

func UpdateFolder

func UpdateFolder(c *m.ReqContext, cmd m.UpdateFolderCommand) Response

func UpdateFolderPermissions

func UpdateFolderPermissions(c *m.ReqContext, apiCmd dtos.UpdateDashboardAclCommand) Response

func UpdateOrg

func UpdateOrg(c *m.ReqContext, form dtos.UpdateOrgForm) Response

PUT /api/orgs/:orgId

func UpdateOrgAddress

func UpdateOrgAddress(c *m.ReqContext, form dtos.UpdateOrgAddressForm) Response

PUT /api/orgs/:orgId/address

func UpdateOrgAddressCurrent

func UpdateOrgAddressCurrent(c *m.ReqContext, form dtos.UpdateOrgAddressForm) Response

PUT /api/org/address

func UpdateOrgCurrent

func UpdateOrgCurrent(c *m.ReqContext, form dtos.UpdateOrgForm) Response

PUT /api/org

func UpdateOrgPreferences

func UpdateOrgPreferences(c *m.ReqContext, dtoCmd dtos.UpdatePrefsCmd) Response

PUT /api/org/preferences

func UpdateOrgQuota

func UpdateOrgQuota(c *m.ReqContext, cmd m.UpdateOrgQuotaCmd) Response

func UpdateOrgUser

func UpdateOrgUser(c *m.ReqContext, cmd m.UpdateOrgUserCommand) Response

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

func UpdateOrgUserForCurrentOrg

func UpdateOrgUserForCurrentOrg(c *m.ReqContext, cmd m.UpdateOrgUserCommand) Response

PATCH /api/org/users/:userId

func UpdatePlaylist

func UpdatePlaylist(c *m.ReqContext, cmd m.UpdatePlaylistCommand) Response

func UpdatePluginSetting

func UpdatePluginSetting(c *m.ReqContext, cmd m.UpdatePluginSettingCmd) Response

func UpdateSignedInUser

func UpdateSignedInUser(c *m.ReqContext, cmd m.UpdateUserCommand) Response

POST /api/user

func UpdateTeam

func UpdateTeam(c *m.ReqContext, cmd m.UpdateTeamCommand) Response

PUT /api/teams/:teamId

func UpdateUser

func UpdateUser(c *m.ReqContext, cmd m.UpdateUserCommand) Response

POST /api/users/:id

func UpdateUserActiveOrg

func UpdateUserActiveOrg(c *m.ReqContext) Response

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

func UpdateUserPreferences

func UpdateUserPreferences(c *m.ReqContext, dtoCmd dtos.UpdatePrefsCmd) Response

PUT /api/user/preferences

func UpdateUserQuota

func UpdateUserQuota(c *m.ReqContext, cmd m.UpdateUserQuotaCmd) Response

func UserSetUsingOrg

func UserSetUsingOrg(c *m.ReqContext) Response

POST /api/user/using/:id

type RouteRegister

type RouteRegister interface {
	Get(string, ...macaron.Handler)
	Post(string, ...macaron.Handler)
	Delete(string, ...macaron.Handler)
	Put(string, ...macaron.Handler)
	Patch(string, ...macaron.Handler)
	Any(string, ...macaron.Handler)

	Group(string, func(RouteRegister), ...macaron.Handler)

	Register(Router) *macaron.Router
}

type Router

type Router interface {
	Handle(method, pattern string, handlers []macaron.Handler) *macaron.Route
	Get(pattern string, handlers ...macaron.Handler) *macaron.Route
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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