models

package
v4.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
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_ACCESS_DIRECT = "direct"
	DS_ACCESS_PROXY  = "proxy"
)

Variables

View Source
var (
	ErrDashboardNotFound           = errors.New("Dashboard not found")
	ErrDashboardSnapshotNotFound   = errors.New("Dashboard snapshot not found")
	ErrDashboardWithSameNameExists = errors.New("A dashboard with the same name already exists")
	ErrDashboardVersionMismatch    = errors.New("The dashboard has been changed by someone else")
	ErrDashboardTitleEmpty         = errors.New("Dashboard title cannot be empty")
)

Typed errors

View Source
var (
	DashTypeJson     = "file"
	DashTypeDB       = "db"
	DashTypeScript   = "script"
	DashTypeSnapshot = "snapshot"
)
View Source
var (
	ErrDataSourceNotFound   = errors.New("Data source not found")
	ErrDataSourceNameExists = errors.New("Data source with same name already exists")
)

Typed errors

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

Typed errors

View Source
var (
	ErrInvalidRoleType     = errors.New("Invalid role type")
	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 (
	ErrPlaylistNotFound           = errors.New("Playlist not found")
	ErrPlaylistWithSameNameExists = errors.New("A playlist with the same name already exists")
)

Typed errors

View Source
var (
	ErrCannotChangeStateOnPausedAlert error = fmt.Errorf("Cannot change state on pause alert")
)
View Source
var ErrCommandValidationFailed = errors.New("Command missing required fields")
View Source
var ErrInvalidApiKey = errors.New("Invalid API Key")
View Source
var ErrInvalidEmailCode = errors.New("Invalid or expired email code")
View Source
var ErrInvalidQuotaTarget = errors.New("Invalid quota target")
View Source
var (
	ErrPluginSettingNotFound = errors.New("Plugin setting not found")
)
View Source
var (
	ErrPreferencesNotFound = errors.New("Preferences not found")
)

Typed errors

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

Typed errors

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

Typed errors

Functions

func IsKnownDataSourcePlugin

func IsKnownDataSourcePlugin(dsType string) bool

Types

type AddApiKeyCommand

type AddApiKeyCommand struct {
	Name  string   `json:"name" binding:"Required"`
	Role  RoleType `json:"role" binding:"Required"`
	OrgId int64    `json:"-"`
	Key   string   `json:"-"`

	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"`

	OrgId int64 `json:"-"`

	Result *DataSource
}

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 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 {
	UserCount       int `json:"user_count"`
	OrgCount        int `json:"org_count"`
	DashboardCount  int `json:"dashboard_count"`
	DbSnapshotCount int `json:"db_snapshot_count"`
	DbTagCount      int `json:"db_tag_count"`
	DataSourceCount int `json:"data_source_count"`
	PlaylistCount   int `json:"playlist_count"`
	StarredDbCount  int `json:"starred_db_count"`
	AlertCount      int `json:"alert_count"`
}

type Alert

type Alert struct {
	Id             int64
	Version        int64
	OrgId          int64
	DashboardId    int64
	PanelId        int64
	Name           string
	Message        string
	Severity       string
	State          AlertStateType
	Handler        int64
	Silenced       bool
	ExecutionError string
	Frequency      int64

	EvalData     *simplejson.Json
	NewStateDate time.Time
	StateChanges int

	Created time.Time
	Updated time.Time

	Settings *simplejson.Json
}

func (*Alert) ContainsUpdates

func (this *Alert) ContainsUpdates(other *Alert) bool

func (*Alert) ShouldUpdateState

func (alert *Alert) ShouldUpdateState(newState AlertStateType) bool

func (*Alert) ValidToSave

func (alert *Alert) ValidToSave() bool

type AlertNotification

type AlertNotification struct {
	Id        int64            `json:"id"`
	OrgId     int64            `json:"-"`
	Name      string           `json:"name"`
	Type      string           `json:"type"`
	IsDefault bool             `json:"isDefault"`
	Settings  *simplejson.Json `json:"settings"`
	Created   time.Time        `json:"created"`
	Updated   time.Time        `json:"updated"`
}

type AlertSeverityType

type AlertSeverityType 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"
)

func (AlertStateType) IsValid

func (s AlertStateType) IsValid() bool

type AlertingClusterInfo

type AlertingClusterInfo struct {
	ServerId       string
	ClusterSize    int
	UptimePosition int
}

type ApiKey

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

type ApiKeyDTO

type ApiKeyDTO struct {
	Id   int64    `json:"id"`
	Name string   `json:"name"`
	Role RoleType `json:"role"`
}

type ChangeUserPasswordCommand

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

	UserId int64 `json:"-"`
}

type CreateAlertNotificationCommand

type CreateAlertNotificationCommand struct {
	Name      string           `json:"name"  binding:"Required"`
	Type      string           `json:"type"  binding:"Required"`
	IsDefault bool             `json:"isDefault"`
	Settings  *simplejson.Json `json:"settings"`

	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"`
	Key       string `json:"key"`
	DeleteKey string `json:"deleteKey"`

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

	Result *DashboardSnapshot
}

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 CreateTempUserCommand

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

	Result *TempUser
}

type CreateUserCommand

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

	Result User
}

type Dashboard

type Dashboard struct {
	Id       int64
	Slug     string
	OrgId    int64
	GnetId   int64
	Version  int
	PluginId string

	Created time.Time
	Updated time.Time

	UpdatedBy int64
	CreatedBy int64

	Title string
	Data  *simplejson.Json
}

Dashboard model

func NewDashboard

func NewDashboard(title string) *Dashboard

NewDashboard creates a new dashboard

func NewDashboardFromJson

func NewDashboardFromJson(data *simplejson.Json) *Dashboard

func (*Dashboard) GetString

func (dash *Dashboard) GetString(prop string, defaultValue string) string

GetString a

func (*Dashboard) GetTags

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

GetTags turns the tags in data json into go string array

func (*Dashboard) UpdateSlug

func (dash *Dashboard) UpdateSlug()

UpdateSlug updates the slug

type DashboardSnapshot

type DashboardSnapshot struct {
	Id          int64
	Name        string
	Key         string
	DeleteKey   string
	OrgId       int64
	UserId      int64
	External    bool
	ExternalUrl string

	Expires time.Time
	Created time.Time
	Updated time.Time

	Dashboard *simplejson.Json
}

DashboardSnapshot model

type DashboardSnapshotDTO

type DashboardSnapshotDTO struct {
	Id          int64  `json:"id"`
	Name        string `json:"name"`
	Key         string `json:"key"`
	DeleteKey   string `json:"deleteKey"`
	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 DashboardSnapshots

type DashboardSnapshots []*DashboardSnapshot

type DashboardTagCloudItem

type DashboardTagCloudItem struct {
	Term  string `json:"term"`
	Count int    `json:"count"`
}

type DataSource

type DataSource struct {
	Id      int64
	OrgId   int64
	Version int

	Name              string
	Type              string
	Access            DsAccess
	Url               string
	Password          string
	User              string
	Database          string
	BasicAuth         bool
	BasicAuthUser     string
	BasicAuthPassword string
	WithCredentials   bool
	IsDefault         bool
	JsonData          *simplejson.Json
	SecureJsonData    securejsondata.SecureJsonData

	Created time.Time
	Updated time.Time
}

func (*DataSource) GetHttpClient

func (ds *DataSource) GetHttpClient() (*http.Client, error)

func (*DataSource) GetHttpTransport

func (ds *DataSource) GetHttpTransport() (*http.Transport, error)

type DataSourceCreatedEvent

type DataSourceCreatedEvent struct {
}

--------------------- EVENTS

type DataSourceStats

type DataSourceStats struct {
	Count int
	Type  string
}

type DeleteAlertCommand

type DeleteAlertCommand struct {
	AlertId int64
}

type DeleteAlertNotificationCommand

type DeleteAlertNotificationCommand struct {
	Id    int64
	OrgId int64
}

type DeleteApiKeyCommand

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

type DeleteDashboardCommand

type DeleteDashboardCommand struct {
	Slug  string
	OrgId int64
}

type DeleteDashboardSnapshotCommand

type DeleteDashboardSnapshotCommand struct {
	DeleteKey string `json:"-"`
}

type DeleteDataSourceCommand

type DeleteDataSourceCommand struct {
	Id    int64
	OrgId int64
}

type DeleteExpiredSnapshotsCommand

type DeleteExpiredSnapshotsCommand struct {
}

type DeleteOrgCommand

type DeleteOrgCommand struct {
	Id int64
}

type DeletePlaylistCommand

type DeletePlaylistCommand struct {
	Id    int64
	OrgId int64
}

type DeleteUserCommand

type DeleteUserCommand struct {
	UserId int64
}

type DsAccess

type DsAccess 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 GetAdminStatsQuery

type GetAdminStatsQuery struct {
	Result *AdminStats
}

type GetAlertByIdQuery

type GetAlertByIdQuery struct {
	Id int64

	Result *Alert
}

type GetAlertNotificationsQuery

type GetAlertNotificationsQuery struct {
	Name  string
	Id    int64
	OrgId int64

	Result *AlertNotification
}

type GetAlertNotificationsToSendQuery

type GetAlertNotificationsToSendQuery struct {
	Ids   []int64
	OrgId int64

	Result []*AlertNotification
}

type GetAlertStatesForDashboardQuery

type GetAlertStatesForDashboardQuery struct {
	OrgId       int64
	DashboardId int64

	Result []*AlertStateInfoDTO
}

type GetAlertsQuery

type GetAlertsQuery struct {
	OrgId       int64
	State       []string
	DashboardId int64
	PanelId     int64
	Limit       int64

	Result []*Alert
}

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
	Result []*ApiKey
}

type GetDashboardQuery

type GetDashboardQuery struct {
	Slug  string
	OrgId int64

	Result *Dashboard
}

type GetDashboardSlugByIdQuery

type GetDashboardSlugByIdQuery struct {
	Id     int64
	Result string
}

type GetDashboardSnapshotQuery

type GetDashboardSnapshotQuery struct {
	Key string

	Result *DashboardSnapshot
}

type GetDashboardSnapshotsQuery

type GetDashboardSnapshotsQuery struct {
	Name  string
	Limit int
	OrgId int64

	Result DashboardSnapshots
}

type GetDashboardTagsQuery

type GetDashboardTagsQuery struct {
	OrgId  int64
	Result []*DashboardTagCloudItem
}

type GetDashboardsByPluginIdQuery

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

type GetDashboardsQuery

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

type GetDataSourceByIdQuery

type GetDataSourceByIdQuery struct {
	Id     int64
	OrgId  int64
	Result *DataSource
}

type GetDataSourceByNameQuery

type GetDataSourceByNameQuery struct {
	Name   string
	OrgId  int64
	Result *DataSource
}

type GetDataSourceStatsQuery

type GetDataSourceStatsQuery struct {
	Result []*DataSourceStats
}

type GetDataSourcesQuery

type GetDataSourcesQuery struct {
	OrgId  int64
	Result []*DataSource
}

type GetGlobalQuotaByTargetQuery

type GetGlobalQuotaByTargetQuery struct {
	Target  string
	Default int64
	Result  *GlobalQuotaDTO
}

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
	Result  *OrgQuotaDTO
}

type GetOrgQuotasQuery

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

type GetOrgUsersQuery

type GetOrgUsersQuery struct {
	OrgId  int64
	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 GetPluginSettingsQuery

type GetPluginSettingsQuery struct {
	OrgId  int64
	Result []*PluginSettingInfoDTO
}

--------------------- QUERIES

type GetPreferencesQuery

type GetPreferencesQuery struct {
	Id     int64
	OrgId  int64
	UserId int64

	Result *Preferences
}

type GetPreferencesWithDefaultsQuery

type GetPreferencesWithDefaultsQuery struct {
	Id     int64
	OrgId  int64
	UserId int64

	Result *Preferences
}

type GetSignedInUserQuery

type GetSignedInUserQuery struct {
	UserId int64
	Login  string
	Email  string
	Result *SignedInUser
}

type GetSystemStatsQuery

type GetSystemStatsQuery struct {
	Result *SystemStats
}

type GetTempUserByCodeQuery

type GetTempUserByCodeQuery struct {
	Code string

	Result *TempUserDTO
}

type GetTempUsersQuery

type GetTempUsersQuery struct {
	OrgId  int64
	Email  string
	Status TempUserStatus

	Result []*TempUserDTO
}

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 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 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 GrafanaServer

type GrafanaServer interface {
	context.Context

	Start()
	Shutdown(code int, reason string)
}

type HeartBeat

type HeartBeat struct {
	Id       int64
	ServerId string
	Updated  time.Time
	Created  time.Time
}

type HeartBeatCommand

type HeartBeatCommand struct {
	ServerId string
	Result   AlertingClusterInfo
}

type HelpFlags1

type HelpFlags1 uint64
const (
	HelpFlagGettingStartedPanelDismissed HelpFlags1 = 1 << iota
	HelpFlagDashboardHelp1
)

func (*HelpFlags1) AddFlag

func (f *HelpFlags1) AddFlag(flag HelpFlags1)

func (*HelpFlags1) ClearFlag

func (f *HelpFlags1) ClearFlag(flag HelpFlags1)

func (HelpFlags1) HasFlag

func (f HelpFlags1) HasFlag(flag HelpFlags1) bool

func (*HelpFlags1) ToggleFlag

func (f *HelpFlags1) ToggleFlag(flag HelpFlags1)

type HomeDashboard

type HomeDashboard struct {
	Id        int64
	UserId    int64
	AccountId int64

	Created time.Time
	Updated time.Time

	Data map[string]interface{}
}

type IsStarredByUserQuery

type IsStarredByUserQuery struct {
	UserId      int64
	DashboardId int64

	Result bool
}

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 OAuthType

type OAuthType int
const (
	GITHUB OAuthType = iota + 1
	GOOGLE
	TWITTER
	GENERIC
	GRAFANANET
)

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"`
	Login  string `json:"login"`
	Role   string `json:"role"`
}

type Password

type Password string

func (Password) IsWeak

func (p Password) IsWeak() bool

type PauseAlertCommand

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

type PauseAllAlertCommand

type PauseAllAlertCommand struct {
	ResultCount int64
	Paused      bool
}

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 PlaylistDashboard

type PlaylistDashboard struct {
	Id    int64  `json:"id"`
	Slug  string `json:"slug"`
	Title string `json:"title"`
}

func (PlaylistDashboard) TableName

func (this PlaylistDashboard) TableName() string

type PlaylistDashboards

type PlaylistDashboards []*PlaylistDashboard

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 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
}

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
	Version         int
	HomeDashboardId int64
	Timezone        string
	Theme           string
	Created         time.Time
	Updated         time.Time
}

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
}

func GetQuotaScopes

func GetQuotaScopes(target string) ([]QuotaScope, error)

type RemoveOrgUserCommand

type RemoveOrgUserCommand struct {
	UserId int64
	OrgId  int64
}

type RoleType

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

func (RoleType) Includes

func (r RoleType) Includes(other RoleType) bool

func (RoleType) IsValid

func (r RoleType) IsValid() bool

func (*RoleType) UnmarshalJSON

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

type SaveAlertsCommand

type SaveAlertsCommand struct {
	DashboardId int64
	UserId      int64
	OrgId       int64

	Alerts []*Alert
}

type SaveDashboardCommand

type SaveDashboardCommand struct {
	Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
	UserId    int64            `json:"userId"`
	OrgId     int64            `json:"-"`
	Overwrite bool             `json:"overwrite"`
	PluginId  string           `json:"-"`

	Result *Dashboard
}

func (*SaveDashboardCommand) GetDashboardModel

func (cmd *SaveDashboardCommand) GetDashboardModel() *Dashboard

GetDashboardModel turns the command into the savable model

type SavePreferencesCommand

type SavePreferencesCommand struct {
	UserId int64
	OrgId  int64

	HomeDashboardId int64  `json:"homeDashboardId"`
	Timezone        string `json:"timezone"`
	Theme           string `json:"theme"`
}

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

type SearchHit

type SearchHit struct {
	Id        int64    `json:"id"`
	Title     string   `json:"title"`
	Uri       string   `json:"uri"`
	Type      string   `json:"type"`
	Tags      []string `json:"tags"`
	IsStarred bool     `json:"isStarred"`
}

type SearchOrgsQuery

type SearchOrgsQuery struct {
	Query string
	Name  string
	Limit int
	Page  int

	Result []*OrgDTO
}

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 {
	Query string
	Page  int
	Limit int

	Result SearchUserQueryResult
}

type SendEmailCommand

type SendEmailCommand struct {
	To           []string
	Template     string
	Subject      string
	Data         map[string]interface{}
	Info         string
	EmbededFiles []string
}

type SendEmailCommandSync

type SendEmailCommandSync struct {
	SendEmailCommand
}

type SendResetPasswordEmailCommand

type SendResetPasswordEmailCommand struct {
	User *User
}

type SendWebhookSync

type SendWebhookSync struct {
	Url        string
	User       string
	Password   string
	Body       string
	HttpMethod string
}

type SetAlertStateCommand

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

	Timestamp time.Time
}

type SetUserHelpFlagCommand

type SetUserHelpFlagCommand struct {
	HelpFlags1 HelpFlags1
	UserId     int64
}

type SetUsingOrgCommand

type SetUsingOrgCommand struct {
	UserId int64
	OrgId  int64
}

type SignedInUser

type SignedInUser struct {
	UserId         int64
	OrgId          int64
	OrgName        string
	OrgRole        RoleType
	Login          string
	Name           string
	Email          string
	ApiKeyId       int64
	IsGrafanaAdmin bool
	HelpFlags1     HelpFlags1
}

type Star

type Star struct {
	Id          int64
	UserId      int64
	DashboardId int64
}

type StarDashboardCommand

type StarDashboardCommand struct {
	UserId      int64
	DashboardId int64
}

type SystemStats

type SystemStats struct {
	DashboardCount int64
	UserCount      int64
	OrgCount       int64
	PlaylistCount  int64
	AlertCount     int64
}

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 time.Time
	Updated time.Time
}

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

type UnstarDashboardCommand

type UnstarDashboardCommand struct {
	UserId      int64
	DashboardId int64
}

type UpdateAlertNotificationCommand

type UpdateAlertNotificationCommand struct {
	Id        int64            `json:"id"  binding:"Required"`
	Name      string           `json:"name"  binding:"Required"`
	Type      string           `json:"type"  binding:"Required"`
	IsDefault bool             `json:"isDefault"`
	Settings  *simplejson.Json `json:"settings"  binding:"Required"`

	OrgId  int64 `json:"-"`
	Result *AlertNotification
}

type UpdateApiKeyCommand

type UpdateApiKeyCommand struct {
	Id   int64    `json:"id"`
	Name string   `json:"name"`
	Role RoleType `json:"role"`

	OrgId int64 `json:"-"`
}

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"`

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

Also acts as api DTO

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

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 UpdateTempUserStatusCommand

type UpdateTempUserStatusCommand struct {
	Code   string
	Status TempUserStatus
}

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 UpdateUserPermissionsCommand

type UpdateUserPermissionsCommand struct {
	IsGrafanaAdmin bool
	UserId         int64 `json:"-"`
}

type UpdateUserQuotaCmd

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

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

	IsAdmin bool
	OrgId   int64

	Created time.Time
	Updated time.Time
}

func (*User) NameOrFallback

func (u *User) NameOrFallback() string

type UserIdDTO

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

type UserOrgDTO

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

type UserProfileDTO

type UserProfileDTO struct {
	Email          string `json:"email"`
	Name           string `json:"name"`
	Login          string `json:"login"`
	Theme          string `json:"theme"`
	OrgId          int64  `json:"orgId"`
	IsGrafanaAdmin bool   `json:"isGrafanaAdmin"`
}

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

type ValidateResetPasswordCodeQuery

type ValidateResetPasswordCodeQuery struct {
	Code   string
	Result *User
}

Jump to

Keyboard shortcuts

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