models

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: 22 Imported by: 5,239

Documentation

Index

Constants

View Source
const (
	DashTypeDB       = "db"
	DashTypeSnapshot = "snapshot"
)
View Source
const (
	DS_GRAPHITE       = "graphite"
	DS_INFLUXDB       = "influxdb"
	DS_INFLUXDB_08    = "influxdb_08"
	DS_ES             = "elasticsearch"
	DS_PROMETHEUS     = "prometheus"
	DS_ALERTMANAGER   = "alertmanager"
	DS_JAEGER         = "jaeger"
	DS_LOKI           = "loki"
	DS_OPENTSDB       = "opentsdb"
	DS_TEMPO          = "tempo"
	DS_ZIPKIN         = "zipkin"
	DS_MYSQL          = "mysql"
	DS_POSTGRES       = "postgres"
	DS_MSSQL          = "mssql"
	DS_ACCESS_DIRECT  = "direct"
	DS_ACCESS_PROXY   = "proxy"
	DS_ES_OPEN_DISTRO = "grafana-es-open-distro-datasource"
	DS_ES_OPENSEARCH  = "grafana-opensearch-datasource"
)
View Source
const (
	AuthModuleLDAP = "ldap"
)
View Source
const DashboardVersionForManualThumbnailUpload = -1
View Source
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

View Source
const LibraryElementConnectionTableName = "library_element_connection"
View Source
const RootFolderName = "General"

Variables

View Source
var (
	ErrCannotChangeStateOnPausedAlert = fmt.Errorf("cannot change state on pause alert")
	ErrRequiresNewState               = fmt.Errorf("update alert state requires a new state")
)
View Source
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")
)
View Source
var (
	AlertNotificationStatePending   = AlertNotificationStateType("pending")
	AlertNotificationStateCompleted = AlertNotificationStateType("completed")
	AlertNotificationStateUnknown   = AlertNotificationStateType("unknown")
)
View Source
var (
	ErrApiKeyNotFound          = errors.New("API key not found")
	ErrInvalidApiKey           = errors.New("invalid API key")
	ErrInvalidApiKeyExpiration = errors.New("negative value for SecondsToLive")
	ErrDuplicateApiKey         = errors.New("API key, organization ID and name must be unique")
)
View Source
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("permissions cannot have both a user and team")
	ErrPermissionsWithUserAndTeamNotAllowed = errors.New("team and user permissions cannot have an associated role")
)

Typed errors

View Source
var (
	ErrDashboardVersionNotFound = errors.New("dashboard version not found")
	ErrNoVersionsForDashboardId = errors.New("no dashboard versions found for the given DashboardId")
)
View Source
var (
	ErrDashboardNotFound = DashboardErr{
		Reason:     "Dashboard not found",
		StatusCode: 404,
		Status:     "not-found",
	}
	ErrDashboardCorrupt = DashboardErr{
		Reason:     "Dashboard data is missing or corrupt",
		StatusCode: 500,
		Status:     "not-found",
	}
	ErrDashboardPanelNotFound = DashboardErr{
		Reason:     "Dashboard panel 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,
		Status:     "empty-name",
	}
	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,
		Status:     "name-match",
	}
	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,
	}
	ErrDashboardIdentifierInvalid = DashboardErr{
		Reason:     "Dashboard ID not a number",
		StatusCode: 400,
	}
	ErrDashboardPanelIdentifierInvalid = DashboardErr{
		Reason:     "Dashboard panel ID not a number",
		StatusCode: 400,
	}
	ErrDashboardOrPanelIdentifierNotSet = DashboardErr{
		Reason:     "Unique identifier needed to be able to get a dashboard panel",
		StatusCode: 400,
	}
	ErrProvisionedDashboardNotFound = DashboardErr{
		Reason:     "Dashboard is not provisioned",
		StatusCode: 404,
		Status:     "not-found",
	}
	ErrDashboardThumbnailNotFound = DashboardErr{
		Reason:     "Dashboard thumbnail not found",
		StatusCode: 404,
		Status:     "not-found",
	}
)

Typed errors

View Source
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")
)
View Source
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")
	ErrFolderInvalidUID              = errors.New("invalid uid for folder provided")
	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")
	ErrFolderContainsAlertRules      = errors.New("folder contains alert rules")
)

Typed errors

View Source
var (
	ErrOrgNotFound  = errors.New("organization not found")
	ErrOrgNameTaken = errors.New("organization name is taken")
)

Typed errors

View Source
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

View Source
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

View Source
var (
	ErrUserNotFound      = errors.New("user not found")
	ErrUserAlreadyExists = errors.New("user already exists")
	ErrLastGrafanaAdmin  = errors.New("cannot remove last grafana admin")
	ErrProtectedUser     = errors.New("cannot adopt protected user")
)

Typed errors

View Source
var ErrCommandValidationFailed = errors.New("command missing required fields")
View Source
var ErrInvalidEmailCode = errors.New("invalid or expired email code")
View Source
var ErrInvalidQuotaTarget = errors.New("invalid quota target")
View Source
var (
	ErrPlaylistNotFound = errors.New("Playlist not found")
)

Typed errors

View Source
var (
	ErrPluginSettingNotFound = errors.New("plugin setting not found")
)
View Source
var (
	ErrShortURLNotFound = errors.New("short URL not found")
)
View Source
var ErrSmtpNotEnabled = errors.New("SMTP not configured, check your grafana.ini config file's [smtp] section")
View Source
var (
	ErrTeamMemberAlreadyAdded = errors.New("User is already added to this team")
)

Typed errors

View Source
var (
	ErrTempUserNotFound = errors.New("User not found")
)

Typed errors

View Source
var (
	ErrUserTokenNotFound = errors.New("user token not found")
)

Typed errors

Functions

func ContainsTag

func ContainsTag(existingTags []*Tag, tag *Tag) bool

func GetDashboardFolderUrl

func GetDashboardFolderUrl(isFolder bool, uid string, slug string) string

GetDashboardFolderUrl return the html url for a folder if it's folder, otherwise for a dashboard

func GetDashboardUrl

func GetDashboardUrl(uid string, slug string) string

GetDashboardUrl returns the HTML url for a dashboard.

func GetFolderUrl

func GetFolderUrl(folderUid string, slug string) string

GetFolderUrl returns the HTML url for a folder.

func GetFullDashboardUrl

func GetFullDashboardUrl(uid string, slug string) string

GetFullDashboardUrl returns the full URL for a dashboard.

func GetKioskModeDashboardUrl

func GetKioskModeDashboardUrl(uid string, slug string, theme Theme) string

GetKioskModeDashboardUrl returns the HTML url for a dashboard in kiosk mode.

func JoinTagPairs

func JoinTagPairs(tags []*Tag) []string

func SlugifyTitle

func SlugifyTitle(title string) string

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:"-"`
	UserId                  int64             `json:"-"`
	ReadOnly                bool              `json:"-"`
	EncryptedSecureJsonData map[string][]byte `json:"-"`

	Result *DataSource `json:"-"`
}

Also acts as api DTO

type AddOrgUserCommand

type AddOrgUserCommand struct {
	LoginOrEmail string   `json:"loginOrEmail" binding:"Required"`
	Role         RoleType `json:"role" binding:"Required"`

	OrgId  int64 `json:"-"`
	UserId int64 `json:"-"`
}

type AddTeamMemberCommand

type AddTeamMemberCommand struct {
	UserId     int64          `json:"userId" binding:"Required"`
	OrgId      int64          `json:"-"`
	TeamId     int64          `json:"-"`
	External   bool           `json:"-"`
	Permission PermissionType `json:"-"`
}

type Address

type Address struct {
	Address1 string `json:"address1"`
	Address2 string `json:"address2"`
	City     string `json:"city"`
	ZipCode  string `json:"zipCode"`
	State    string `json:"state"`
	Country  string `json:"country"`
}

type AdminStats

type AdminStats struct {
	Orgs                int64 `json:"orgs"`
	Dashboards          int64 `json:"dashboards"`
	Snapshots           int64 `json:"snapshots"`
	Tags                int64 `json:"tags"`
	Datasources         int64 `json:"datasources"`
	Playlists           int64 `json:"playlists"`
	Stars               int64 `json:"stars"`
	Alerts              int64 `json:"alerts"`
	Users               int64 `json:"users"`
	Admins              int64 `json:"admins"`
	Editors             int64 `json:"editors"`
	Viewers             int64 `json:"viewers"`
	ActiveUsers         int64 `json:"activeUsers"`
	ActiveAdmins        int64 `json:"activeAdmins"`
	ActiveEditors       int64 `json:"activeEditors"`
	ActiveViewers       int64 `json:"activeViewers"`
	ActiveSessions      int64 `json:"activeSessions"`
	DailyActiveUsers    int64 `json:"dailyActiveUsers"`
	DailyActiveAdmins   int64 `json:"dailyActiveAdmins"`
	DailyActiveEditors  int64 `json:"dailyActiveEditors"`
	DailyActiveViewers  int64 `json:"dailyActiveViewers"`
	DailyActiveSessions int64 `json:"dailyActiveSessions"`
	MonthlyActiveUsers  int64 `json:"monthlyActiveUsers"`
}

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 (a *Alert) ContainsUpdates(other *Alert) bool

func (*Alert) GetTagsFromSettings

func (a *Alert) GetTagsFromSettings() []*Tag

func (*Alert) ValidToSave

func (a *Alert) ValidToSave() bool

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        map[string][]byte `json:"secureSettings"`
	Created               time.Time         `json:"created"`
	Updated               time.Time         `json:"updated"`
}

type AlertNotificationState

type AlertNotificationState struct {
	Id                           int64
	OrgId                        int64
	AlertId                      int64
	NotifierId                   int64
	State                        AlertNotificationStateType
	Version                      int64
	UpdatedAt                    int64
	AlertRuleStateUpdatedVersion int64
}

type AlertNotificationStateType

type AlertNotificationStateType string

type AlertStateInfoDTO

type AlertStateInfoDTO struct {
	Id           int64          `json:"id"`
	DashboardId  int64          `json:"dashboardId"`
	PanelId      int64          `json:"panelId"`
	State        AlertStateType `json:"state"`
	NewStateDate time.Time      `json:"newStateDate"`
}

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 ApiKey

type ApiKey struct {
	Id               int64
	OrgId            int64
	Name             string
	Key              string
	Role             RoleType
	Created          time.Time
	Updated          time.Time
	Expires          *int64
	ServiceAccountId *int64
}

type ApiKeyDTO

type ApiKeyDTO struct {
	Id         int64      `json:"id"`
	Name       string     `json:"name"`
	Role       RoleType   `json:"role"`
	Expiration *time.Time `json:"expiration,omitempty"`
}

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 BatchDisableUsersCommand

type BatchDisableUsersCommand struct {
	UserIds    []int64
	IsDisabled bool
}

type ChangeUserPasswordCommand

type ChangeUserPasswordCommand struct {
	OldPassword string `json:"oldPassword"`
	NewPassword string `json:"newPassword"`

	UserId int64 `json:"-"`
}

type ChannelClientCount

type ChannelClientCount func(orgID int64, channel string) (int, error)

ChannelClientCount will return the number of clients for a channel

type ChannelHandler

type ChannelHandler interface {
	// OnSubscribe is called when a client wants to subscribe to a channel
	OnSubscribe(ctx context.Context, user *SignedInUser, e SubscribeEvent) (SubscribeReply, backend.SubscribeStreamStatus, error)

	// OnPublish is called when a client writes a message to the channel websocket.
	OnPublish(ctx context.Context, user *SignedInUser, e PublishEvent) (PublishReply, backend.PublishStreamStatus, 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

type ChannelPublisher func(orgID int64, channel string, data []byte) error

ChannelPublisher writes data into a channel. Note that permissions are not checked.

type CrawlerMode

type CrawlerMode string

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:"-"`
	EncryptedSecureSettings map[string][]byte `json:"-"`

	Result *AlertNotification `json:"-"`
}

type CreateDashboardSnapshotCommand

type CreateDashboardSnapshotCommand struct {
	// The complete dashboard model.
	// required:true
	Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
	// Snapshot name
	// required:false
	Name string `json:"name"`
	// When the snapshot should expire in seconds in seconds. Default is never to expire.
	// required:false
	// default:0
	Expires int64 `json:"expires"`

	// these are passed when storing an external snapshot ref
	// Save the snapshot on an external server rather than locally.
	// required:false
	// default: false
	External          bool   `json:"external"`
	ExternalUrl       string `json:"-"`
	ExternalDeleteUrl string `json:"-"`

	// Define the unique key. Required if `external` is `true`.
	// required:false
	Key string `json:"key"`
	// Unique key used to delete the snapshot. It is different from the `key` so that only the creator can delete the snapshot. Required if `external` is `true`.
	// required:false
	DeleteKey string `json:"deleteKey"`

	OrgId  int64 `json:"-"`
	UserId int64 `json:"-"`

	DashboardEncrypted []byte `json:"-"`

	Result *DashboardSnapshot
}

swagger:model

type CreateFolderCommand

type CreateFolderCommand struct {
	Uid   string `json:"uid"`
	Title string `json:"title"`

	Result *Folder `json:"-"`
}

type CreateLoginAttemptCommand

type CreateLoginAttemptCommand struct {
	Username  string
	IpAddress string

	Result LoginAttempt
}

type CreateOrgCommand

type CreateOrgCommand struct {
	Name string `json:"name" binding:"Required"`

	// initial admin user for account
	UserId int64 `json:"-"`
	Result Org   `json:"-"`
}

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 CreateTeamCommand struct {
	Name  string `json:"name" binding:"Required"`
	Email string `json:"email"`
	OrgId int64  `json:"-"`

	Result Team `json:"-"`
}

type CreateTempUserCommand

type CreateTempUserCommand struct {
	Email           string
	Name            string
	OrgId           int64
	InvitedByUserId int64
	Status          TempUserStatus
	Code            string
	Role            RoleType
	RemoteAddr      string

	Result *TempUser
}

type CreateTokenErr

type CreateTokenErr struct {
	StatusCode  int
	InternalErr error
	ExternalErr string
}

CreateTokenErr represents a token creation error; used in Enterprise

func (*CreateTokenErr) Error

func (e *CreateTokenErr) Error() string

type CreateUserCommand

type CreateUserCommand struct {
	Email            string
	Login            string
	Name             string
	Company          string
	OrgId            int64
	OrgName          string
	Password         string
	EmailVerified    bool
	IsAdmin          bool
	IsDisabled       bool
	SkipOrgSetup     bool
	DefaultOrgRole   string
	IsServiceAccount bool

	Result User
}

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 NewDashboard

func NewDashboard(title string) *Dashboard

NewDashboard creates a new dashboard

func NewDashboardFolder

func NewDashboardFolder(title string) *Dashboard

NewDashboardFolder creates a new dashboard folder

func NewDashboardFromJson

func NewDashboardFromJson(data *simplejson.Json) *Dashboard

func (*Dashboard) GetDashboardIdForSavePermissionCheck

func (d *Dashboard) GetDashboardIdForSavePermissionCheck() int64

GetDashboardIdForSavePermissionCheck return the dashboard id to be used for checking permission of dashboard

func (*Dashboard) GetTags

func (d *Dashboard) GetTags() []string

GetTags turns the tags in data json into go string array

func (*Dashboard) GetUrl

func (d *Dashboard) GetUrl() string

GetUrl return the html url for a folder if it's folder, otherwise for a dashboard

func (*Dashboard) SetId

func (d *Dashboard) SetId(id int64)

func (*Dashboard) SetUid

func (d *Dashboard) SetUid(uid string)

func (*Dashboard) SetVersion

func (d *Dashboard) SetVersion(version int)

func (*Dashboard) UpdateSlug

func (d *Dashboard) UpdateSlug()

UpdateSlug updates the slug

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 {
	// Called when a dashboard is saved -- this includes the error so we can support a
	// gitops workflow that knows if the value was saved to the local database or not
	// in many cases all direct save requests will fail, but the request should be forwarded
	// to any gitops observers
	DashboardSaved(orgID int64, user *UserDisplayDTO, message string, dashboard *Dashboard, err error) error

	// Called when a dashboard is deleted
	DashboardDeleted(orgID int64, user *UserDisplayDTO, uid string) error

	// Experimental! Indicate is GitOps is active.  This really means
	// someone is subscribed to the `grafana/dashboards/gitops` channel
	HasGitOpsObserver(orgID int64) bool
}

DashboardActivityChannel is a service to advertise dashboard activity

type DashboardErr

type DashboardErr struct {
	StatusCode int
	Status     string
	Reason     string
}

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.

func (DashboardErr) Error

func (e DashboardErr) Error() string

Error returns the error message.

type DashboardPermissionForUser

type DashboardPermissionForUser struct {
	DashboardId    int64          `json:"dashboardId"`
	Permission     PermissionType `json:"permission"`
	PermissionName string         `json:"permissionName"`
}

type DashboardProvisioning

type DashboardProvisioning struct {
	Id          int64
	DashboardId int64
	Name        string
	ExternalId  string
	CheckSum    string
	Updated     int64
}

type DashboardRef

type DashboardRef struct {
	Uid  string
	Slug string
}

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 []byte
}

DashboardSnapshot model

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 DashboardTagCloudItem struct {
	Term  string `json:"term"`
	Count int    `json:"count"`
}

type DashboardThumbnail

type DashboardThumbnail struct {
	Id               int64          `json:"id"`
	DashboardId      int64          `json:"dashboardId"`
	DashboardVersion int            `json:"dashboardVersion"`
	State            ThumbnailState `json:"state"`
	PanelId          int64          `json:"panelId,omitempty"`
	Kind             ThumbnailKind  `json:"kind"`
	Theme            Theme          `json:"theme"`
	Image            []byte         `json:"image"`
	MimeType         string         `json:"mimeType"`
	Updated          time.Time      `json:"updated"`
}

A DashboardThumbnail includes all metadata for a dashboard thumbnail

type DashboardThumbnailMeta

type DashboardThumbnailMeta struct {
	DashboardUID string
	OrgId        int64
	PanelID      int64
	Kind         ThumbnailKind
	Theme        Theme
}

DashboardThumbnailMeta uniquely identifies a thumbnail; a natural key

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 DashboardWithStaleThumbnail

type DashboardWithStaleThumbnail struct {
	Id      int64
	OrgId   int64
	Uid     string
	Version int
	Slug    string
}

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    map[string][]byte `json:"secureJsonData"`
	ReadOnly          bool              `json:"readOnly"`
	Uid               string            `json:"uid"`

	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
}

type DataSourceAccessStats

type DataSourceAccessStats struct {
	Type   string
	Access string
	Count  int64
}

type DataSourceStats

type DataSourceStats struct {
	Count int
	Type  string
}

type DatasourcesPermissionFilterQuery

type DatasourcesPermissionFilterQuery struct {
	User        *SignedInUser
	Datasources []*DataSource
	Result      []*DataSource
}

type DeleteAlertNotificationCommand

type DeleteAlertNotificationCommand struct {
	Id    int64
	OrgId int64
}

type DeleteAlertNotificationWithUidCommand

type DeleteAlertNotificationWithUidCommand struct {
	Uid   string
	OrgId int64

	DeletedAlertNotificationId int64
}

type DeleteApiKeyCommand

type DeleteApiKeyCommand struct {
	Id    int64 `json:"id"`
	OrgId int64 `json:"-"`
}

type DeleteAuthInfoCommand

type DeleteAuthInfoCommand struct {
	UserAuth *UserAuth
}

type DeleteDashboardCommand

type DeleteDashboardCommand struct {
	Id                     int64
	OrgId                  int64
	ForceDeleteFolderRules bool
}

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 DeleteOldLoginAttemptsCommand

type DeleteOldLoginAttemptsCommand struct {
	OlderThan   time.Time
	DeletedRows int64
}

type DeleteOrgCommand

type DeleteOrgCommand struct {
	Id int64
}

type DeleteOrphanedProvisionedDashboardsCommand

type DeleteOrphanedProvisionedDashboardsCommand struct {
	ReaderNames []string
}

type DeletePlaylistCommand

type DeletePlaylistCommand struct {
	Id    int64
	OrgId int64
}

type DeleteShortUrlCommand

type DeleteShortUrlCommand struct {
	OlderThan time.Time

	NumDeleted int64
}

type DeleteTeamCommand

type DeleteTeamCommand struct {
	OrgId int64
	Id    int64
}

type DeleteUserCommand

type DeleteUserCommand struct {
	UserId int64
}

type DisableUserCommand

type DisableUserCommand struct {
	UserId     int64
	IsDisabled bool
}

type DsAccess

type DsAccess string

type DsPermissionType

type DsPermissionType int

Datasource permission Description: * `0` - No Access * `1` - Query Enum: 0,1 swagger:model

const (
	DsPermissionNoAccess DsPermissionType = iota
	DsPermissionQuery
)

func (DsPermissionType) String

func (p DsPermissionType) String() string

type ExecutionErrorOption

type ExecutionErrorOption string
const (
	ExecutionErrorSetOk       ExecutionErrorOption = "ok"
	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 ExpireTempUsersCommand struct {
	OlderThan time.Time

	NumExpired int64
}

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 FakeJWTService

type FakeJWTService struct {
	VerifyProvider func(context.Context, string) (JWTClaims, error)
}

func NewFakeJWTService

func NewFakeJWTService() *FakeJWTService

func (*FakeJWTService) Verify

func (s *FakeJWTService) Verify(ctx context.Context, token string) (JWTClaims, error)

type Filter

type Filter interface {
	WhereCondition() *WhereCondition
	InCondition() *InCondition
	JoinCondition() *JoinCondition
}

type FilterHandler

type FilterHandler func(params []string) (Filter, error)

type FindDashboardThumbnailCountCommand

type FindDashboardThumbnailCountCommand struct {
	Result int64
}

type FindDashboardsWithStaleThumbnailsCommand

type FindDashboardsWithStaleThumbnailsCommand struct {
	IncludeManuallyUploadedThumbnails bool
	Theme                             Theme
	Kind                              ThumbnailKind
	Result                            []*DashboardWithStaleThumbnail
}

type FindPersistedDashboardsQuery

type FindPersistedDashboardsQuery struct {
	Title        string
	OrgId        int64
	SignedInUser *SignedInUser
	IsStarred    bool
	DashboardIds []int64
	Type         string
	FolderIds    []int64
	Tags         []string
	Limit        int64
	Page         int64
	Permission   PermissionType
	Sort         SortOption

	Filters []interface{}

	Result HitList
}

type Folder

type Folder struct {
	Id      int64
	Uid     string
	Title   string
	Url     string
	Version int

	Created time.Time
	Updated time.Time

	UpdatedBy int64
	CreatedBy int64
	HasAcl    bool
}

func DashboardToFolder

func DashboardToFolder(dash *Dashboard) *Folder

DashboardToFolder converts Dashboard to Folder

func NewFolder

func NewFolder(title string) *Folder

NewFolder creates a new Folder

type GetAdminStatsQuery

type GetAdminStatsQuery struct {
	Result *AdminStats
}

type GetAlertByIdQuery

type GetAlertByIdQuery struct {
	Id int64

	Result *Alert
}

type GetAlertNotificationUidQuery

type GetAlertNotificationUidQuery struct {
	Id    int64
	OrgId int64

	Result string
}

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 GetApiKeyByIdQuery struct {
	ApiKeyId int64
	Result   *ApiKey
}

type GetApiKeyByNameQuery

type GetApiKeyByNameQuery struct {
	KeyName string
	OrgId   int64
	Result  *ApiKey
}

type GetApiKeysQuery

type GetApiKeysQuery struct {
	OrgId          int64
	IncludeExpired bool
	Result         []*ApiKey
}

type GetAuthInfoQuery

type GetAuthInfoQuery struct {
	UserId     int64
	AuthModule string
	AuthId     string

	Result *UserAuth
}

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 GetDashboardQuery struct {
	Slug  string // required if no Id or Uid is specified
	Id    int64  // optional if slug is set
	Uid   string // optional if slug is set
	OrgId int64

	Result *Dashboard
}

type GetDashboardRefByIdQuery

type GetDashboardRefByIdQuery struct {
	Id     int64
	Result *DashboardRef
}

type GetDashboardSlugByIdQuery

type GetDashboardSlugByIdQuery struct {
	Id     int64
	Result string
}

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 GetDashboardThumbnailCommand

type GetDashboardThumbnailCommand struct {
	DashboardThumbnailMeta

	Result *DashboardThumbnail
}

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 GetDashboardsByPluginIdQuery

type GetDashboardsByPluginIdQuery struct {
	OrgId    int64
	PluginId string
	Result   []*Dashboard
}

type GetDashboardsBySlugQuery

type GetDashboardsBySlugQuery struct {
	OrgId int64
	Slug  string

	Result []*Dashboard
}

type GetDashboardsQuery

type GetDashboardsQuery struct {
	DashboardIds []int64
	Result       []*Dashboard
}

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
	UnifiedAlertingEnabled bool
	Result                 *GlobalQuotaDTO
}

type GetLiveMessageQuery

type GetLiveMessageQuery struct {
	OrgId   int64
	Channel string
}

type GetOrCreateNotificationStateQuery

type GetOrCreateNotificationStateQuery struct {
	OrgId      int64
	AlertId    int64
	NotifierId int64

	Result *AlertNotificationState
}

type GetOrgByIdQuery

type GetOrgByIdQuery struct {
	Id     int64
	Result *Org
}

type GetOrgByNameQuery

type GetOrgByNameQuery struct {
	Name   string
	Result *Org
}

type GetOrgQuotaByTargetQuery

type GetOrgQuotaByTargetQuery struct {
	Target                 string
	OrgId                  int64
	Default                int64
	UnifiedAlertingEnabled bool
	Result                 *OrgQuotaDTO
}

type GetOrgQuotasQuery

type GetOrgQuotasQuery struct {
	OrgId                  int64
	UnifiedAlertingEnabled bool
	Result                 []*OrgQuotaDTO
}

type GetOrgUsersQuery

type GetOrgUsersQuery struct {
	UserID int64
	OrgId  int64
	Query  string
	Limit  int

	User   *SignedInUser
	Result []*OrgUserDTO
}

type GetPlaylistByIdQuery

type GetPlaylistByIdQuery struct {
	Id     int64
	Result *Playlist
}

type GetPlaylistItemsByIdQuery

type GetPlaylistItemsByIdQuery struct {
	PlaylistId int64
	Result     *[]PlaylistItem
}

type GetPlaylistsQuery

type GetPlaylistsQuery struct {
	Name  string
	Limit int
	OrgId int64

	Result Playlists
}

type GetPluginSettingByIdQuery

type GetPluginSettingByIdQuery struct {
	PluginId string
	OrgId    int64
	Result   *PluginSetting
}

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 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 GetTeamByIdQuery struct {
	OrgId        int64
	Id           int64
	SignedInUser *SignedInUser
	HiddenUsers  map[string]struct{}
	Result       *TeamDTO
	UserIdFilter int64
}

type GetTeamMembersQuery

type GetTeamMembersQuery struct {
	OrgId        int64
	TeamId       int64
	UserId       int64
	External     bool
	SignedInUser *SignedInUser
	Result       []*TeamMemberDTO
}

type GetTeamsByUserQuery

type GetTeamsByUserQuery struct {
	OrgId  int64
	UserId int64      `json:"userId"`
	Result []*TeamDTO `json:"teams"`
}

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
}

type GetUserByEmailQuery

type GetUserByEmailQuery struct {
	Email  string
	Result *User
}

type GetUserByIdQuery

type GetUserByIdQuery struct {
	Id     int64
	Result *User
}

type GetUserByLoginQuery

type GetUserByLoginQuery struct {
	LoginOrEmail string
	Result       *User
}

type GetUserLoginAttemptCountQuery

type GetUserLoginAttemptCountQuery struct {
	Username string
	Since    time.Time
	Result   int64
}

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
	UnifiedAlertingEnabled bool
	Result                 *UserQuotaDTO
}

type GetUserQuotasQuery

type GetUserQuotasQuery struct {
	UserId                 int64
	UnifiedAlertingEnabled bool
	Result                 []*UserQuotaDTO
}

type GetUserStarsQuery

type GetUserStarsQuery struct {
	UserId int64

	Result map[int64]bool // dashboard ids
}

type GlobalQuotaDTO

type GlobalQuotaDTO struct {
	Target string `json:"target"`
	Limit  int64  `json:"limit"`
	Used   int64  `json:"used"`
}

type HasAdminPermissionInDashboardsOrFoldersQuery

type HasAdminPermissionInDashboardsOrFoldersQuery 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 Hit

type Hit struct {
	ID           int64    `json:"id"`
	UID          string   `json:"uid"`
	Title        string   `json:"title"`
	URI          string   `json:"uri"`
	URL          string   `json:"url"`
	Slug         string   `json:"slug"`
	Type         HitType  `json:"type"`
	Tags         []string `json:"tags"`
	IsStarred    bool     `json:"isStarred"`
	FolderID     int64    `json:"folderId,omitempty"`
	FolderUID    string   `json:"folderUid,omitempty"`
	FolderTitle  string   `json:"folderTitle,omitempty"`
	FolderURL    string   `json:"folderUrl,omitempty"`
	SortMeta     int64    `json:"sortMeta"`
	SortMetaName string   `json:"sortMetaName,omitempty"`
}

type HitList

type HitList []*Hit

func (HitList) Len

func (s HitList) Len() int

func (HitList) Less

func (s HitList) Less(i, j int) bool

func (HitList) Swap

func (s HitList) Swap(i, j int)

type HitType

type HitType string
const (
	DashHitDB     HitType = "dash-db"
	DashHitHome   HitType = "dash-home"
	DashHitFolder HitType = "dash-folder"
)

type InCondition

type InCondition struct {
	Condition string
	Params    interface{}
}

type IsAdminOfTeamsQuery

type IsAdminOfTeamsQuery struct {
	SignedInUser *SignedInUser
	Result       bool
}

type IsStarredByUserQuery

type IsStarredByUserQuery struct {
	UserId      int64
	DashboardId int64

	Result bool
}

type JWTClaims

type JWTClaims map[string]interface{}

type JWTService

type JWTService interface {
	Verify(ctx context.Context, strToken string) (JWTClaims, error)
}

type JoinCondition

type JoinCondition struct {
	Operator string
	Table    string
	Params   string
}

type LibraryElementKind

type LibraryElementKind int

LibraryElementKind is used for the kind of library element

const (
	// PanelElement is used for library elements that are of the Panel kind
	PanelElement LibraryElementKind = iota + 1
	// VariableElement is used for library elements that are of the Variable kind
	VariableElement
)

type LicenseEnvironment

type LicenseEnvironment interface {
	// Environment is a map of environment variables
	Environment() map[string]string
}

type Licensing

type Licensing interface {
	// 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(showAdminLicensingPage bool) string

	StateInfo() string

	EnabledFeatures() map[string]bool

	FeatureEnabled(feature string) bool
}

type LiveMessage

type LiveMessage struct {
	Id        int64
	OrgId     int64
	Channel   string
	Data      json.RawMessage
	Published time.Time
}

type LoginAttempt

type LoginAttempt struct {
	Id        int64
	Username  string
	IpAddress string
	Created   int64
}

type LoginInfo

type LoginInfo struct {
	AuthModule    string
	User          *User
	ExternalUser  ExternalUserInfo
	LoginUsername string
	HTTPStatus    int
	Error         error
}

type LoginUserQuery

type LoginUserQuery struct {
	ReqContext *ReqContext
	Username   string
	Password   string
	User       *User
	IpAddress  string
	AuthModule string
	Cfg        *setting.Cfg
}
type NavLink struct {
	Id     string `json:"id,omitempty"`
	Text   string `json:"text,omitempty"`
	Url    string `json:"url,omitempty"`
	Target string `json:"target,omitempty"`
}
type NavbarPreference struct {
	SavedItems []NavLink `json:"savedItems"`
}

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 NotifierUsageStats struct {
	Type  string
	Count int64
}

type OAuthType

type OAuthType int
const (
	GITHUB OAuthType = iota + 1
	GOOGLE
	TWITTER
	GENERIC
	GRAFANA_COM
	GITLAB
	AZUREAD
	OKTA
)

type Org

type Org struct {
	Id      int64
	Version int
	Name    string

	Address1 string
	Address2 string
	City     string
	ZipCode  string
	State    string
	Country  string

	Created time.Time
	Updated time.Time
}

type OrgDTO

type OrgDTO struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

type OrgDetailsDTO

type OrgDetailsDTO struct {
	Id      int64   `json:"id"`
	Name    string  `json:"name"`
	Address Address `json:"address"`
}

type OrgQuotaDTO

type OrgQuotaDTO struct {
	OrgId  int64  `json:"org_id"`
	Target string `json:"target"`
	Limit  int64  `json:"limit"`
	Used   int64  `json:"used"`
}

type OrgUser

type OrgUser struct {
	Id      int64
	OrgId   int64
	UserId  int64
	Role    RoleType
	Created time.Time
	Updated time.Time
}

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"`
	Updated       time.Time       `json:"-"`
	Created       time.Time       `json:"-"`
	LastSeenAtAge string          `json:"lastSeenAtAge"`
	AccessControl map[string]bool `json:"accessControl,omitempty"`
}

type Password

type Password string

func (Password) IsWeak

func (p Password) IsWeak() bool

type PatchPreferencesCommand

type PatchPreferencesCommand struct {
	UserId int64
	OrgId  int64
	TeamId int64

	HomeDashboardId *int64            `json:"homeDashboardId,omitempty"`
	Timezone        *string           `json:"timezone,omitempty"`
	WeekStart       *string           `json:"weekStart,omitempty"`
	Theme           *string           `json:"theme,omitempty"`
	Navbar          *NavbarPreference `json:"navbar,omitempty"`
}

type PauseAlertCommand

type PauseAlertCommand struct {
	OrgId       int64
	AlertIds    []int64
	ResultCount int64
	Paused      bool
}

type PauseAllAlertCommand

type PauseAllAlertCommand struct {
	ResultCount int64
	Paused      bool
}

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 PlaylistItem struct {
	Id         int64
	PlaylistId int64
	Type       string
	Value      string
	Order      int
	Title      string
}

type PlaylistItemDTO

type PlaylistItemDTO struct {
	Id         int64  `json:"id"`
	PlaylistId int64  `json:"playlistid"`
	Type       string `json:"type"`
	Title      string `json:"title"`
	Value      string `json:"value"`
	Order      int    `json:"order"`
}

type Playlists

type Playlists []*Playlist

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
}

type PluginSetting

type PluginSetting struct {
	Id             int64
	PluginId       string
	OrgId          int64
	Enabled        bool
	Pinned         bool
	JsonData       map[string]interface{}
	SecureJsonData map[string][]byte
	PluginVersion  string

	Created time.Time
	Updated time.Time
}

type PluginSettingInfoDTO

type PluginSettingInfoDTO struct {
	OrgId         int64
	PluginId      string
	Enabled       bool
	Pinned        bool
	PluginVersion string
}

type PluginStateChangedEvent

type PluginStateChangedEvent struct {
	PluginId string
	OrgId    int64
	Enabled  bool
}

type Preferences

type Preferences struct {
	Id              int64
	OrgId           int64
	UserId          int64
	TeamId          int64
	Version         int
	HomeDashboardId int64
	Timezone        string
	WeekStart       string
	Theme           string
	Created         time.Time
	Updated         time.Time
	JsonData        *PreferencesJsonData
}

type PreferencesJsonData

type PreferencesJsonData struct {
	Navbar NavbarPreference `json:"navbar"`
}

func (*PreferencesJsonData) FromDB

func (j *PreferencesJsonData) FromDB(data []byte) error

func (*PreferencesJsonData) ToDB

func (j *PreferencesJsonData) ToDB() ([]byte, error)

type PublishEvent

type PublishEvent struct {
	Channel string
	Path    string
	Data    json.RawMessage
}

PublishEvent contains publication data.

type PublishReply

type PublishReply struct {
	// By default, it's a handler responsibility to publish data
	// into a stream upon OnPublish but returning a data here
	// will make Grafana Live publish data itself (i.e. stream handler
	// just works as permission proxy in this case).
	Data json.RawMessage
	// HistorySize sets a stream history size.
	HistorySize int
	// HistoryTTL is a time that messages will live in stream history.
	HistoryTTL time.Duration
}

PublishReply is a reaction to PublishEvent.

type Quota

type Quota struct {
	Id      int64
	OrgId   int64
	UserId  int64
	Target  string
	Limit   int64
	Created time.Time
	Updated time.Time
}

type QuotaScope

type QuotaScope struct {
	Name         string
	Target       string
	DefaultLimit int64
}

type RemoveOrgUserCommand

type RemoveOrgUserCommand struct {
	UserId                   int64
	OrgId                    int64
	ShouldDeleteOrphanedUser bool
	UserWasDeleted           bool
}

type RemoveTeamMemberCommand

type RemoveTeamMemberCommand struct {
	OrgId  int64 `json:"-"`
	UserId int64
	TeamId int64
}

type ReqContext

type ReqContext struct {
	*web.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

	PerfmonTimer   prometheus.Summary
	LookupTokenErr error
}

func (*ReqContext) Handle

func (ctx *ReqContext) Handle(cfg *setting.Cfg, status int, title string, err error)

Handle handles and logs error by given status.

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) QueryBoolWithDefault

func (ctx *ReqContext) QueryBoolWithDefault(field string, d bool) bool

QueryBoolWithDefault extracts a value from the request query params and applies a bool default if not present.

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 RoleType

type RoleType string
const (
	ROLE_VIEWER RoleType = "Viewer"
	ROLE_EDITOR RoleType = "Editor"
	ROLE_ADMIN  RoleType = "Admin"
)

func (RoleType) Children

func (r RoleType) Children() []RoleType

func (RoleType) Includes

func (r RoleType) Includes(other RoleType) bool

func (RoleType) IsValid

func (r RoleType) IsValid() bool

func (RoleType) Parents

func (r RoleType) Parents() []RoleType

func (*RoleType) UnmarshalJSON

func (r *RoleType) UnmarshalJSON(data []byte) error

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"`
	FolderUid    string           `json:"folderUid"`
	IsFolder     bool             `json:"isFolder"`

	UpdatedAt time.Time

	Result *Dashboard `json:"-"`
}

func (*SaveDashboardCommand) GetDashboardModel

func (cmd *SaveDashboardCommand) GetDashboardModel() *Dashboard

GetDashboardModel turns the command into the saveable model

type SaveDashboardThumbnailCommand

type SaveDashboardThumbnailCommand struct {
	DashboardThumbnailMeta
	DashboardVersion int
	Image            []byte
	MimeType         string

	Result *DashboardThumbnail
}

type SaveLiveMessageQuery

type SaveLiveMessageQuery struct {
	OrgId   int64
	Channel string
	Data    json.RawMessage
}

type SavePreferencesCommand

type SavePreferencesCommand struct {
	UserId int64
	OrgId  int64
	TeamId int64

	HomeDashboardId int64             `json:"homeDashboardId,omitempty"`
	Timezone        string            `json:"timezone,omitempty"`
	WeekStart       string            `json:"weekStart,omitempty"`
	Theme           string            `json:"theme,omitempty"`
	Navbar          *NavbarPreference `json:"navbar,omitempty"`
}

--------------------- COMMANDS

type SearchOrgUsersQuery

type SearchOrgUsersQuery struct {
	OrgID int64
	Query string
	Page  int
	Limit int

	User   *SignedInUser
	Result SearchOrgUsersQueryResult
}

type SearchOrgUsersQueryResult

type SearchOrgUsersQueryResult struct {
	TotalCount int64         `json:"totalCount"`
	OrgUsers   []*OrgUserDTO `json:"OrgUsers"`
	Page       int           `json:"page"`
	PerPage    int           `json:"perPage"`
}

type SearchOrgsQuery

type SearchOrgsQuery struct {
	Query string
	Name  string
	Limit int
	Page  int
	Ids   []int64

	Result []*OrgDTO
}

type SearchTeamQueryResult

type SearchTeamQueryResult struct {
	TotalCount int64      `json:"totalCount"`
	Teams      []*TeamDTO `json:"teams"`
	Page       int        `json:"page"`
	PerPage    int        `json:"perPage"`
}

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 SearchUserFilter

type SearchUserFilter interface {
	GetFilter(filterName string, params []string) Filter
	GetFilterList() map[string]FilterHandler
}

type SearchUserQueryResult

type SearchUserQueryResult struct {
	TotalCount int64               `json:"totalCount"`
	Users      []*UserSearchHitDTO `json:"users"`
	Page       int                 `json:"page"`
	PerPage    int                 `json:"perPage"`
}

type SearchUsersQuery

type SearchUsersQuery struct {
	OrgId      int64
	Query      string
	Page       int
	Limit      int
	AuthModule string
	Filters    []Filter

	IsDisabled *bool

	Result SearchUserQueryResult
}

type SendEmailAttachFile

type SendEmailAttachFile struct {
	Name    string
	Content []byte
}

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 the command for sending emails

type SendEmailCommandSync

type SendEmailCommandSync struct {
	SendEmailCommand
}

SendEmailCommandSync is the command for sending emails synchronously

type SendResetPasswordEmailCommand

type SendResetPasswordEmailCommand struct {
	User *User
}

type SendWebhookSync

type SendWebhookSync struct {
	Url         string
	User        string
	Password    string
	Body        string
	HttpMethod  string
	HttpHeader  map[string]string
	ContentType string
	Validation  func(body []byte, statusCode int) error
}

type SetAlertNotificationStateToCompleteCommand

type SetAlertNotificationStateToCompleteCommand struct {
	Id      int64
	Version int64
}

type SetAlertNotificationStateToPendingCommand

type SetAlertNotificationStateToPendingCommand struct {
	Id                           int64
	AlertRuleStateUpdatedVersion int64
	Version                      int64

	ResultVersion int64
}

type SetAlertStateCommand

type SetAlertStateCommand struct {
	AlertId  int64
	OrgId    int64
	State    AlertStateType
	Error    string
	EvalData *simplejson.Json

	Result Alert
}

type SetAuthInfoCommand

type SetAuthInfoCommand struct {
	AuthModule string
	AuthId     string
	UserId     int64
	OAuthToken *oauth2.Token
}

type SetUserHelpFlagCommand

type SetUserHelpFlagCommand struct {
	HelpFlags1 HelpFlags1
	UserId     int64
}

type SetUsingOrgCommand

type SetUsingOrgCommand struct {
	UserId int64
	OrgId  int64
}

type ShortUrl

type ShortUrl struct {
	Id         int64
	OrgId      int64
	Uid        string
	Path       string
	CreatedBy  int64
	CreatedAt  int64
	LastSeenAt int64
}

type SignedInUser

type SignedInUser struct {
	UserId             int64
	OrgId              int64
	OrgName            string
	OrgRole            RoleType
	ExternalAuthModule string
	ExternalAuthId     string
	Login              string
	Name               string
	Email              string
	ApiKeyId           int64
	OrgCount           int
	IsGrafanaAdmin     bool
	IsAnonymous        bool
	IsDisabled         bool
	HelpFlags1         HelpFlags1
	LastSeenAt         time.Time
	Teams              []int64
	// Permissions grouped by orgID and actions
	Permissions map[int64]map[string][]string `json:"-"`
}

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

func (*SignedInUser) ToUserDisplayDTO

func (u *SignedInUser) ToUserDisplayDTO() *UserDisplayDTO

type SortOption

type SortOption struct {
	Name        string
	DisplayName string
	Description string
	Index       int
	MetaName    string
	Filter      []SortOptionFilter
}

type SortOptionFilter

type SortOptionFilter interface {
	searchstore.FilterOrderBy
}

type Star

type Star struct {
	Id          int64
	UserId      int64
	DashboardId int64
}

type StarDashboardCommand

type StarDashboardCommand struct {
	UserId      int64
	DashboardId int64
}

type SubscribeEvent

type SubscribeEvent struct {
	Channel string
	Path    string
	Data    json.RawMessage
}

SubscribeEvent contains subscription data.

type SubscribeReply

type SubscribeReply struct {
	Presence  bool
	JoinLeave bool
	Recover   bool
	Data      json.RawMessage
}

SubscribeReply is a reaction to SubscribeEvent.

type SystemStats

type SystemStats struct {
	Dashboards                int64
	Datasources               int64
	Users                     int64
	ActiveUsers               int64
	DailyActiveUsers          int64
	MonthlyActiveUsers        int64
	Orgs                      int64
	Playlists                 int64
	Alerts                    int64
	Stars                     int64
	Snapshots                 int64
	Teams                     int64
	DashboardPermissions      int64
	FolderPermissions         int64
	Folders                   int64
	ProvisionedDashboards     int64
	AuthTokens                int64
	APIKeys                   int64 `xorm:"api_keys"`
	DashboardVersions         int64
	Annotations               int64
	AlertRules                int64
	LibraryPanels             int64
	LibraryVariables          int64
	DashboardsViewersCanEdit  int64
	DashboardsViewersCanAdmin int64
	FoldersViewersCanEdit     int64
	FoldersViewersCanAdmin    int64
	Admins                    int64
	Editors                   int64
	Viewers                   int64
	ActiveAdmins              int64
	ActiveEditors             int64
	ActiveViewers             int64
	ActiveSessions            int64
	DailyActiveAdmins         int64
	DailyActiveEditors        int64
	DailyActiveViewers        int64
	DailyActiveSessions       int64
	DataKeys                  int64
}

type SystemUserCountStats

type SystemUserCountStats struct {
	Count int64
}

type Tag

type Tag struct {
	Id    int64
	Key   string
	Value string
}

func ParseTagPairs

func ParseTagPairs(tagPairs []string) (tags []*Tag)

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 TeamDTO

type TeamDTO struct {
	Id            int64           `json:"id"`
	OrgId         int64           `json:"orgId"`
	Name          string          `json:"name"`
	Email         string          `json:"email"`
	AvatarUrl     string          `json:"avatarUrl"`
	MemberCount   int64           `json:"memberCount"`
	Permission    PermissionType  `json:"permission"`
	AccessControl map[string]bool `json:"accessControl"`
}

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 TeamOrgGroupDTO struct {
	TeamName string `json:"teamName"`
	OrgName  string `json:"orgName"`
	GroupDN  string `json:"groupDN"`
}

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 Theme

type Theme string
const (
	ThemeLight Theme = "light"
	ThemeDark  Theme = "dark"
)

func ParseTheme

func ParseTheme(str string) (Theme, error)

type ThumbnailKind

type ThumbnailKind string
const (
	// ThumbnailKindDefault is a small 320x240 preview
	ThumbnailKindDefault ThumbnailKind = "thumb"
)

func ParseThumbnailKind

func ParseThumbnailKind(str string) (ThumbnailKind, error)

func (ThumbnailKind) IsKnownThumbnailKind

func (p ThumbnailKind) IsKnownThumbnailKind() bool

IsKnownThumbnailKind checks if the value is supported

type ThumbnailState

type ThumbnailState string
const (
	// ThumbnailStateDefault is the initial state for all thumbnails. Thumbnails in the "default" state will be considered stale,
	// and thus refreshed by the crawler, if the dashboard version from the time of taking the thumbnail is different from the current dashboard version
	ThumbnailStateDefault ThumbnailState = "default"

	// ThumbnailStateStale is a manually assigned state. Thumbnails in the "stale" state will be refreshed on the next crawler run
	ThumbnailStateStale ThumbnailState = "stale"

	// ThumbnailStateLocked is a manually assigned state. Thumbnails in the "locked" state will not be refreshed by the crawler as long as they remain in the "locked" state.
	ThumbnailStateLocked ThumbnailState = "locked"
)

func (ThumbnailState) IsValid

func (s ThumbnailState) IsValid() bool

func (*ThumbnailState) UnmarshalJSON

func (s *ThumbnailState) UnmarshalJSON(data []byte) error

type TokenExpiredError

type TokenExpiredError struct {
	UserID  int64
	TokenID int64
}

func (*TokenExpiredError) Error

func (e *TokenExpiredError) Error() string

type TokenRevokedError

type TokenRevokedError struct {
	UserID                int64
	TokenID               int64
	MaxConcurrentSessions int64
}

func (*TokenRevokedError) Error

func (e *TokenRevokedError) Error() string

type TrimDashboardCommand

type TrimDashboardCommand struct {
	Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
	Meta      *simplejson.Json `json:"meta"`
	Result    *Dashboard       `json:"-"`
}

type UnstarDashboardCommand

type UnstarDashboardCommand struct {
	UserId      int64
	DashboardId int64
}

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:"-"`
	EncryptedSecureSettings map[string][]byte `json:"-"`

	Result *AlertNotification `json:"-"`
}

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              `json:"-"`
	Result *AlertNotification `json:"-"`
}

type UpdateAuthInfoCommand

type UpdateAuthInfoCommand struct {
	AuthModule string
	AuthId     string
	UserId     int64
	OAuthToken *oauth2.Token
}

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:"-"`
	EncryptedSecureJsonData map[string][]byte `json:"-"`

	Result *DataSource `json:"-"`
}

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 `json:"-"`
}

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 UpdateOrgAddressCommand struct {
	OrgId int64
	Address
}

type UpdateOrgCommand

type UpdateOrgCommand struct {
	Name  string
	OrgId int64
}

type UpdateOrgQuotaCmd

type UpdateOrgQuotaCmd struct {
	Target string `json:"target"`
	Limit  int64  `json:"limit"`
	OrgId  int64  `json:"-"`
}

type UpdateOrgUserCommand

type UpdateOrgUserCommand struct {
	Role RoleType `json:"role" binding:"Required"`

	OrgId  int64 `json:"-"`
	UserId int64 `json:"-"`
}

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

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:"-"`
	EncryptedSecureJsonData map[string][]byte `json:"-"`
}

Also acts as api DTO

type UpdatePluginSettingVersionCmd

type UpdatePluginSettingVersionCmd struct {
	PluginVersion string
	PluginId      string `json:"-"`
	OrgId         int64  `json:"-"`
}

specific command, will only update version

type UpdateTeamCommand

type UpdateTeamCommand struct {
	Id    int64
	Name  string
	Email string
	OrgId int64 `json:"-"`
}

type UpdateTeamMemberCommand

type UpdateTeamMemberCommand struct {
	UserId     int64          `json:"-"`
	OrgId      int64          `json:"-"`
	TeamId     int64          `json:"-"`
	Permission PermissionType `json:"permission"`
}

type UpdateTempUserStatusCommand

type UpdateTempUserStatusCommand struct {
	Code   string
	Status TempUserStatus
}

type UpdateTempUserWithEmailSentCommand

type UpdateTempUserWithEmailSentCommand struct {
	Code string
}

type UpdateThumbnailStateCommand

type UpdateThumbnailStateCommand struct {
	State ThumbnailState
	DashboardThumbnailMeta
}

type UpdateUserCommand

type UpdateUserCommand struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Login string `json:"login"`
	Theme string `json:"theme"`

	UserId int64 `json:"-"`
}

type UpdateUserLastSeenAtCommand

type UpdateUserLastSeenAtCommand struct {
	UserId int64
}

type UpdateUserQuotaCmd

type UpdateUserQuotaCmd struct {
	Target string `json:"target"`
	Limit  int64  `json:"limit"`
	UserId int64  `json:"-"`
}

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
	IsServiceAccount bool
	OrgId            int64

	Created    time.Time
	Updated    time.Time
	LastSeenAt time.Time
}

func (*User) NameOrFallback

func (u *User) NameOrFallback() string

type UserAuth

type UserAuth struct {
	Id                int64
	UserId            int64
	AuthModule        string
	AuthId            string
	Created           time.Time
	OAuthAccessToken  string
	OAuthRefreshToken string
	OAuthIdToken      string
	OAuthTokenType    string
	OAuthExpiry       time.Time
}

type UserDisplayDTO

type UserDisplayDTO struct {
	Id        int64  `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	Login     string `json:"login,omitempty"`
	AvatarUrl string `json:"avatarUrl"`
}

type UserIdDTO

type UserIdDTO struct {
	Id      int64  `json:"id"`
	Message string `json:"message"`
}

type UserLookupParams

type UserLookupParams struct {
	// Describes lookup order as well
	UserID *int64  // if set, will try to find the user by id
	Email  *string // if set, will try to find the user by email
	Login  *string // if set, will try to find the user by login
}

type UserOrgDTO

type UserOrgDTO struct {
	OrgId int64    `json:"orgId"`
	Name  string   `json:"name"`
	Role  RoleType `json:"role"`
}

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,omitempty"`
	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"`
	AccessControl  map[string]bool `json:"accessControl,omitempty"`
}

type UserQuotaDTO

type UserQuotaDTO struct {
	UserId int64  `json:"user_id"`
	Target string `json:"target"`
	Limit  int64  `json:"limit"`
	Used   int64  `json:"used"`
}

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 UserStats

type UserStats struct {
	Users   int64
	Admins  int64
	Editors int64
	Viewers int64
}

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 UserTokenBackgroundService

type UserTokenBackgroundService interface {
	registry.BackgroundService
}

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 ValidateDashboardBeforeSaveResult

type ValidateDashboardBeforeSaveResult struct {
	IsParentFolderChanged bool
}

type ValidateResetPasswordCodeQuery

type ValidateResetPasswordCodeQuery struct {
	Code   string
	Result *User
}

type WhereCondition

type WhereCondition struct {
	Condition string
	Params    interface{}
}

Jump to

Keyboard shortcuts

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