Documentation ¶
Index ¶
- Constants
- Variables
- func BlockRedirectRoundtripper(next http.RoundTripper) http.RoundTripper
- func ClearDSDecryptionCache()
- func ContainsTag(existingTags []*Tag, tag *Tag) bool
- func GetDashboardFolderUrl(isFolder bool, uid string, slug string) string
- func GetDashboardUrl(uid string, slug string) string
- func GetFolderUrl(folderUid string, slug string) string
- func GetFullDashboardUrl(uid string, slug string) string
- func IsKnownDataSourcePlugin(dsType string) bool
- func JoinTagPairs(tags []*Tag) []string
- func SlugifyTitle(title string) string
- type AddApiKeyCommand
- type AddDataSourceCommand
- type AddOrgUserCommand
- type AddTeamMemberCommand
- type Address
- type AdminStats
- type Alert
- type AlertListItemDTO
- type AlertNotification
- type AlertNotificationState
- type AlertNotificationStateType
- type AlertStateInfoDTO
- type AlertStateType
- type ApiKey
- type ApiKeyDTO
- type AuthModuleConversion
- type BatchDisableUsersCommand
- type ChangeUserPasswordCommand
- type ChannelHandler
- type ChannelHandlerFactory
- type ChannelPublisher
- type CreateAlertNotificationCommand
- type CreateDashboardSnapshotCommand
- type CreateFolderCommand
- type CreateLoginAttemptCommand
- type CreateOrgCommand
- type CreatePlaylistCommand
- type CreateTeamCommand
- type CreateTempUserCommand
- type CreateTokenErr
- type CreateUserCommand
- type Dashboard
- type DashboardAcl
- type DashboardAclInfoDTO
- type DashboardActivityChannel
- type DashboardErr
- type DashboardPermissionForUser
- type DashboardProvisioning
- type DashboardRef
- type DashboardSnapshot
- type DashboardSnapshotDTO
- type DashboardSnapshotsList
- type DashboardTagCloudItem
- type DashboardVersion
- type DashboardVersionDTO
- type DashboardVersionMeta
- type DataSource
- func (ds *DataSource) DecryptedBasicAuthPassword() string
- func (ds *DataSource) DecryptedPassword() string
- func (ds *DataSource) DecryptedValue(key string) (string, bool)
- func (ds *DataSource) DecryptedValues() map[string]string
- func (ds *DataSource) GetHttpClient() (*http.Client, error)
- func (ds *DataSource) GetHttpTransport() (*dataSourceTransport, error)
- func (ds *DataSource) GetTLSConfig() (*tls.Config, error)
- type DataSourceAccessStats
- type DataSourceStats
- type DatasourcesPermissionFilterQuery
- type DeleteAlertNotificationCommand
- type DeleteAlertNotificationWithUidCommand
- type DeleteApiKeyCommand
- type DeleteAuthInfoCommand
- type DeleteDashboardCommand
- type DeleteDashboardSnapshotCommand
- type DeleteDataSourceCommand
- type DeleteExpiredSnapshotsCommand
- type DeleteExpiredVersionsCommand
- type DeleteOldLoginAttemptsCommand
- type DeleteOrgCommand
- type DeleteOrphanedProvisionedDashboardsCommand
- type DeletePlaylistCommand
- type DeleteShortUrlCommand
- type DeleteTeamCommand
- type DeleteUserCommand
- type DisableUserCommand
- type DsAccess
- type DsPermissionType
- type ExecutionErrorOption
- type ExpireTempUsersCommand
- type ExternalUserInfo
- type Folder
- type GetAdminStatsQuery
- type GetAlertByIdQuery
- type GetAlertNotificationUidQuery
- type GetAlertNotificationsQuery
- type GetAlertNotificationsWithUidQuery
- type GetAlertNotificationsWithUidToSendQuery
- type GetAlertNotifierUsageStatsQuery
- type GetAlertStatesForDashboardQuery
- type GetAlertsQuery
- type GetAllAlertNotificationsQuery
- type GetAllAlertsQuery
- type GetApiKeyByIdQuery
- type GetApiKeyByNameQuery
- type GetApiKeysQuery
- type GetAuthInfoQuery
- type GetDBHealthQuery
- type GetDashboardAclInfoListQuery
- type GetDashboardPermissionsForUserQuery
- type GetDashboardQuery
- type GetDashboardRefByIdQuery
- type GetDashboardSlugByIdQuery
- type GetDashboardSnapshotQuery
- type GetDashboardSnapshotsQuery
- type GetDashboardTagsQuery
- type GetDashboardVersionQuery
- type GetDashboardVersionsQuery
- type GetDashboardsByPluginIdQuery
- type GetDashboardsBySlugQuery
- type GetDashboardsQuery
- type GetDataSourceAccessStatsQuery
- type GetDataSourceQuery
- type GetDataSourceStatsQuery
- type GetDataSourcesByTypeQuery
- type GetDataSourcesQuery
- type GetDefaultDataSourceQuery
- type GetExternalUserInfoByLoginQuery
- type GetGlobalQuotaByTargetQuery
- type GetOrCreateNotificationStateQuery
- type GetOrgByIdQuery
- type GetOrgByNameQuery
- type GetOrgQuotaByTargetQuery
- type GetOrgQuotasQuery
- type GetOrgUsersQuery
- type GetPlaylistByIdQuery
- type GetPlaylistItemsByIdQuery
- type GetPlaylistsQuery
- type GetPluginSettingByIdQuery
- type GetPluginSettingsQuery
- type GetPreferencesQuery
- type GetPreferencesWithDefaultsQuery
- type GetProvisionedDashboardDataByIdQuery
- type GetProvisionedDashboardDataQuery
- type GetSignedInUserQuery
- type GetSystemStatsQuery
- type GetSystemUserCountStatsQuery
- type GetTeamByIdQuery
- type GetTeamMembersQuery
- type GetTeamsByUserQuery
- type GetTeamsForLDAPGroupCommand
- type GetTempUserByCodeQuery
- type GetTempUsersQuery
- type GetUserByAuthInfoQuery
- type GetUserByEmailQuery
- type GetUserByIdQuery
- type GetUserByLoginQuery
- type GetUserLoginAttemptCountQuery
- type GetUserOrgListQuery
- type GetUserProfileQuery
- type GetUserQuotaByTargetQuery
- type GetUserQuotasQuery
- type GetUserStarsQuery
- type GlobalQuotaDTO
- type HasAdminPermissionInFoldersQuery
- type HasEditPermissionInFoldersQuery
- type HelpFlags1
- type InsertSQLTestDataCommand
- type IsAdminOfTeamsQuery
- type IsStarredByUserQuery
- type LicenseEnvironment
- type Licensing
- type LoginAttempt
- type LoginInfo
- type LoginUserQuery
- type Measurement
- type MeasurementAction
- type MeasurementBatch
- type NoDataOption
- type NotifierUsageStats
- type OAuthType
- type Org
- type OrgDTO
- type OrgDetailsDTO
- type OrgQuotaDTO
- type OrgUser
- type OrgUserDTO
- type Password
- type PauseAlertCommand
- type PauseAllAlertCommand
- type PermissionType
- type Playlist
- type PlaylistDTO
- type PlaylistItem
- type PlaylistItemDTO
- type Playlists
- type PluginRequestValidator
- type PluginSetting
- type PluginSettingInfoDTO
- type PluginStateChangedEvent
- type Preferences
- type Quota
- type QuotaScope
- type RemoveOrgUserCommand
- type RemoveTeamMemberCommand
- type ReqContext
- func (ctx *ReqContext) Handle(cfg *setting.Cfg, status int, title string, err error)
- func (ctx *ReqContext) HasHelpFlag(flag HelpFlags1) bool
- func (ctx *ReqContext) HasUserRole(role RoleType) bool
- func (ctx *ReqContext) IsApiRequest() bool
- func (ctx *ReqContext) JsonApiErr(status int, message string, err error)
- func (ctx *ReqContext) TimeRequest(timer prometheus.Summary)
- type RequestURIKey
- type RevokeAuthTokenCmd
- type RoleType
- type RoundTripperFunc
- type SQLTestData
- type SaveAlertsCommand
- type SaveDashboardCommand
- type SavePreferencesCommand
- type SaveProvisionedDashboardCommand
- type SearchOrgsQuery
- type SearchTeamQueryResult
- type SearchTeamsQuery
- type SearchUserQueryResult
- type SearchUsersQuery
- type SendEmailAttachFile
- type SendEmailCommand
- type SendEmailCommandSync
- type SendResetPasswordEmailCommand
- type SendWebhookSync
- type SetAlertNotificationStateToCompleteCommand
- type SetAlertNotificationStateToPendingCommand
- type SetAlertStateCommand
- type SetAuthInfoCommand
- type SetUserHelpFlagCommand
- type SetUsingOrgCommand
- type ShortUrl
- type SignedInUser
- type Star
- type StarDashboardCommand
- type SystemStats
- type SystemUserCountStats
- type Tag
- type Team
- type TeamDTO
- type TeamMember
- type TeamMemberDTO
- type TeamOrgGroupDTO
- type TempUser
- type TempUserDTO
- type TempUserStatus
- type TokenExpiredError
- type TokenRevokedError
- type UnprovisionDashboardCommand
- type UnstarDashboardCommand
- type UpdateAlertNotificationCommand
- type UpdateAlertNotificationWithUidCommand
- type UpdateAuthInfoCommand
- type UpdateDashboardAclCommand
- type UpdateDashboardAlertsCommand
- type UpdateDataSourceCommand
- type UpdateFolderCommand
- type UpdateOrgAddressCommand
- type UpdateOrgCommand
- type UpdateOrgQuotaCmd
- type UpdateOrgUserCommand
- type UpdatePlaylistCommand
- type UpdatePluginDashboardError
- type UpdatePluginSettingCmd
- type UpdatePluginSettingVersionCmd
- type UpdateTeamCommand
- type UpdateTeamMemberCommand
- type UpdateTempUserStatusCommand
- type UpdateTempUserWithEmailSentCommand
- type UpdateUserCommand
- type UpdateUserLastSeenAtCommand
- type UpdateUserPermissionsCommand
- type UpdateUserQuotaCmd
- type UpsertUserCommand
- type User
- type UserAuth
- type UserIdDTO
- type UserLookupParams
- type UserOrgDTO
- type UserProfileDTO
- type UserQuotaDTO
- type UserSearchHitDTO
- type UserStats
- type UserToken
- type UserTokenService
- type ValidateDashboardAlertsCommand
- type ValidateDashboardBeforeSaveCommand
- type ValidateDashboardBeforeSaveResult
- type ValidateResetPasswordCodeQuery
Constants ¶
const ( DashTypeDB = "db" DashTypeSnapshot = "snapshot" )
const ( DS_GRAPHITE = "graphite" DS_INFLUXDB = "influxdb" DS_INFLUXDB_08 = "influxdb_08" DS_ES = "elasticsearch" DS_OPENTSDB = "opentsdb" DS_CLOUDWATCH = "cloudwatch" DS_KAIROSDB = "kairosdb" DS_PROMETHEUS = "prometheus" DS_POSTGRES = "postgres" DS_MYSQL = "mysql" DS_MSSQL = "mssql" DS_ACCESS_DIRECT = "direct" DS_ACCESS_PROXY = "proxy" // Stackdriver was renamed Google Cloud monitoring 2020-05 but we keep // "stackdriver" to avoid breaking changes in reporting. DS_CLOUD_MONITORING = "stackdriver" DS_AZURE_MONITOR = "grafana-azure-monitor-datasource" //DS_LOKI = "loki" DS_ES_OPEN_DISTRO = "grafana-es-open-distro-datasource" )
const (
AuthModuleLDAP = "ldap"
)
const FilterIgnoreUser int64 = 0
FilterIgnoreUser is used in a get / search teams query when the caller does not want to filter teams by user ID / membership
const RootFolderName = "General"
Variables ¶
var ( ErrCannotChangeStateOnPausedAlert = fmt.Errorf("cannot change state on pause alert") ErrRequiresNewState = fmt.Errorf("update alert state requires a new state") )
var ( ErrAlertNotificationNotFound = errors.New("alert notification not found") ErrNotificationFrequencyNotFound = errors.New("notification frequency not specified") ErrAlertNotificationStateVersionConflict = errors.New("alert notification state update version conflict") ErrAlertNotificationFailedGenerateUniqueUid = errors.New("failed to generate unique alert notification uid") ErrAlertNotificationFailedTranslateUniqueID = errors.New("failed to translate Notification Id to Uid") ErrAlertNotificationWithSameNameExists = errors.New("alert notification with same name already exists") ErrAlertNotificationWithSameUIDExists = errors.New("alert notification with same uid already exists") )
var ( AlertNotificationStatePending = AlertNotificationStateType("pending") AlertNotificationStateCompleted = AlertNotificationStateType("completed") AlertNotificationStateUnknown = AlertNotificationStateType("unknown") )
var ( ErrDashboardAclInfoMissing = errors.New("user id and team id cannot both be empty for a dashboard permission") ErrDashboardPermissionDashboardEmpty = errors.New("dashboard id must be greater than zero for a dashboard permission") ErrFolderAclInfoMissing = errors.New("user id and team id cannot both be empty for a folder permission") ErrFolderPermissionFolderEmpty = errors.New("folder id must be greater than zero for a folder permission") ErrPermissionsWithRoleNotAllowed = errors.New("team and user permissions cannot have an associated role") )
Typed errors
var ( ErrDashboardVersionNotFound = errors.New("dashboard version not found") ErrNoVersionsForDashboardId = errors.New("no dashboard versions found for the given DashboardId") )
var ( ErrDashboardNotFound = DashboardErr{ Reason: "Dashboard not found", StatusCode: 404, Status: "not-found", } ErrDashboardFolderNotFound = DashboardErr{ Reason: "Folder not found", StatusCode: 404, } ErrDashboardSnapshotNotFound = DashboardErr{ Reason: "Dashboard snapshot not found", StatusCode: 404, } ErrDashboardWithSameUIDExists = DashboardErr{ Reason: "A dashboard with the same uid already exists", StatusCode: 400, } ErrDashboardWithSameNameInFolderExists = DashboardErr{ Reason: "A dashboard with the same name in the folder already exists", StatusCode: 412, Status: "name-exists", } ErrDashboardVersionMismatch = DashboardErr{ Reason: "The dashboard has been changed by someone else", StatusCode: 412, Status: "version-mismatch", } ErrDashboardTitleEmpty = DashboardErr{ Reason: "Dashboard title cannot be empty", StatusCode: 400, } ErrDashboardFolderCannotHaveParent = DashboardErr{ Reason: "A Dashboard Folder cannot be added to another folder", StatusCode: 400, } ErrDashboardsWithSameSlugExists = DashboardErr{ Reason: "Multiple dashboards with the same slug exists", StatusCode: 412, } ErrDashboardFailedGenerateUniqueUid = DashboardErr{ Reason: "Failed to generate unique dashboard id", StatusCode: 500, } ErrDashboardTypeMismatch = DashboardErr{ Reason: "Dashboard cannot be changed to a folder", StatusCode: 400, } ErrDashboardFolderWithSameNameAsDashboard = DashboardErr{ Reason: "Folder name cannot be the same as one of its dashboards", StatusCode: 400, } ErrDashboardWithSameNameAsFolder = DashboardErr{ Reason: "Dashboard name cannot be the same as folder", StatusCode: 400, } ErrDashboardFolderNameExists = DashboardErr{ Reason: "A folder with that name already exists", StatusCode: 400, } ErrDashboardUpdateAccessDenied = DashboardErr{ Reason: "Access denied to save dashboard", StatusCode: 403, } ErrDashboardInvalidUid = DashboardErr{ Reason: "uid contains illegal characters", StatusCode: 400, } ErrDashboardUidTooLong = DashboardErr{ Reason: "uid too long, max 40 characters", StatusCode: 400, } ErrDashboardCannotSaveProvisionedDashboard = DashboardErr{ Reason: "Cannot save provisioned dashboard", StatusCode: 400, } ErrDashboardRefreshIntervalTooShort = DashboardErr{ Reason: "Dashboard refresh interval is too low", StatusCode: 400, } ErrDashboardCannotDeleteProvisionedDashboard = DashboardErr{ Reason: "provisioned dashboard cannot be deleted", StatusCode: 400, } ErrDashboardIdentifierNotSet = DashboardErr{ Reason: "Unique identifier needed to be able to get a dashboard", StatusCode: 400, } )
Typed errors
var ( ErrDataSourceNotFound = errors.New("data source not found") ErrDataSourceNameExists = errors.New("data source with the same name already exists") ErrDataSourceUidExists = errors.New("data source with the same uid already exists") ErrDataSourceUpdatingOldVersion = errors.New("trying to update old version of datasource") ErrDatasourceIsReadOnly = errors.New("data source is readonly, can only be updated from configuration") ErrDataSourceAccessDenied = errors.New("data source access denied") ErrDataSourceFailedGenerateUniqueUid = errors.New("failed to generate unique datasource ID") ErrDataSourceIdentifierNotSet = errors.New("unique identifier and org id are needed to be able to get or delete a datasource") )
var ( ErrFolderNotFound = errors.New("folder not found") ErrFolderVersionMismatch = errors.New("the folder has been changed by someone else") ErrFolderTitleEmpty = errors.New("folder title cannot be empty") ErrFolderWithSameUIDExists = errors.New("a folder/dashboard with the same uid already exists") ErrFolderSameNameExists = errors.New("a folder or dashboard in the general folder with the same name already exists") ErrFolderFailedGenerateUniqueUid = errors.New("failed to generate unique folder ID") ErrFolderAccessDenied = errors.New("access denied to folder") )
Typed errors
var ( ErrOrgNotFound = errors.New("organization not found") ErrOrgNameTaken = errors.New("organization name is taken") )
Typed errors
var ( ErrLastOrgAdmin = errors.New("cannot remove last organization admin") ErrOrgUserNotFound = errors.New("cannot find the organization user") ErrOrgUserAlreadyAdded = errors.New("user is already added to organization") )
Typed errors
var ( ErrTeamNotFound = errors.New("team not found") ErrTeamNameTaken = errors.New("team name is taken") ErrTeamMemberNotFound = errors.New("team member not found") ErrLastTeamAdmin = errors.New("not allowed to remove last admin") ErrNotAllowedToUpdateTeam = errors.New("user not allowed to update team") ErrNotAllowedToUpdateTeamInDifferentOrg = errors.New("user not allowed to update team in another org") )
Typed errors
var ( ErrUserNotFound = errors.New("user not found") ErrUserAlreadyExists = errors.New("user already exists") ErrLastGrafanaAdmin = errors.New("cannot remove last grafana admin") )
Typed errors
var ErrCommandValidationFailed = errors.New("command missing required fields")
var ErrDuplicateApiKey = errors.New("API key, organization ID and name must be unique")
var ErrInvalidApiKey = errors.New("invalid API key")
var ErrInvalidApiKeyExpiration = errors.New("negative value for SecondsToLive")
var ErrInvalidEmailCode = errors.New("invalid or expired email code")
var ErrInvalidQuotaTarget = errors.New("invalid quota target")
var (
ErrPlaylistNotFound = errors.New("Playlist not found")
)
Typed errors
var (
ErrPluginSettingNotFound = errors.New("plugin setting not found")
)
var (
ErrShortURLNotFound = errors.New("short URL not found")
)
var ErrSmtpNotEnabled = errors.New("SMTP not configured, check your grafana.ini config file's [smtp] section")
var (
ErrTeamMemberAlreadyAdded = errors.New("User is already added to this team")
)
Typed errors
var (
ErrTempUserNotFound = errors.New("User not found")
)
Typed errors
var (
ErrUserTokenNotFound = errors.New("user token not found")
)
Typed errors
Functions ¶
func BlockRedirectRoundtripper ¶
func BlockRedirectRoundtripper(next http.RoundTripper) http.RoundTripper
func ClearDSDecryptionCache ¶
func ClearDSDecryptionCache()
ClearDSDecryptionCache clears the datasource decryption cache.
func ContainsTag ¶
func GetDashboardFolderUrl ¶
GetDashboardFolderUrl return the html url for a folder if it's folder, otherwise for a dashboard
func GetDashboardUrl ¶
GetDashboardUrl returns the HTML url for a dashboard.
func GetFolderUrl ¶
GetFolderUrl returns the HTML url for a folder.
func GetFullDashboardUrl ¶
GetFullDashboardUrl returns the full URL for a dashboard.
func IsKnownDataSourcePlugin ¶
func JoinTagPairs ¶
func SlugifyTitle ¶
Types ¶
type AddApiKeyCommand ¶
type AddApiKeyCommand struct { Name string `json:"name" binding:"Required"` Role RoleType `json:"role" binding:"Required"` OrgId int64 `json:"-"` Key string `json:"-"` SecondsToLive int64 `json:"secondsToLive"` Result *ApiKey `json:"-"` }
--------------------- COMMANDS
type AddDataSourceCommand ¶
type AddDataSourceCommand struct { Name string `json:"name" binding:"Required"` Type string `json:"type" binding:"Required"` Access DsAccess `json:"access" binding:"Required"` Url string `json:"url"` Password string `json:"password"` Database string `json:"database"` User string `json:"user"` BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"` BasicAuthPassword string `json:"basicAuthPassword"` WithCredentials bool `json:"withCredentials"` IsDefault bool `json:"isDefault"` JsonData *simplejson.Json `json:"jsonData"` SecureJsonData map[string]string `json:"secureJsonData"` Uid string `json:"uid"` OrgId int64 `json:"-"` ReadOnly bool `json:"-"` Result *DataSource }
Also acts as api DTO
type AddOrgUserCommand ¶
type AddTeamMemberCommand ¶
type AddTeamMemberCommand struct { UserId int64 `json:"userId" binding:"Required"` OrgId int64 `json:"-"` TeamId int64 `json:"-"` External bool `json:"-"` Permission PermissionType `json:"-"` }
type AdminStats ¶
type AdminStats struct { Orgs int `json:"orgs"` Dashboards int `json:"dashboards"` Snapshots int `json:"snapshots"` Tags int `json:"tags"` Datasources int `json:"datasources"` Playlists int `json:"playlists"` Stars int `json:"stars"` Alerts int `json:"alerts"` Users int `json:"users"` Admins int `json:"admins"` Editors int `json:"editors"` Viewers int `json:"viewers"` ActiveUsers int `json:"activeUsers"` ActiveAdmins int `json:"activeAdmins"` ActiveEditors int `json:"activeEditors"` ActiveViewers int `json:"activeViewers"` ActiveSessions int `json:"activeSessions"` }
type Alert ¶
type Alert struct { Id int64 Version int64 OrgId int64 DashboardId int64 PanelId int64 Name string Message string Severity string // Unused State AlertStateType Handler int64 // Unused Silenced bool ExecutionError string Frequency int64 For time.Duration EvalData *simplejson.Json NewStateDate time.Time StateChanges int64 Created time.Time Updated time.Time Settings *simplejson.Json }
func (*Alert) ContainsUpdates ¶
func (*Alert) GetTagsFromSettings ¶
func (*Alert) ValidToSave ¶
type AlertListItemDTO ¶
type AlertListItemDTO struct { Id int64 `json:"id"` DashboardId int64 `json:"dashboardId"` DashboardUid string `json:"dashboardUid"` DashboardSlug string `json:"dashboardSlug"` PanelId int64 `json:"panelId"` Name string `json:"name"` State AlertStateType `json:"state"` NewStateDate time.Time `json:"newStateDate"` EvalDate time.Time `json:"evalDate"` EvalData *simplejson.Json `json:"evalData"` ExecutionError string `json:"executionError"` Url string `json:"url"` }
type AlertNotification ¶
type AlertNotification struct { Id int64 `json:"id"` Uid string `json:"-"` OrgId int64 `json:"-"` Name string `json:"name"` Type string `json:"type"` SendReminder bool `json:"sendReminder"` DisableResolveMessage bool `json:"disableResolveMessage"` Frequency time.Duration `json:"frequency"` IsDefault bool `json:"isDefault"` Settings *simplejson.Json `json:"settings"` SecureSettings securejsondata.SecureJsonData `json:"secureSettings"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` }
func (*AlertNotification) DecryptedValue ¶
func (an *AlertNotification) DecryptedValue(field string, fallback string) string
decryptedValue returns decrypted value from secureSettings
type AlertNotificationState ¶
type AlertNotificationStateType ¶
type AlertNotificationStateType string
type AlertStateInfoDTO ¶
type AlertStateType ¶
type AlertStateType string
const ( AlertStateNoData AlertStateType = "no_data" AlertStatePaused AlertStateType = "paused" AlertStateAlerting AlertStateType = "alerting" AlertStateOK AlertStateType = "ok" AlertStatePending AlertStateType = "pending" AlertStateUnknown AlertStateType = "unknown" )
func (AlertStateType) IsValid ¶
func (s AlertStateType) IsValid() bool
type AuthModuleConversion ¶
type AuthModuleConversion []string
implement Conversion interface to define custom field mapping (xorm feature)
func (*AuthModuleConversion) FromDB ¶
func (auth *AuthModuleConversion) FromDB(data []byte) error
func (*AuthModuleConversion) ToDB ¶
func (auth *AuthModuleConversion) ToDB() ([]byte, error)
Just a stub, we don't want to write to database
type ChannelHandler ¶
type ChannelHandler interface { // OnSubscribe is called when a client wants to subscribe to a channel OnSubscribe(c *centrifuge.Client, e centrifuge.SubscribeEvent) (centrifuge.SubscribeReply, error) // OnPublish is called when a client writes a message to the channel websocket. OnPublish(c *centrifuge.Client, e centrifuge.PublishEvent) (centrifuge.PublishReply, error) }
ChannelHandler defines the core channel behavior
type ChannelHandlerFactory ¶
type ChannelHandlerFactory interface { // GetHandlerForPath gets a ChannelHandler for a path. // This is called fast and often -- it must be synchronized GetHandlerForPath(path string) (ChannelHandler, error) }
ChannelHandlerFactory should be implemented by all core features.
type ChannelPublisher ¶
ChannelPublisher writes data into a channel. Note that pemissions are not checked.
type CreateAlertNotificationCommand ¶
type CreateAlertNotificationCommand struct { Uid string `json:"uid"` Name string `json:"name" binding:"Required"` Type string `json:"type" binding:"Required"` SendReminder bool `json:"sendReminder"` DisableResolveMessage bool `json:"disableResolveMessage"` Frequency string `json:"frequency"` IsDefault bool `json:"isDefault"` Settings *simplejson.Json `json:"settings"` SecureSettings map[string]string `json:"secureSettings"` OrgId int64 `json:"-"` Result *AlertNotification }
type CreateDashboardSnapshotCommand ¶
type CreateDashboardSnapshotCommand struct { Dashboard *simplejson.Json `json:"dashboard" binding:"Required"` Name string `json:"name"` Expires int64 `json:"expires"` // these are passed when storing an external snapshot ref External bool `json:"external"` ExternalUrl string `json:"-"` ExternalDeleteUrl string `json:"-"` Key string `json:"key"` DeleteKey string `json:"deleteKey"` OrgId int64 `json:"-"` UserId int64 `json:"-"` Result *DashboardSnapshot }
type CreateFolderCommand ¶
type CreateFolderCommand struct { Uid string `json:"uid"` Title string `json:"title"` Result *Folder }
func (*CreateFolderCommand) GetDashboardModel ¶
func (cmd *CreateFolderCommand) GetDashboardModel(orgId int64, userId int64) *Dashboard
GetDashboardModel turns the command into the saveable model
type CreateLoginAttemptCommand ¶
type CreateLoginAttemptCommand struct { Username string IpAddress string Result LoginAttempt }
type CreateOrgCommand ¶
type CreatePlaylistCommand ¶
type CreatePlaylistCommand struct { Name string `json:"name" binding:"Required"` Interval string `json:"interval"` Items []PlaylistItemDTO `json:"items"` OrgId int64 `json:"-"` Result *Playlist }
type CreateTeamCommand ¶
type CreateTempUserCommand ¶
type CreateTokenErr ¶
CreateTokenErr represents a token creation error; used in Enterprise
func (*CreateTokenErr) Error ¶
func (e *CreateTokenErr) Error() string
type CreateUserCommand ¶
type Dashboard ¶
type Dashboard struct { Id int64 Uid string Slug string OrgId int64 GnetId int64 Version int PluginId string Created time.Time Updated time.Time UpdatedBy int64 CreatedBy int64 FolderId int64 IsFolder bool HasAcl bool Title string Data *simplejson.Json }
Dashboard model
func NewDashboardFolder ¶
NewDashboardFolder creates a new dashboard folder
func NewDashboardFromJson ¶
func NewDashboardFromJson(data *simplejson.Json) *Dashboard
func (*Dashboard) GetDashboardIdForSavePermissionCheck ¶
GetDashboardIdForSavePermissionCheck return the dashboard id to be used for checking permission of dashboard
func (*Dashboard) GetUrl ¶
GetUrl return the html url for a folder if it's folder, otherwise for a dashboard
func (*Dashboard) SetVersion ¶
type DashboardAcl ¶
type DashboardAcl struct { // nolint:stylecheck Id int64 OrgID int64 `xorm:"org_id"` DashboardID int64 `xorm:"dashboard_id"` UserID int64 `xorm:"user_id"` TeamID int64 `xorm:"team_id"` Role *RoleType // pointer to be nullable Permission PermissionType Created time.Time Updated time.Time }
Dashboard ACL model
type DashboardAclInfoDTO ¶
type DashboardAclInfoDTO struct { OrgId int64 `json:"-"` DashboardId int64 `json:"dashboardId,omitempty"` FolderId int64 `json:"folderId,omitempty"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` UserId int64 `json:"userId"` UserLogin string `json:"userLogin"` UserEmail string `json:"userEmail"` UserAvatarUrl string `json:"userAvatarUrl"` TeamId int64 `json:"teamId"` TeamEmail string `json:"teamEmail"` TeamAvatarUrl string `json:"teamAvatarUrl"` Team string `json:"team"` Role *RoleType `json:"role,omitempty"` Permission PermissionType `json:"permission"` PermissionName string `json:"permissionName"` Uid string `json:"uid"` Title string `json:"title"` Slug string `json:"slug"` IsFolder bool `json:"isFolder"` Url string `json:"url"` Inherited bool `json:"inherited"` }
func (*DashboardAclInfoDTO) IsDuplicateOf ¶
func (dto *DashboardAclInfoDTO) IsDuplicateOf(other *DashboardAclInfoDTO) bool
IsDuplicateOf returns true if other item has same role, same user or same team
type DashboardActivityChannel ¶
type DashboardActivityChannel interface { DashboardSaved(uid string, userID int64) error DashboardDeleted(uid string, userID int64) error }
DashboardActivityChannel is a service to advertise dashboard activity
type DashboardErr ¶
DashboardErr represents a dashboard error.
func (DashboardErr) Body ¶
func (e DashboardErr) Body() util.DynMap
Body returns the error's response body, if applicable.
func (DashboardErr) Equal ¶
func (e DashboardErr) Equal(o DashboardErr) bool
Equal returns whether equal to another DashboardErr.
type DashboardPermissionForUser ¶
type DashboardPermissionForUser struct { DashboardId int64 `json:"dashboardId"` Permission PermissionType `json:"permission"` PermissionName string `json:"permissionName"` }
type DashboardProvisioning ¶
type DashboardRef ¶
type DashboardSnapshot ¶
type DashboardSnapshot struct { Id int64 Name string Key string DeleteKey string OrgId int64 UserId int64 External bool ExternalUrl string ExternalDeleteUrl string Expires time.Time Created time.Time Updated time.Time Dashboard *simplejson.Json DashboardEncrypted securedata.SecureData }
DashboardSnapshot model
func (*DashboardSnapshot) DashboardJSON ¶
func (ds *DashboardSnapshot) DashboardJSON() (*simplejson.Json, error)
type DashboardSnapshotDTO ¶
type DashboardSnapshotDTO struct { Id int64 `json:"id"` Name string `json:"name"` Key string `json:"key"` OrgId int64 `json:"orgId"` UserId int64 `json:"userId"` External bool `json:"external"` ExternalUrl string `json:"externalUrl"` Expires time.Time `json:"expires"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` }
DashboardSnapshotDTO without dashboard map
type DashboardSnapshotsList ¶
type DashboardSnapshotsList []*DashboardSnapshotDTO
type DashboardTagCloudItem ¶
type DashboardVersion ¶
type DashboardVersion struct { Id int64 `json:"id"` DashboardId int64 `json:"dashboardId"` ParentVersion int `json:"parentVersion"` RestoredFrom int `json:"restoredFrom"` Version int `json:"version"` Created time.Time `json:"created"` CreatedBy int64 `json:"createdBy"` Message string `json:"message"` Data *simplejson.Json `json:"data"` }
A DashboardVersion represents the comparable data in a dashboard, allowing diffs of the dashboard to be performed.
type DashboardVersionDTO ¶
type DashboardVersionDTO struct { Id int64 `json:"id"` DashboardId int64 `json:"dashboardId"` ParentVersion int `json:"parentVersion"` RestoredFrom int `json:"restoredFrom"` Version int `json:"version"` Created time.Time `json:"created"` CreatedBy string `json:"createdBy"` Message string `json:"message"` }
DashboardVersionDTO represents a dashboard version, without the dashboard map.
type DashboardVersionMeta ¶
type DashboardVersionMeta struct { Id int64 `json:"id"` DashboardId int64 `json:"dashboardId"` ParentVersion int `json:"parentVersion"` RestoredFrom int `json:"restoredFrom"` Version int `json:"version"` Created time.Time `json:"created"` Message string `json:"message"` Data *simplejson.Json `json:"data"` CreatedBy string `json:"createdBy"` }
DashboardVersionMeta extends the dashboard version model with the names associated with the UserIds, overriding the field with the same name from the DashboardVersion model.
type DataSource ¶
type DataSource struct { Id int64 `json:"id"` OrgId int64 `json:"orgId"` Version int `json:"version"` Name string `json:"name"` Type string `json:"type"` Access DsAccess `json:"access"` Url string `json:"url"` Password string `json:"password"` User string `json:"user"` Database string `json:"database"` BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"` BasicAuthPassword string `json:"basicAuthPassword"` WithCredentials bool `json:"withCredentials"` IsDefault bool `json:"isDefault"` JsonData *simplejson.Json `json:"jsonData"` SecureJsonData securejsondata.SecureJsonData `json:"secureJsonData"` ReadOnly bool `json:"readOnly"` Uid string `json:"uid"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` }
func (*DataSource) DecryptedBasicAuthPassword ¶
func (ds *DataSource) DecryptedBasicAuthPassword() string
DecryptedBasicAuthPassword returns data source basic auth password in plain text. It uses either deprecated basic_auth_password field or encrypted secure_json_data[basicAuthPassword] variable.
func (*DataSource) DecryptedPassword ¶
func (ds *DataSource) DecryptedPassword() string
DecryptedPassword returns data source password in plain text. It uses either deprecated password field or encrypted secure_json_data[password] variable.
func (*DataSource) DecryptedValue ¶
func (ds *DataSource) DecryptedValue(key string) (string, bool)
DecryptedValue returns cached decrypted value from cached secureJsonData.
func (*DataSource) DecryptedValues ¶
func (ds *DataSource) DecryptedValues() map[string]string
DecryptedValues returns cached decrypted values from secureJsonData.
func (*DataSource) GetHttpClient ¶
func (ds *DataSource) GetHttpClient() (*http.Client, error)
func (*DataSource) GetHttpTransport ¶
func (ds *DataSource) GetHttpTransport() (*dataSourceTransport, error)
Creates a HTTP Transport middleware chain
func (*DataSource) GetTLSConfig ¶
func (ds *DataSource) GetTLSConfig() (*tls.Config, error)
type DataSourceAccessStats ¶
type DataSourceStats ¶
type DatasourcesPermissionFilterQuery ¶
type DatasourcesPermissionFilterQuery struct { User *SignedInUser Datasources []*DataSource Result []*DataSource }
type DeleteApiKeyCommand ¶
type DeleteAuthInfoCommand ¶
type DeleteAuthInfoCommand struct {
UserAuth *UserAuth
}
type DeleteDashboardCommand ¶
type DeleteDashboardSnapshotCommand ¶
type DeleteDashboardSnapshotCommand struct {
DeleteKey string `json:"-"`
}
type DeleteDataSourceCommand ¶
type DeleteDataSourceCommand struct { ID int64 UID string Name string OrgID int64 DeletedDatasourcesCount int64 }
DeleteDataSourceCommand will delete a DataSource based on OrgID as well as the UID (preferred), ID, or Name. At least one of the UID, ID, or Name properties must be set in addition to OrgID.
type DeleteExpiredSnapshotsCommand ¶
type DeleteExpiredSnapshotsCommand struct {
DeletedRows int64
}
type DeleteExpiredVersionsCommand ¶
type DeleteExpiredVersionsCommand struct {
DeletedRows int64
}
type DeleteOrgCommand ¶
type DeleteOrgCommand struct {
Id int64
}
type DeleteOrphanedProvisionedDashboardsCommand ¶
type DeleteOrphanedProvisionedDashboardsCommand struct {
ReaderNames []string
}
type DeletePlaylistCommand ¶
type DeleteShortUrlCommand ¶
type DeleteTeamCommand ¶
type DeleteUserCommand ¶
type DeleteUserCommand struct {
UserId int64
}
type DisableUserCommand ¶
type DsPermissionType ¶
type DsPermissionType int
const ( DsPermissionNoAccess DsPermissionType = iota DsPermissionQuery )
func (DsPermissionType) String ¶
func (p DsPermissionType) String() string
type ExecutionErrorOption ¶
type ExecutionErrorOption string
const ( ExecutionErrorSetAlerting ExecutionErrorOption = "alerting" ExecutionErrorKeepState ExecutionErrorOption = "keep_state" )
func (ExecutionErrorOption) IsValid ¶
func (s ExecutionErrorOption) IsValid() bool
func (ExecutionErrorOption) ToAlertState ¶
func (s ExecutionErrorOption) ToAlertState() AlertStateType
type ExpireTempUsersCommand ¶
type ExternalUserInfo ¶
type ExternalUserInfo struct { OAuthToken *oauth2.Token AuthModule string AuthId string UserId int64 Email string Login string Name string Groups []string OrgRoles map[int64]RoleType IsGrafanaAdmin *bool // This is a pointer to know if we should sync this or not (nil = ignore sync) IsDisabled bool }
type GetAdminStatsQuery ¶
type GetAdminStatsQuery struct {
Result *AdminStats
}
type GetAlertByIdQuery ¶
type GetAlertNotificationsQuery ¶
type GetAlertNotificationsQuery struct { Name string Id int64 OrgId int64 Result *AlertNotification }
type GetAlertNotificationsWithUidQuery ¶
type GetAlertNotificationsWithUidQuery struct { Uid string OrgId int64 Result *AlertNotification }
type GetAlertNotificationsWithUidToSendQuery ¶
type GetAlertNotificationsWithUidToSendQuery struct { Uids []string OrgId int64 Result []*AlertNotification }
type GetAlertNotifierUsageStatsQuery ¶
type GetAlertNotifierUsageStatsQuery struct {
Result []*NotifierUsageStats
}
type GetAlertStatesForDashboardQuery ¶
type GetAlertStatesForDashboardQuery struct { OrgId int64 DashboardId int64 Result []*AlertStateInfoDTO }
type GetAlertsQuery ¶
type GetAlertsQuery struct { OrgId int64 State []string DashboardIDs []int64 PanelId int64 Limit int64 Query string User *SignedInUser Result []*AlertListItemDTO }
Queries
type GetAllAlertNotificationsQuery ¶
type GetAllAlertNotificationsQuery struct { OrgId int64 Result []*AlertNotification }
type GetAllAlertsQuery ¶
type GetAllAlertsQuery struct {
Result []*Alert
}
type GetApiKeyByIdQuery ¶
type GetApiKeyByNameQuery ¶
type GetApiKeysQuery ¶
type GetAuthInfoQuery ¶
type GetDBHealthQuery ¶
type GetDBHealthQuery struct{}
type GetDashboardAclInfoListQuery ¶
type GetDashboardAclInfoListQuery struct { DashboardID int64 OrgID int64 Result []*DashboardAclInfoDTO }
QUERIES
type GetDashboardPermissionsForUserQuery ¶
type GetDashboardPermissionsForUserQuery struct { DashboardIds []int64 OrgId int64 UserId int64 OrgRole RoleType Result []*DashboardPermissionForUser }
type GetDashboardQuery ¶
type GetDashboardRefByIdQuery ¶
type GetDashboardRefByIdQuery struct { Id int64 Result *DashboardRef }
type GetDashboardSnapshotQuery ¶
type GetDashboardSnapshotQuery struct { Key string DeleteKey string Result *DashboardSnapshot }
type GetDashboardSnapshotsQuery ¶
type GetDashboardSnapshotsQuery struct { Name string Limit int OrgId int64 SignedInUser *SignedInUser Result DashboardSnapshotsList }
type GetDashboardTagsQuery ¶
type GetDashboardTagsQuery struct { OrgId int64 Result []*DashboardTagCloudItem }
type GetDashboardVersionQuery ¶
type GetDashboardVersionQuery struct { DashboardId int64 OrgId int64 Version int Result *DashboardVersion }
type GetDashboardVersionsQuery ¶
type GetDashboardVersionsQuery struct { DashboardId int64 OrgId int64 Limit int Start int Result []*DashboardVersionDTO }
type GetDashboardsQuery ¶
type GetDataSourceAccessStatsQuery ¶
type GetDataSourceAccessStatsQuery struct {
Result []*DataSourceAccessStats
}
type GetDataSourceQuery ¶
type GetDataSourceQuery struct { Id int64 Uid string Name string OrgId int64 Result *DataSource }
GetDataSourceQuery will get a DataSource based on OrgID as well as the UID (preferred), ID, or Name. At least one of the UID, ID, or Name properties must be set in addition to OrgID.
type GetDataSourceStatsQuery ¶
type GetDataSourceStatsQuery struct {
Result []*DataSourceStats
}
type GetDataSourcesByTypeQuery ¶
type GetDataSourcesByTypeQuery struct { Type string Result []*DataSource }
type GetDataSourcesQuery ¶
type GetDataSourcesQuery struct { OrgId int64 DataSourceLimit int User *SignedInUser Result []*DataSource }
type GetDefaultDataSourceQuery ¶
type GetDefaultDataSourceQuery struct { OrgId int64 User *SignedInUser Result *DataSource }
type GetExternalUserInfoByLoginQuery ¶
type GetExternalUserInfoByLoginQuery struct { LoginOrEmail string Result *ExternalUserInfo }
type GetGlobalQuotaByTargetQuery ¶
type GetGlobalQuotaByTargetQuery struct { Target string Default int64 Result *GlobalQuotaDTO }
type GetOrCreateNotificationStateQuery ¶
type GetOrCreateNotificationStateQuery struct { OrgId int64 AlertId int64 NotifierId int64 Result *AlertNotificationState }
type GetOrgByIdQuery ¶
type GetOrgByNameQuery ¶
type GetOrgQuotaByTargetQuery ¶
type GetOrgQuotaByTargetQuery struct { Target string OrgId int64 Default int64 Result *OrgQuotaDTO }
type GetOrgQuotasQuery ¶
type GetOrgQuotasQuery struct { OrgId int64 Result []*OrgQuotaDTO }
type GetOrgUsersQuery ¶
type GetOrgUsersQuery struct { OrgId int64 Query string Limit int Result []*OrgUserDTO }
type GetPlaylistByIdQuery ¶
type GetPlaylistItemsByIdQuery ¶
type GetPlaylistItemsByIdQuery struct { PlaylistId int64 Result *[]PlaylistItem }
type GetPlaylistsQuery ¶
type GetPluginSettingByIdQuery ¶
type GetPluginSettingByIdQuery struct { PluginId string OrgId int64 Result *PluginSetting }
type GetPluginSettingsQuery ¶
type GetPluginSettingsQuery struct { OrgId int64 Result []*PluginSettingInfoDTO }
--------------------- QUERIES
type GetPreferencesQuery ¶
type GetPreferencesQuery struct { Id int64 OrgId int64 UserId int64 TeamId int64 Result *Preferences }
type GetPreferencesWithDefaultsQuery ¶
type GetPreferencesWithDefaultsQuery struct { User *SignedInUser Result *Preferences }
type GetProvisionedDashboardDataByIdQuery ¶
type GetProvisionedDashboardDataByIdQuery struct { DashboardId int64 Result *DashboardProvisioning }
type GetProvisionedDashboardDataQuery ¶
type GetProvisionedDashboardDataQuery struct { Name string Result []*DashboardProvisioning }
type GetSignedInUserQuery ¶
type GetSignedInUserQuery struct { UserId int64 Login string Email string OrgId int64 Result *SignedInUser }
type GetSystemStatsQuery ¶
type GetSystemStatsQuery struct {
Result *SystemStats
}
type GetSystemUserCountStatsQuery ¶
type GetSystemUserCountStatsQuery struct {
Result *SystemUserCountStats
}
type GetTeamByIdQuery ¶
type GetTeamMembersQuery ¶
type GetTeamMembersQuery struct { OrgId int64 TeamId int64 UserId int64 External bool Result []*TeamMemberDTO }
type GetTeamsByUserQuery ¶
type GetTeamsForLDAPGroupCommand ¶
type GetTeamsForLDAPGroupCommand struct { Groups []string Result []TeamOrgGroupDTO }
type GetTempUserByCodeQuery ¶
type GetTempUserByCodeQuery struct { Code string Result *TempUserDTO }
type GetTempUsersQuery ¶
type GetTempUsersQuery struct { OrgId int64 Email string Status TempUserStatus Result []*TempUserDTO }
type GetUserByAuthInfoQuery ¶
type GetUserByAuthInfoQuery struct { AuthModule string AuthId string UserLookupParams Result *User }
type GetUserByEmailQuery ¶
type GetUserByIdQuery ¶
type GetUserByLoginQuery ¶
type GetUserOrgListQuery ¶
type GetUserOrgListQuery struct { UserId int64 Result []*UserOrgDTO }
type GetUserProfileQuery ¶
type GetUserProfileQuery struct { UserId int64 Result UserProfileDTO }
type GetUserQuotaByTargetQuery ¶
type GetUserQuotaByTargetQuery struct { Target string UserId int64 Default int64 Result *UserQuotaDTO }
type GetUserQuotasQuery ¶
type GetUserQuotasQuery struct { UserId int64 Result []*UserQuotaDTO }
type GetUserStarsQuery ¶
type GlobalQuotaDTO ¶
type HasAdminPermissionInFoldersQuery ¶
type HasAdminPermissionInFoldersQuery struct { SignedInUser *SignedInUser Result bool }
type HasEditPermissionInFoldersQuery ¶
type HasEditPermissionInFoldersQuery struct { SignedInUser *SignedInUser Result bool }
type HelpFlags1 ¶
type HelpFlags1 uint64
const ( HelpFlagGettingStartedPanelDismissed HelpFlags1 = 1 << iota HelpFlagDashboardHelp1 )
func (*HelpFlags1) AddFlag ¶
func (f *HelpFlags1) AddFlag(flag HelpFlags1)
func (HelpFlags1) HasFlag ¶
func (f HelpFlags1) HasFlag(flag HelpFlags1) bool
type InsertSQLTestDataCommand ¶
type InsertSQLTestDataCommand struct { }
type IsAdminOfTeamsQuery ¶
type IsAdminOfTeamsQuery struct { SignedInUser *SignedInUser Result bool }
type IsStarredByUserQuery ¶
type LicenseEnvironment ¶
type Licensing ¶
type Licensing interface { // HasValidLicense is true if a valid license exists HasValidLicense() bool // HasLicense is true if there is a license provided HasLicense() bool // Expiry returns the unix epoch timestamp when the license expires, or 0 if no valid license is provided Expiry() int64 // Return edition Edition() string // Used to build content delivery URL ContentDeliveryPrefix() string LicenseURL(user *SignedInUser) string StateInfo() string }
type LoginAttempt ¶
type LoginUserQuery ¶
type Measurement ¶
type Measurement struct { // Name of the measurement. Name string `json:"name,omitempty"` // Time is the measurement time. Units are usually ms, but depends on the channel Time int64 `json:"time,omitempty"` // Values is the measurement's values. The value type is typically number or string. Values map[string]interface{} `json:"values,omitempty"` // Config is an optional list of field configs. Config map[string]data.FieldConfig `json:"config,omitempty"` // Labels are applied to all values. Labels map[string]string `json:"labels,omitempty"` }
Measurement is a single measurement value.
type MeasurementAction ¶
type MeasurementAction string
MeasurementAction defines what should happen when you send a list of measurements.
type MeasurementBatch ¶
type MeasurementBatch struct { // Action is the action in question, the default is append. Action MeasurementAction `json:"action,omitempty"` // Measurements is the array of measurements. Measurements []Measurement `json:"measurements,omitempty"` // Capacity is the suggested size of the client buffer Capacity int64 `json:"capacity,omitempty"` }
MeasurementBatch is a collection of measurements all sent at once.
type NoDataOption ¶
type NoDataOption string
const ( NoDataSetOK NoDataOption = "ok" NoDataSetNoData NoDataOption = "no_data" NoDataKeepState NoDataOption = "keep_state" NoDataSetAlerting NoDataOption = "alerting" )
func (NoDataOption) IsValid ¶
func (s NoDataOption) IsValid() bool
func (NoDataOption) ToAlertState ¶
func (s NoDataOption) ToAlertState() AlertStateType
type NotifierUsageStats ¶
type OrgDetailsDTO ¶
type OrgQuotaDTO ¶
type OrgUserDTO ¶
type OrgUserDTO struct { OrgId int64 `json:"orgId"` UserId int64 `json:"userId"` Email string `json:"email"` Name string `json:"name"` AvatarUrl string `json:"avatarUrl"` Login string `json:"login"` Role string `json:"role"` LastSeenAt time.Time `json:"lastSeenAt"` LastSeenAtAge string `json:"lastSeenAtAge"` }
type PauseAlertCommand ¶
type PauseAllAlertCommand ¶
type PermissionType ¶
type PermissionType int
const ( PERMISSION_VIEW PermissionType = 1 << iota PERMISSION_EDIT PERMISSION_ADMIN )
func (PermissionType) String ¶
func (p PermissionType) String() string
type Playlist ¶
type Playlist struct { Id int64 `json:"id"` Name string `json:"name"` Interval string `json:"interval"` OrgId int64 `json:"-"` }
Playlist model
type PlaylistDTO ¶
type PlaylistDTO struct { Id int64 `json:"id"` Name string `json:"name"` Interval string `json:"interval"` OrgId int64 `json:"-"` Items []PlaylistItemDTO `json:"items"` }
type PlaylistItem ¶
type PlaylistItemDTO ¶
type PluginRequestValidator ¶
type PluginRequestValidator interface { // Validate performs a request validation based // on the data source URL and some of the request // attributes (headers, cookies, etc). Validate(dsURL string, req *http.Request) error }
var RequestValidator PluginRequestValidator = &validations.OSSPluginRequestValidator{}
type PluginSetting ¶
type PluginSetting struct { Id int64 PluginId string OrgId int64 Enabled bool Pinned bool JsonData map[string]interface{} SecureJsonData securejsondata.SecureJsonData PluginVersion string Created time.Time Updated time.Time }
func (*PluginSetting) DecryptedValues ¶
func (ps *PluginSetting) DecryptedValues() map[string]string
DecryptedValues returns cached decrypted values from secureJsonData.
type PluginSettingInfoDTO ¶
type PluginStateChangedEvent ¶
type Preferences ¶
type QuotaScope ¶
type RemoveOrgUserCommand ¶
type RemoveTeamMemberCommand ¶
type ReqContext ¶
type ReqContext struct { *macaron.Context *SignedInUser UserToken *UserToken IsSignedIn bool IsRenderCall bool AllowAnonymous bool SkipCache bool Logger log.Logger // RequestNonce is a cryptographic request identifier for use with Content Security Policy. RequestNonce string }
func (*ReqContext) HasHelpFlag ¶
func (ctx *ReqContext) HasHelpFlag(flag HelpFlags1) bool
func (*ReqContext) HasUserRole ¶
func (ctx *ReqContext) HasUserRole(role RoleType) bool
func (*ReqContext) IsApiRequest ¶
func (ctx *ReqContext) IsApiRequest() bool
func (*ReqContext) JsonApiErr ¶
func (ctx *ReqContext) JsonApiErr(status int, message string, err error)
func (*ReqContext) TimeRequest ¶
func (ctx *ReqContext) TimeRequest(timer prometheus.Summary)
type RequestURIKey ¶
type RequestURIKey struct{}
RequestURIKey is used as key to save request URI in contexts (used for the Enterprise auditing feature)
type RevokeAuthTokenCmd ¶
type RevokeAuthTokenCmd struct {
AuthTokenId int64 `json:"authTokenId"`
}
type RoundTripperFunc ¶
type SQLTestData ¶
type SaveAlertsCommand ¶
type SaveDashboardCommand ¶
type SaveDashboardCommand struct { Dashboard *simplejson.Json `json:"dashboard" binding:"Required"` UserId int64 `json:"userId"` Overwrite bool `json:"overwrite"` Message string `json:"message"` OrgId int64 `json:"-"` RestoredFrom int `json:"-"` PluginId string `json:"-"` FolderId int64 `json:"folderId"` IsFolder bool `json:"isFolder"` UpdatedAt time.Time Result *Dashboard }
func (*SaveDashboardCommand) GetDashboardModel ¶
func (cmd *SaveDashboardCommand) GetDashboardModel() *Dashboard
GetDashboardModel turns the command into the saveable model
type SavePreferencesCommand ¶
type SavePreferencesCommand struct { UserId int64 OrgId int64 TeamId int64 HomeDashboardId int64 `json:"homeDashboardId"` Timezone string `json:"timezone"` Theme string `json:"theme"` }
--------------------- COMMANDS
type SaveProvisionedDashboardCommand ¶
type SaveProvisionedDashboardCommand struct { DashboardCmd *SaveDashboardCommand DashboardProvisioning *DashboardProvisioning Result *Dashboard }
type SearchOrgsQuery ¶
type SearchTeamQueryResult ¶
type SearchTeamsQuery ¶
type SearchTeamsQuery struct { Query string Name string Limit int Page int OrgId int64 UserIdFilter int64 SignedInUser *SignedInUser HiddenUsers map[string]struct{} Result SearchTeamQueryResult }
type SearchUserQueryResult ¶
type SearchUserQueryResult struct { TotalCount int64 `json:"totalCount"` Users []*UserSearchHitDTO `json:"users"` Page int `json:"page"` PerPage int `json:"perPage"` }
type SearchUsersQuery ¶
type SendEmailAttachFile ¶
SendEmailAttachFile is a definition of the attached files without path
type SendEmailCommand ¶
type SendEmailCommand struct { To []string SingleEmail bool Template string Subject string Data map[string]interface{} Info string ReplyTo []string EmbeddedFiles []string AttachedFiles []*SendEmailAttachFile }
SendEmailCommand is command for sending emails
type SendEmailCommandSync ¶
type SendEmailCommandSync struct {
SendEmailCommand
}
SendEmailCommandSync is command for sending emails in sync
type SendResetPasswordEmailCommand ¶
type SendResetPasswordEmailCommand struct {
User *User
}
type SendWebhookSync ¶
type SetAlertStateCommand ¶
type SetAlertStateCommand struct { AlertId int64 OrgId int64 State AlertStateType Error string EvalData *simplejson.Json Result Alert }
type SetAuthInfoCommand ¶
type SetUserHelpFlagCommand ¶
type SetUserHelpFlagCommand struct { HelpFlags1 HelpFlags1 UserId int64 }
type SetUsingOrgCommand ¶
type SignedInUser ¶
type SignedInUser struct { UserId int64 OrgId int64 OrgName string OrgRole RoleType Login string Name string Email string ApiKeyId int64 OrgCount int IsGrafanaAdmin bool IsAnonymous bool HelpFlags1 HelpFlags1 LastSeenAt time.Time Teams []int64 }
func (*SignedInUser) HasRole ¶
func (u *SignedInUser) HasRole(role RoleType) bool
func (*SignedInUser) IsRealUser ¶
func (u *SignedInUser) IsRealUser() bool
func (*SignedInUser) NameOrFallback ¶
func (u *SignedInUser) NameOrFallback() string
func (*SignedInUser) ShouldUpdateLastSeenAt ¶
func (u *SignedInUser) ShouldUpdateLastSeenAt() bool
type StarDashboardCommand ¶
type SystemStats ¶
type SystemStats struct { Dashboards int64 Datasources int64 Users int64 ActiveUsers int64 Orgs int64 Playlists int64 Alerts int64 Stars int64 Snapshots int64 Teams int64 DashboardPermissions int64 FolderPermissions int64 Folders int64 ProvisionedDashboards int64 AuthTokens int64 DashboardVersions int64 Annotations int64 Admins int Editors int Viewers int ActiveAdmins int ActiveEditors int ActiveViewers int ActiveSessions int }
type SystemUserCountStats ¶
type SystemUserCountStats struct {
Count int64
}
type Tag ¶
func ParseTagPairs ¶
type Team ¶
type Team struct { Id int64 `json:"id"` OrgId int64 `json:"orgId"` Name string `json:"name"` Email string `json:"email"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` }
Team model
type TeamMember ¶
type TeamMember struct { Id int64 OrgId int64 TeamId int64 UserId int64 External bool // Signals that the membership has been created by an external systems, such as LDAP Permission PermissionType Created time.Time Updated time.Time }
TeamMember model
type TeamMemberDTO ¶
type TeamMemberDTO struct { OrgId int64 `json:"orgId"` TeamId int64 `json:"teamId"` UserId int64 `json:"userId"` External bool `json:"-"` AuthModule string `json:"auth_module"` Email string `json:"email"` Name string `json:"name"` Login string `json:"login"` AvatarUrl string `json:"avatarUrl"` Labels []string `json:"labels"` Permission PermissionType `json:"permission"` }
type TeamOrgGroupDTO ¶
type TempUser ¶
type TempUser struct { Id int64 OrgId int64 Version int Email string Name string Role RoleType InvitedByUserId int64 Status TempUserStatus EmailSent bool EmailSentOn time.Time Code string RemoteAddr string Created int64 Updated int64 }
TempUser holds data for org invites and unconfirmed sign ups
type TempUserDTO ¶
type TempUserDTO struct { Id int64 `json:"id"` OrgId int64 `json:"orgId"` Name string `json:"name"` Email string `json:"email"` Role RoleType `json:"role"` InvitedByLogin string `json:"invitedByLogin"` InvitedByEmail string `json:"invitedByEmail"` InvitedByName string `json:"invitedByName"` Code string `json:"code"` Status TempUserStatus `json:"status"` Url string `json:"url"` EmailSent bool `json:"emailSent"` EmailSentOn time.Time `json:"emailSentOn"` Created time.Time `json:"createdOn"` }
type TempUserStatus ¶
type TempUserStatus string
const ( TmpUserSignUpStarted TempUserStatus = "SignUpStarted" TmpUserInvitePending TempUserStatus = "InvitePending" TmpUserCompleted TempUserStatus = "Completed" TmpUserRevoked TempUserStatus = "Revoked" TmpUserExpired TempUserStatus = "Expired" )
type TokenExpiredError ¶
func (*TokenExpiredError) Error ¶
func (e *TokenExpiredError) Error() string
type TokenRevokedError ¶
func (*TokenRevokedError) Error ¶
func (e *TokenRevokedError) Error() string
type UnprovisionDashboardCommand ¶
type UnprovisionDashboardCommand struct {
Id int64
}
type UnstarDashboardCommand ¶
type UpdateAlertNotificationCommand ¶
type UpdateAlertNotificationCommand struct { Id int64 `json:"id" binding:"Required"` Uid string `json:"uid"` Name string `json:"name" binding:"Required"` Type string `json:"type" binding:"Required"` SendReminder bool `json:"sendReminder"` DisableResolveMessage bool `json:"disableResolveMessage"` Frequency string `json:"frequency"` IsDefault bool `json:"isDefault"` Settings *simplejson.Json `json:"settings" binding:"Required"` SecureSettings map[string]string `json:"secureSettings"` OrgId int64 `json:"-"` Result *AlertNotification }
type UpdateAlertNotificationWithUidCommand ¶
type UpdateAlertNotificationWithUidCommand struct { Uid string `json:"-"` NewUid string `json:"uid"` Name string `json:"name" binding:"Required"` Type string `json:"type" binding:"Required"` SendReminder bool `json:"sendReminder"` DisableResolveMessage bool `json:"disableResolveMessage"` Frequency string `json:"frequency"` IsDefault bool `json:"isDefault"` Settings *simplejson.Json `json:"settings" binding:"Required"` SecureSettings map[string]string `json:"secureSettings"` OrgId int64 Result *AlertNotification }
type UpdateAuthInfoCommand ¶
type UpdateDashboardAclCommand ¶
type UpdateDashboardAclCommand struct { DashboardID int64 Items []*DashboardAcl }
type UpdateDashboardAlertsCommand ¶
type UpdateDashboardAlertsCommand struct { OrgId int64 Dashboard *Dashboard User *SignedInUser }
type UpdateDataSourceCommand ¶
type UpdateDataSourceCommand struct { Name string `json:"name" binding:"Required"` Type string `json:"type" binding:"Required"` Access DsAccess `json:"access" binding:"Required"` Url string `json:"url"` Password string `json:"password"` User string `json:"user"` Database string `json:"database"` BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"` BasicAuthPassword string `json:"basicAuthPassword"` WithCredentials bool `json:"withCredentials"` IsDefault bool `json:"isDefault"` JsonData *simplejson.Json `json:"jsonData"` SecureJsonData map[string]string `json:"secureJsonData"` Version int `json:"version"` Uid string `json:"uid"` OrgId int64 `json:"-"` Id int64 `json:"-"` ReadOnly bool `json:"-"` Result *DataSource }
Also acts as api DTO
type UpdateFolderCommand ¶
type UpdateFolderCommand struct { Uid string `json:"uid"` Title string `json:"title"` Version int `json:"version"` Overwrite bool `json:"overwrite"` Result *Folder }
func (*UpdateFolderCommand) UpdateDashboardModel ¶
func (cmd *UpdateFolderCommand) UpdateDashboardModel(dashFolder *Dashboard, orgId int64, userId int64)
UpdateDashboardModel updates an existing model from command into model for update
type UpdateOrgAddressCommand ¶
type UpdateOrgCommand ¶
type UpdateOrgQuotaCmd ¶
type UpdateOrgUserCommand ¶
type UpdatePlaylistCommand ¶
type UpdatePlaylistCommand struct { OrgId int64 `json:"-"` Id int64 `json:"id"` Name string `json:"name" binding:"Required"` Interval string `json:"interval"` Items []PlaylistItemDTO `json:"items"` Result *PlaylistDTO }
type UpdatePluginDashboardError ¶
type UpdatePluginDashboardError struct {
PluginId string
}
func (UpdatePluginDashboardError) Error ¶
func (d UpdatePluginDashboardError) Error() string
type UpdatePluginSettingCmd ¶
type UpdatePluginSettingCmd struct { Enabled bool `json:"enabled"` Pinned bool `json:"pinned"` JsonData map[string]interface{} `json:"jsonData"` SecureJsonData map[string]string `json:"secureJsonData"` PluginVersion string `json:"version"` PluginId string `json:"-"` OrgId int64 `json:"-"` }
Also acts as api DTO
func (*UpdatePluginSettingCmd) GetEncryptedJsonData ¶
func (cmd *UpdatePluginSettingCmd) GetEncryptedJsonData() securejsondata.SecureJsonData
type UpdatePluginSettingVersionCmd ¶
type UpdatePluginSettingVersionCmd struct { PluginVersion string PluginId string `json:"-"` OrgId int64 `json:"-"` }
specific command, will only update version
type UpdateTeamCommand ¶
type UpdateTeamMemberCommand ¶
type UpdateTeamMemberCommand struct { UserId int64 `json:"-"` OrgId int64 `json:"-"` TeamId int64 `json:"-"` Permission PermissionType `json:"permission"` ProtectLastAdmin bool `json:"-"` }
type UpdateTempUserStatusCommand ¶
type UpdateTempUserStatusCommand struct { Code string Status TempUserStatus }
type UpdateTempUserWithEmailSentCommand ¶
type UpdateTempUserWithEmailSentCommand struct {
Code string
}
type UpdateUserCommand ¶
type UpdateUserLastSeenAtCommand ¶
type UpdateUserLastSeenAtCommand struct {
UserId int64
}
type UpdateUserQuotaCmd ¶
type UpsertUserCommand ¶
type UpsertUserCommand struct { ReqContext *ReqContext ExternalUser *ExternalUserInfo UserLookupParams Result *User SignupAllowed bool }
type User ¶
type User struct { Id int64 Version int Email string Name string Login string Password string Salt string Rands string Company string EmailVerified bool Theme string HelpFlags1 HelpFlags1 IsDisabled bool IsAdmin bool OrgId int64 Created time.Time Updated time.Time LastSeenAt time.Time }
func (*User) NameOrFallback ¶
type UserLookupParams ¶
type UserOrgDTO ¶
type UserProfileDTO ¶
type UserProfileDTO struct { Id int64 `json:"id"` Email string `json:"email"` Name string `json:"name"` Login string `json:"login"` Theme string `json:"theme"` OrgId int64 `json:"orgId"` IsGrafanaAdmin bool `json:"isGrafanaAdmin"` IsDisabled bool `json:"isDisabled"` IsExternal bool `json:"isExternal"` AuthLabels []string `json:"authLabels"` UpdatedAt time.Time `json:"updatedAt"` CreatedAt time.Time `json:"createdAt"` AvatarUrl string `json:"avatarUrl"` }
type UserQuotaDTO ¶
type UserSearchHitDTO ¶
type UserSearchHitDTO struct { Id int64 `json:"id"` Name string `json:"name"` Login string `json:"login"` Email string `json:"email"` AvatarUrl string `json:"avatarUrl"` IsAdmin bool `json:"isAdmin"` IsDisabled bool `json:"isDisabled"` LastSeenAt time.Time `json:"lastSeenAt"` LastSeenAtAge string `json:"lastSeenAtAge"` AuthLabels []string `json:"authLabels"` AuthModule AuthModuleConversion `json:"-"` }
type UserToken ¶
type UserToken struct { Id int64 UserId int64 AuthToken string PrevAuthToken string UserAgent string ClientIp string AuthTokenSeen bool SeenAt int64 RotatedAt int64 CreatedAt int64 UpdatedAt int64 RevokedAt int64 UnhashedToken string }
UserToken represents a user token
type UserTokenService ¶
type UserTokenService interface { CreateToken(ctx context.Context, user *User, clientIP net.IP, userAgent string) (*UserToken, error) LookupToken(ctx context.Context, unhashedToken string) (*UserToken, error) TryRotateToken(ctx context.Context, token *UserToken, clientIP net.IP, userAgent string) (bool, error) RevokeToken(ctx context.Context, token *UserToken, soft bool) error RevokeAllUserTokens(ctx context.Context, userId int64) error ActiveTokenCount(ctx context.Context) (int64, error) GetUserToken(ctx context.Context, userId, userTokenId int64) (*UserToken, error) GetUserTokens(ctx context.Context, userId int64) ([]*UserToken, error) GetUserRevokedTokens(ctx context.Context, userId int64) ([]*UserToken, error) }
UserTokenService are used for generating and validating user tokens
type ValidateDashboardAlertsCommand ¶
type ValidateDashboardAlertsCommand struct { UserId int64 OrgId int64 Dashboard *Dashboard User *SignedInUser }
type ValidateDashboardBeforeSaveCommand ¶
type ValidateDashboardBeforeSaveCommand struct { OrgId int64 Dashboard *Dashboard Overwrite bool Result *ValidateDashboardBeforeSaveResult }
type ValidateDashboardBeforeSaveResult ¶
type ValidateDashboardBeforeSaveResult struct {
IsParentFolderChanged bool
}
Source Files ¶
- address.go
- alert.go
- alert_notifications.go
- apikey.go
- context.go
- dashboard_acl.go
- dashboard_snapshot.go
- dashboard_version.go
- dashboards.go
- datasource.go
- datasource_cache.go
- folders.go
- health.go
- helpflags.go
- licensing.go
- live.go
- login_attempt.go
- measurement.go
- models.go
- notifications.go
- org.go
- org_user.go
- playlist.go
- plugin_setting_cache.go
- plugin_settings.go
- preferences.go
- quotas.go
- shorturl.go
- star.go
- stats.go
- tags.go
- team.go
- team_member.go
- temp_user.go
- test_data.go
- user.go
- user_auth.go
- user_token.go
- validations.go