Documentation
¶
Index ¶
- Constants
- Variables
- type AlertNotification
- type Client
- func (c *Client) AddOrgUser(orgId int64, user, role string) error
- func (c *Client) AddTeamMember(id string, userID int64) error
- func (c *Client) AlertNotification(id int64) (*AlertNotification, error)
- func (c *Client) CreateUser(user User) (int64, error)
- func (c *Client) Dashboard(slug string) (*Dashboard, error)
- func (c *Client) DashboardByUid(uid string) (*Dashboard, error)
- func (c *Client) DashboardsByFolder(folderId int64) ([]*SearchResultItem, error)
- func (c *Client) DataSource(id int64) (*DataSource, error)
- func (c *Client) DataSources() ([]*DataSource, error)
- func (c *Client) DeleteAlertNotification(id int64) error
- func (c *Client) DeleteDashboard(slug string) error
- func (c *Client) DeleteDataSource(id int64) error
- func (c *Client) DeleteFolder(id string) error
- func (c *Client) DeleteOrg(id int64) error
- func (c *Client) DeleteTeam(id string) error
- func (c *Client) DeleteUser(id int64) error
- func (c *Client) Folder(id int64) (*Folder, error)
- func (c *Client) Folders() ([]Folder, error)
- func (c *Client) GetDashboardIdByUid(uid string) (int64, error)
- func (c *Client) GetDashboardUidById(id int64) (string, error)
- func (c *Client) GetDashboardVersions(id int64) ([]*DashboardVersionItem, error)
- func (c *Client) GetFolderPermission(id string) ([]*FolderPermission, error)
- func (c *Client) GetOrgPreferences() (*OrgPreferences, error)
- func (c *Client) HomeDashboard() (*Dashboard, error)
- func (c *Client) NewAlertNotification(a *AlertNotification) (int64, error)
- func (c *Client) NewDashboard(dashboard Dashboard) (*DashboardSaveResponse, error)
- func (c *Client) NewDataSource(s *DataSource) (int64, error)
- func (c *Client) NewFolder(title string) (Folder, error)
- func (c *Client) NewOrg(name string) (int64, error)
- func (c *Client) NewTeam(name string) (Team, error)
- func (c *Client) Org(id int64) (Org, error)
- func (c *Client) OrgByName(name string) (Org, error)
- func (c *Client) OrgUsers(orgId int64) ([]OrgUser, error)
- func (c *Client) Orgs() ([]Org, error)
- func (c *Client) RemoveOrgUser(orgId, userId int64) error
- func (c *Client) RemoveTeamMember(id string, userID int64) error
- func (c *Client) SaveDashboard(model map[string]interface{}, overwrite bool) (*DashboardSaveResponse, error)deprecated
- func (c *Client) Team(id int64) (Team, error)
- func (c *Client) TeamMembers(id string) ([]*TeamMember, error)
- func (c *Client) Teams() ([]*Team, error)
- func (c *Client) UpdateAlertNotification(a *AlertNotification) error
- func (c *Client) UpdateDataSource(s *DataSource) error
- func (c *Client) UpdateFolder(id string, name string) error
- func (c *Client) UpdateFolderPermission(id string, list []*FolderPermission) error
- func (c *Client) UpdateOrg(id int64, name string) error
- func (c *Client) UpdateOrgPreferences(prefs *OrgPreferences) error
- func (c *Client) UpdateOrgUser(orgId, userId int64, role string) error
- func (c *Client) UpdateTeam(id string, name string) error
- func (c *Client) UpdateUser(userId int64, u UserUpdate) error
- func (c *Client) User(userId int64) (User, error)
- func (c *Client) UserByEmail(email string) (User, error)
- func (c *Client) Users() ([]User, error)
- type CreateTeamResponse
- type Dashboard
- type DashboardData
- type DashboardMeta
- type DashboardSaveResponse
- type DashboardVersion
- type DashboardVersionItem
- type DataSource
- type Folder
- type FolderPermission
- type JSONData
- type Org
- type OrgPreferences
- type OrgUser
- type Permission
- type PermissionType
- type SearchResultItem
- type SecureJSONData
- type Team
- type TeamMember
- type TeamSearchResponse
- type User
- type UserUpdate
Constants ¶
View Source
const ( SearchTypeFolder = "dash-folder" SearchTypeDashboard = "dash-db" )
Variables ¶
View Source
var (
ErrNotFound = errors.New("404 Not Found")
)
Functions ¶
This section is empty.
Types ¶
type AlertNotification ¶
type Client ¶
func New ¶
New creates a new grafana client auth can be in user:pass format, or it can be an api key
func (*Client) AlertNotification ¶
func (c *Client) AlertNotification(id int64) (*AlertNotification, error)
func (*Client) DashboardsByFolder ¶
func (c *Client) DashboardsByFolder(folderId int64) ([]*SearchResultItem, error)
func (*Client) DataSource ¶
func (c *Client) DataSource(id int64) (*DataSource, error)
func (*Client) DataSources ¶
func (c *Client) DataSources() ([]*DataSource, error)
func (*Client) DeleteAlertNotification ¶
func (*Client) DeleteDashboard ¶
func (*Client) DeleteDataSource ¶
func (*Client) DeleteFolder ¶
func (*Client) DeleteTeam ¶
func (*Client) DeleteUser ¶
func (*Client) GetDashboardIdByUid ¶
func (*Client) GetDashboardUidById ¶
Add this api to transform id to uid
func (*Client) GetDashboardVersions ¶
func (c *Client) GetDashboardVersions(id int64) ([]*DashboardVersionItem, error)
func (*Client) GetFolderPermission ¶
func (c *Client) GetFolderPermission(id string) ([]*FolderPermission, error)
func (*Client) GetOrgPreferences ¶
func (c *Client) GetOrgPreferences() (*OrgPreferences, error)
func (*Client) HomeDashboard ¶
func (*Client) NewAlertNotification ¶
func (c *Client) NewAlertNotification(a *AlertNotification) (int64, error)
func (*Client) NewDashboard ¶
func (c *Client) NewDashboard(dashboard Dashboard) (*DashboardSaveResponse, error)
func (*Client) NewDataSource ¶
func (c *Client) NewDataSource(s *DataSource) (int64, error)
func (*Client) RemoveOrgUser ¶
func (*Client) SaveDashboard
deprecated
func (c *Client) SaveDashboard(model map[string]interface{}, overwrite bool) (*DashboardSaveResponse, error)
Deprecated: use NewDashboard instead
func (*Client) TeamMembers ¶
func (c *Client) TeamMembers(id string) ([]*TeamMember, error)
func (*Client) UpdateAlertNotification ¶
func (c *Client) UpdateAlertNotification(a *AlertNotification) error
func (*Client) UpdateDataSource ¶
func (c *Client) UpdateDataSource(s *DataSource) error
func (*Client) UpdateFolderPermission ¶
func (c *Client) UpdateFolderPermission(id string, list []*FolderPermission) error
func (*Client) UpdateOrgPreferences ¶
func (c *Client) UpdateOrgPreferences(prefs *OrgPreferences) error
func (*Client) UpdateOrgUser ¶
func (*Client) UpdateUser ¶
func (c *Client) UpdateUser(userId int64, u UserUpdate) error
type CreateTeamResponse ¶
type CreateTeamResponse struct {
Id int64 `json:"teamId"`
}
type Dashboard ¶
type Dashboard struct {
Meta DashboardMeta `json:"meta"`
Model map[string]interface{} `json:"dashboard"`
Folder int64 `json:"folderId"`
Overwrite bool `json:overwrite`
}
type DashboardData ¶
type DashboardMeta ¶
type DashboardSaveResponse ¶
type DashboardVersion ¶
type DashboardVersion struct {
Id int64 `json:"id"`
Data *DashboardData `json:"data"`
}
type DashboardVersionItem ¶
type DataSource ¶
type DataSource struct {
Id int64 `json:"id,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
URL string `json:"url"`
Access string `json:"access"`
Database string `json:"database,omitempty"`
User string `json:"user,omitempty"`
Password string `json:"password,omitempty"`
OrgId int64 `json:"orgId,omitempty"`
IsDefault bool `json:"isDefault"`
BasicAuth bool `json:"basicAuth"`
BasicAuthUser string `json:"basicAuthUser,omitempty"`
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`
JSONData map[string]interface{} `json:"jsonData,omitempty"`
SecureJSONData SecureJSONData `json:"secureJsonData,omitempty"`
}
type FolderPermission ¶
type FolderPermission struct {
Role string `json:"role,omitempty"`
TeamId int64 `json:"teamId,omitempty"`
UserId int64 `json:"userId,omitempty"`
Permission PermissionType `json:"permission,omitempty"`
}
type JSONData ¶
type JSONData struct {
AssumeRoleArn string `json:"assumeRoleArn,omitempty"`
AuthType string `json:"authType,omitempty"`
CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"`
DefaultRegion string `json:"defaultRegion,omitempty"`
TlsSkipVerify bool `json:"tlsSkipVerify,omitempty"`
}
JSONData is a representation of the datasource `jsonData` property
type OrgPreferences ¶
type Permission ¶
type Permission struct {
Id int64 `json:"id,omitempty"`
FolderUid string `json:"folderUid,omitempty"`
UserId int64 `json:"userId,omitempty"`
TeamId int64 `json:"teamId,omitempty"`
Role string `json:"role,omitempty"`
Permission int `json:"permission,omitempty"`
IsFolder bool `json:"isFolder,omitempty"`
}
type PermissionType ¶
type PermissionType int8
const ( None PermissionType = 0 PermissionView PermissionType = 1 PermissionEdit PermissionType = 2 PermissionAdmin PermissionType = 4 )
func NewPermissionType ¶
func NewPermissionType(p int) (PermissionType, error)
func (*PermissionType) MarshalJSON ¶
func (d *PermissionType) MarshalJSON() ([]byte, error)
func (*PermissionType) String ¶
func (p *PermissionType) String() string
func (*PermissionType) UnmarshalJSON ¶
func (d *PermissionType) UnmarshalJSON(b []byte) error
func (*PermissionType) Value ¶
func (p *PermissionType) Value() int8
type SearchResultItem ¶
func (*SearchResultItem) IsFolder ¶
func (item *SearchResultItem) IsFolder() bool
func (*SearchResultItem) Slug ¶
func (item *SearchResultItem) Slug() string
type SecureJSONData ¶
type SecureJSONData struct {
AccessKey string `json:"accessKey,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
}
SecureJSONData is a representation of the datasource `secureJsonData` property
type TeamMember ¶
type TeamSearchResponse ¶
type UserUpdate ¶
Click to show internal directories.
Click to hide internal directories.