Documentation ¶
Index ¶
- Constants
- Variables
- type Address
- type Alert
- type AlertCondition
- type AlertEvaluator
- type AlertNotification
- type AlertOperator
- type AlertQuery
- type AlertReducer
- type AlertlistPanel
- type Annotation
- type AnnotationResponse
- type Axis
- type BarGaugePanel
- type Board
- type BoardProperties
- type BoolInt
- type BoolString
- type Client
- func (r *Client) AddActualOrgUser(ctx context.Context, userRole UserRole) (StatusMessage, error)
- func (r *Client) AddOrgUser(ctx context.Context, user UserRole, oid uint) (StatusMessage, error)
- func (r *Client) AddTeamMember(ctx context.Context, teamId uint, userId uint) (StatusMessage, error)
- func (c *Client) CreateAlertNotification(ctx context.Context, an AlertNotification) (int64, error)
- func (r *Client) CreateAnnotation(ctx context.Context, a CreateAnnotationRequest) (StatusMessage, error)
- func (r *Client) CreateDatasource(ctx context.Context, ds Datasource) (StatusMessage, error)
- func (r *Client) CreateFolder(ctx context.Context, f Folder) (Folder, error)
- func (r *Client) CreateOrg(ctx context.Context, org Org) (StatusMessage, error)
- func (r *Client) CreateSnapshot(ctx context.Context, a CreateSnapshotRequest) (StatusMessage, error)
- func (r *Client) CreateTeam(ctx context.Context, t Team) (StatusMessage, error)
- func (r *Client) CreateUser(ctx context.Context, user User) (StatusMessage, error)
- func (r *Client) DeleteActualOrgUser(ctx context.Context, uid uint) (StatusMessage, error)
- func (c *Client) DeleteAlertNotificationID(ctx context.Context, id uint) error
- func (c *Client) DeleteAlertNotificationUID(ctx context.Context, uid string) error
- func (r *Client) DeleteAnnotation(ctx context.Context, id uint) (StatusMessage, error)
- func (r *Client) DeleteDashboard(ctx context.Context, slug string) (StatusMessage, error)
- func (r *Client) DeleteDashboardByUID(ctx context.Context, uid string) (StatusMessage, error)
- func (r *Client) DeleteDatasource(ctx context.Context, id uint) (StatusMessage, error)
- func (r *Client) DeleteDatasourceByName(ctx context.Context, name string) (StatusMessage, error)
- func (r *Client) DeleteDatasourceByUID(ctx context.Context, uid string) (StatusMessage, error)
- func (r *Client) DeleteFolderByUID(ctx context.Context, UID string) (bool, error)
- func (r *Client) DeleteOrg(ctx context.Context, oid uint) (StatusMessage, error)
- func (r *Client) DeleteOrgUser(ctx context.Context, oid, uid uint) (StatusMessage, error)
- func (r *Client) DeleteTeam(ctx context.Context, id uint) (StatusMessage, error)
- func (r *Client) DeleteTeamMember(ctx context.Context, teamId uint, userId uint) (StatusMessage, error)
- func (r *Client) DeleteUser(ctx context.Context, uid uint) (StatusMessage, error)
- func (r *Client) GetActualOrg(ctx context.Context) (Org, error)
- func (r *Client) GetActualOrgPreferences(ctx context.Context) (Preferences, error)
- func (r *Client) GetActualOrgUsers(ctx context.Context) ([]OrgUser, error)
- func (r *Client) GetActualUser(ctx context.Context) (User, error)
- func (c *Client) GetAlertNotificationID(ctx context.Context, id uint) (AlertNotification, error)
- func (c *Client) GetAlertNotificationUID(ctx context.Context, uid string) (AlertNotification, error)
- func (c *Client) GetAllAlertNotifications(ctx context.Context) ([]AlertNotification, error)
- func (r *Client) GetAllDatasources(ctx context.Context) ([]Datasource, error)
- func (r *Client) GetAllFolders(ctx context.Context, params ...GetFolderParams) ([]Folder, error)
- func (r *Client) GetAllOrgs(ctx context.Context) ([]Org, error)
- func (r *Client) GetAllUsers(ctx context.Context) ([]User, error)
- func (r *Client) GetAnnotations(ctx context.Context, params ...GetAnnotationsParams) ([]AnnotationResponse, error)
- func (r *Client) GetDashboardBySlug(ctx context.Context, slug string) (Board, BoardProperties, error)
- func (r *Client) GetDashboardByUID(ctx context.Context, uid string) (Board, BoardProperties, error)
- func (r *Client) GetDashboardVersionsByDashboardID(ctx context.Context, dashboardID uint, params ...QueryParam) ([]DashboardVersion, error)
- func (r *Client) GetDatasource(ctx context.Context, id uint) (Datasource, error)
- func (r *Client) GetDatasourceByName(ctx context.Context, name string) (Datasource, error)
- func (r *Client) GetDatasourceByUID(ctx context.Context, uid string) (Datasource, error)
- func (r *Client) GetDatasourceTypes(ctx context.Context) (map[string]DatasourceType, error)
- func (r *Client) GetFolderByID(ctx context.Context, ID int) (Folder, error)
- func (r *Client) GetFolderByUID(ctx context.Context, UID string) (Folder, error)
- func (r *Client) GetFolderPermissions(ctx context.Context, folderUID string) ([]FolderPermission, error)
- func (r *Client) GetHealth(ctx context.Context) (HealthResponse, error)
- func (r *Client) GetOrgById(ctx context.Context, oid uint) (Org, error)
- func (r *Client) GetOrgByOrgName(ctx context.Context, name string) (Org, error)
- func (r *Client) GetOrgUsers(ctx context.Context, oid uint) ([]OrgUser, error)
- func (r *Client) GetRawDashboardBySlug(ctx context.Context, slug string) ([]byte, BoardProperties, error)
- func (r *Client) GetRawDashboardByUID(ctx context.Context, uid string) ([]byte, BoardProperties, error)
- func (r *Client) GetTeam(ctx context.Context, id uint) (Team, error)
- func (r *Client) GetTeamByName(ctx context.Context, name string) (Team, error)
- func (r *Client) GetTeamMembers(ctx context.Context, teamId uint) ([]TeamMember, error)
- func (r *Client) GetTeamPreferences(ctx context.Context, teamId uint) (TeamPreferences, error)
- func (r *Client) GetUser(ctx context.Context, id uint) (User, error)
- func (r *Client) LookupUser(ctx context.Context, loginOrEmail string) (User, error)
- func (r *Client) PatchAnnotation(ctx context.Context, id uint, a PatchAnnotationRequest) (StatusMessage, error)
- func (r *Client) Search(ctx context.Context, params ...SearchParam) ([]FoundBoard, error)
- func (r *Client) SearchDashboards(ctx context.Context, query string, starred bool, tags ...string) ([]FoundBoard, error)
- func (r *Client) SearchTeams(ctx context.Context, params ...SearchTeamParams) (PageTeams, error)
- func (r *Client) SearchUsersWithPaging(ctx context.Context, query *string, perpage, page *int) (PageUsers, error)
- func (r *Client) SetCustomHeader(key, value string)
- func (r *Client) SetCustomHeaders(headers map[string]string)
- func (r *Client) SetDashboard(ctx context.Context, board Board, params SetDashboardParams) (StatusMessage, error)
- func (r *Client) SetOrgIDHeader(oid uint)
- func (r *Client) SetRawDashboard(ctx context.Context, raw []byte) (StatusMessage, error)
- func (r *Client) SetRawDashboardWithParam(ctx context.Context, request RawBoardRequest) (StatusMessage, error)
- func (r *Client) SwitchActualUserContext(ctx context.Context, oid uint) (StatusMessage, error)
- func (r *Client) SwitchUserContext(ctx context.Context, uid uint, oid uint) (StatusMessage, error)
- func (r *Client) UpdateActualOrg(ctx context.Context, org Org) (StatusMessage, error)
- func (r *Client) UpdateActualOrgAddress(ctx context.Context, address Address) (StatusMessage, error)
- func (r *Client) UpdateActualOrgPreferences(ctx context.Context, prefs Preferences) (StatusMessage, error)
- func (r *Client) UpdateActualOrgUser(ctx context.Context, user UserRole, uid uint) (StatusMessage, error)
- func (c *Client) UpdateAlertNotificationID(ctx context.Context, an AlertNotification, id uint) error
- func (c *Client) UpdateAlertNotificationUID(ctx context.Context, an AlertNotification, uid string) error
- func (r *Client) UpdateDatasource(ctx context.Context, ds Datasource) (StatusMessage, error)
- func (r *Client) UpdateFolderByUID(ctx context.Context, f Folder) (Folder, error)
- func (r *Client) UpdateFolderPermissions(ctx context.Context, folderUID string, up ...FolderPermission) (StatusMessage, error)
- func (r *Client) UpdateOrg(ctx context.Context, org Org, oid uint) (StatusMessage, error)
- func (r *Client) UpdateOrgAddress(ctx context.Context, address Address, oid uint) (StatusMessage, error)
- func (r *Client) UpdateOrgUser(ctx context.Context, user UserRole, oid, uid uint) (StatusMessage, error)
- func (r *Client) UpdateTeam(ctx context.Context, id uint, t Team) (StatusMessage, error)
- func (r *Client) UpdateTeamPreferences(ctx context.Context, teamId uint, tp TeamPreferences) (StatusMessage, error)
- func (r *Client) UpdateUserPassword(ctx context.Context, password UserPassword, uid uint) (StatusMessage, error)
- func (r *Client) UpdateUserPermissions(ctx context.Context, permissions UserPermissions, uid uint) (StatusMessage, error)
- func (r *Client) WithOrgIDHeader(oid uint) *Client
- type Column
- type ColumnStyle
- type CommonPanel
- type CreateAnnotationRequest
- type CreateSnapshotRequest
- type Current
- type CustomPanel
- type DashboardVersion
- type DashlistPanel
- type Datasource
- type DatasourceType
- type ErrNotFound
- type FieldConfig
- type FieldConfigColor
- type FieldConfigCustom
- type FieldConfigDefaults
- type FloatString
- type Folder
- type FolderPermission
- type FoundBoard
- type Gauge
- type GetAnnotationsParams
- func WithAlertType() GetAnnotationsParams
- func WithAnnotationType() GetAnnotationsParams
- func WithDashboard(id uint) GetAnnotationsParams
- func WithEndTime(t time.Time) GetAnnotationsParams
- func WithLimit(limit uint) GetAnnotationsParams
- func WithPanel(id uint) GetAnnotationsParams
- func WithStartTime(t time.Time) GetAnnotationsParams
- func WithTag(tag string) GetAnnotationsParams
- func WithUser(id uint) GetAnnotationsParams
- type GetFolderParams
- type GraphPanel
- type HealthResponse
- type HeatmapPanel
- type Height
- type IntString
- type Legend
- type Link
- type MapType
- type Option
- type Options
- type Org
- type OrgUser
- type PageTeams
- type PageUsers
- type Panel
- func NewAlertlist(title string) *Panel
- func NewCustom(title string) *Panel
- func NewDashlist(title string) *Panel
- func NewGraph(title string) *Panel
- func NewHeatmap(title string) *Panel
- func NewPluginlist(title string) *Panel
- func NewSinglestat(title string) *Panel
- func NewStat(title string) *Panel
- func NewTable(title string) *Panel
- func NewText(title string) *Panel
- func NewTimeseries(title string) *Panel
- func (p *Panel) AddTarget(t *Target)
- func (p *Panel) GetTargets() *[]Target
- func (p *Panel) MarshalJSON() ([]byte, error)
- func (p *Panel) RepeatDatasourcesForEachTarget(dsNames ...string)
- func (p *Panel) RepeatTargetsForDatasources(dsNames ...string)
- func (p *Panel) ResetTargets()
- func (p *Panel) SetTarget(t *Target)
- func (p *Panel) UnmarshalJSON(b []byte) (err error)
- type PatchAnnotationRequest
- type PermissionType
- type PluginlistPanel
- type Preferences
- type QueryParam
- type RangeMap
- type RawBoardRequest
- type RoleType
- type Row
- func (r *Row) Add(panel *Panel)
- func (r *Row) AddCustom(data *CustomPanel)
- func (r *Row) AddDashlist(data *DashlistPanel)
- func (r *Row) AddGraph(data *GraphPanel)
- func (r *Row) AddSinglestat(data *SinglestatPanel)
- func (r *Row) AddStat(data *StatPanel)
- func (r *Row) AddTable(data *TablePanel)
- func (r *Row) AddText(data *TextPanel)
- type RowPanel
- type SearchParam
- func SearchDashboardID(dashboardID int) SearchParam
- func SearchFolderID(folderID int) SearchParam
- func SearchLimit(limit uint) SearchParam
- func SearchPage(page uint) SearchParam
- func SearchQuery(query string) SearchParam
- func SearchStarred(starred bool) SearchParam
- func SearchTag(tag string) SearchParam
- func SearchType(searchType SearchParamType) SearchParam
- type SearchParamType
- type SearchTeamParams
- type SeriesOverride
- type SetDashboardParams
- type SinglestatPanel
- type Sort
- type SparkLine
- type StackdriverAlignOption
- type StackdriverAlignOptions
- type StatPanel
- type StatusMessage
- type StringSliceString
- type TablePanel
- type Target
- type Team
- type TeamMember
- type TeamPreferences
- type TemplateVar
- type Templating
- type TextPanel
- type Threshold
- type ThresholdStep
- type Thresholds
- type Time
- type Timepicker
- type TimeseriesLegendOptions
- type TimeseriesOptions
- type TimeseriesPanel
- type TimeseriesTooltipOptions
- type Tooltip
- type User
- type UserPassword
- type UserPermissions
- type UserRole
- type ValueMap
Examples ¶
Constants ¶
const ( TemplatingHideNone = iota TemplatingHideLabel TemplatingHideVariable )
Constants for templating
const ( CustomType panelType = iota DashlistType GraphType TableType TextType PluginlistType AlertlistType SinglestatType StatType RowType BarGaugeType HeatmapType TimeseriesType )
Each panel may be one of these types.
const DefaultFolderId = 0
DefaultFolderId is the id of the general folder that is pre-created and cannot be removed.
const MixedSource = "-- Mixed --"
const PermissionAdmin = PermissionType(4)
const PermissionEdit = PermissionType(2)
const PermissionView = PermissionType(1)
Variables ¶
var DefaultHTTPClient = http.DefaultClient
DefaultHTTPClient initialized Grafana with appropriate conditions. It allows you globally redefine HTTP client.
var TeamNotFound = fmt.Errorf("team not found")
TeamNotFound is an error returned if the given team was not found.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { AlertRuleTags map[string]string `json:"alertRuleTags,omitempty"` Conditions []AlertCondition `json:"conditions,omitempty"` ExecutionErrorState string `json:"executionErrorState,omitempty"` Frequency string `json:"frequency,omitempty"` Handler int `json:"handler,omitempty"` Name string `json:"name,omitempty"` NoDataState string `json:"noDataState,omitempty"` Notifications []AlertNotification `json:"notifications,omitempty"` Message string `json:"message,omitempty"` For string `json:"for,omitempty"` }
type AlertCondition ¶
type AlertCondition struct { Evaluator AlertEvaluator `json:"evaluator,omitempty"` Operator AlertOperator `json:"operator,omitempty"` Query AlertQuery `json:"query,omitempty"` Reducer AlertReducer `json:"reducer,omitempty"` Type string `json:"type,omitempty"` }
type AlertEvaluator ¶
type AlertNotification ¶
type AlertNotification struct { ID int64 `json:"id,omitempty"` Name string `json:"name"` Type string `json:"type"` IsDefault bool `json:"isDefault"` DisableResolveMessage bool `json:"disableResolveMessage"` SendReminder bool `json:"sendReminder"` Frequency string `json:"frequency"` Settings interface{} `json:"settings"` UID string `json:"uid,omitempty"` }
AlertNotification as described in the doc https://grafana.com/docs/grafana/latest/http_api/alerting_notification_channels/
type AlertOperator ¶
type AlertOperator struct {
Type string `json:"type,omitempty"`
}
type AlertQuery ¶
type AlertQuery struct {
Params []string `json:"params,omitempty"`
}
type AlertReducer ¶
type AlertlistPanel ¶
type AlertlistPanel struct { OnlyAlertsOnDashboard bool `json:"onlyAlertsOnDashboard"` Show string `json:"show"` SortOrder int `json:"sortOrder"` Limit int `json:"limit"` StateFilter []string `json:"stateFilter"` NameFilter string `json:"nameFilter,omitempty"` DashboardTags []string `json:"dashboardTags,omitempty"` }
type Annotation ¶
type Annotation struct { Name string `json:"name"` Datasource interface{} `json:"datasource"` ShowLine bool `json:"showLine"` IconColor string `json:"iconColor"` LineColor string `json:"lineColor"` IconSize uint `json:"iconSize"` Enable bool `json:"enable"` Query string `json:"query"` Expr string `json:"expr"` Step string `json:"step"` TextField string `json:"textField"` TextFormat string `json:"textFormat"` TitleFormat string `json:"titleFormat"` TagsField string `json:"tagsField"` Tags []string `json:"tags"` TagKeys string `json:"tagKeys"` Type string `json:"type"` }
type AnnotationResponse ¶
type AnnotationResponse struct { ID uint `json:"id"` AlertID uint `json:"alertId"` DashboardID uint `json:"dashboardId,omitempty"` PanelID uint `json:"panelId,omitempty"` UserID uint `json:"userId,omitempty"` UserName string `json:"userName,omitempty"` NewState string `json:"newState,omitempty"` PrevState string `json:"prevState,omitempty"` Time int64 `json:"time,omitempty"` TimeEnd int64 `json:"timeEnd,omitempty"` Tags []string `json:"tags,omitempty"` Text string `json:"text,omitempty"` Type string `json:"type"` Data map[string]interface{} `json:"data"` }
AnnotationResponse is representation of an existing annotation
type Axis ¶
type Axis struct { Format string `json:"format"` LogBase int `json:"logBase"` Decimals int `json:"decimals,omitempty"` Max *FloatString `json:"max,omitempty"` Min *FloatString `json:"min,omitempty"` Show bool `json:"show"` Label string `json:"label,omitempty"` }
for a graph panel
type BarGaugePanel ¶
type BarGaugePanel struct { Options Options `json:"options"` Targets []Target `json:"targets,omitempty"` FieldConfig FieldConfig `json:"fieldConfig"` }
type Board ¶
type Board struct { ID uint `json:"id,omitempty"` UID string `json:"uid,omitempty"` Slug string `json:"slug"` Title string `json:"title"` OriginalTitle string `json:"originalTitle"` Tags []string `json:"tags"` Style string `json:"style"` Timezone string `json:"timezone"` Editable bool `json:"editable"` HideControls bool `json:"hideControls" graf:"hide-controls"` Panels []*Panel `json:"panels"` Rows []*Row `json:"rows"` Templating Templating `json:"templating"` Annotations struct { List []Annotation `json:"list"` } `json:"annotations"` Refresh *BoolString `json:"refresh,omitempty"` SchemaVersion uint `json:"schemaVersion"` Version uint `json:"version"` Links []Link `json:"links"` Time Time `json:"time"` Timepicker Timepicker `json:"timepicker"` GraphTooltip int `json:"graphTooltip,omitempty"` }
Board represents Grafana dashboard.
func NewBoard ¶
Example ¶
package main import ( "encoding/json" "fmt" sdk "github.com/kubermatic/grafanasdk" ) func main() { board := sdk.NewBoard("Sample dashboard title") board.ID = 1 row1 := board.AddRow("Sample row title") row1.Add(sdk.NewGraph("Sample graph")) graphWithDs := sdk.NewGraph("Sample graph 2") target := sdk.Target{ RefID: "A", Datasource: "Sample Source 1", Expr: "sample request 1"} graphWithDs.AddTarget(&target) row1.Add(graphWithDs) data, _ := json.MarshalIndent(board, "", " ") fmt.Printf("%s", data) }
Output: { "id": 1, "slug": "", "title": "Sample dashboard title", "originalTitle": "", "tags": null, "style": "dark", "timezone": "browser", "editable": true, "hideControls": false, "sharedCrosshair": false, "panels": null, "rows": [ { "title": "Sample row title", "showTitle": false, "collapse": false, "editable": true, "height": "250px", "panels": [ { "editable": false, "error": false, "gridPos": {}, "id": 1, "isNew": true, "renderer": "flot", "span": 12, "title": "Sample graph", "transparent": false, "type": "graph", "aliasColors": null, "bars": false, "fill": 0, "legend": { "alignAsTable": false, "avg": false, "current": false, "hideEmpty": false, "hideZero": false, "max": false, "min": false, "rightSide": false, "show": false, "total": false, "values": false }, "lines": false, "linewidth": 0, "nullPointMode": "connected", "percentage": false, "pointradius": 5, "points": false, "stack": false, "steppedLine": false, "tooltip": { "shared": false, "value_type": "" }, "x-axis": true, "y-axis": true, "xaxis": { "format": "", "logBase": 0, "show": false }, "yaxes": null }, { "editable": false, "error": false, "gridPos": {}, "id": 2, "isNew": true, "renderer": "flot", "span": 12, "title": "Sample graph 2", "transparent": false, "type": "graph", "aliasColors": null, "bars": false, "fill": 0, "legend": { "alignAsTable": false, "avg": false, "current": false, "hideEmpty": false, "hideZero": false, "max": false, "min": false, "rightSide": false, "show": false, "total": false, "values": false }, "lines": false, "linewidth": 0, "nullPointMode": "connected", "percentage": false, "pointradius": 5, "points": false, "stack": false, "steppedLine": false, "targets": [ { "refId": "A", "datasource": "Sample Source 1", "expr": "sample request 1" } ], "tooltip": { "shared": false, "value_type": "" }, "x-axis": true, "y-axis": true, "xaxis": { "format": "", "logBase": 0, "show": false }, "yaxes": null } ], "repeat": null } ], "templating": { "list": null }, "annotations": { "list": null }, "schemaVersion": 0, "version": 0, "links": null, "time": { "from": "", "to": "" }, "timepicker": { "refresh_intervals": null, "time_options": null } }
func (*Board) RemoveTags ¶
func (*Board) UpdateSlug ¶
type BoardProperties ¶
type BoardProperties struct { IsStarred bool `json:"isStarred,omitempty"` IsHome bool `json:"isHome,omitempty"` IsSnapshot bool `json:"isSnapshot,omitempty"` Type string `json:"type,omitempty"` CanSave bool `json:"canSave"` CanEdit bool `json:"canEdit"` CanStar bool `json:"canStar"` Slug string `json:"slug"` Expires time.Time `json:"expires"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` UpdatedBy string `json:"updatedBy"` CreatedBy string `json:"createdBy"` Version int `json:"version"` FolderID int `json:"folderId"` FolderTitle string `json:"folderTitle"` FolderURL string `json:"folderUrl"` }
BoardProperties keeps metadata of a dashboard.
type BoolString ¶
func (BoolString) MarshalJSON ¶
func (s BoolString) MarshalJSON() ([]byte, error)
func (*BoolString) UnmarshalJSON ¶
func (s *BoolString) UnmarshalJSON(raw []byte) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client uses Grafana REST API for interacting with Grafana server.
func NewClient ¶
NewClient initializes client for interacting with an instance of Grafana server; apiKeyOrBasicAuth accepts either 'username:password' basic authentication credentials, or a Grafana API key. If it is an empty string then no authentication is used.
func (*Client) AddActualOrgUser ¶
AddActualOrgUser adds a global user to the current organization. Reflects POST /api/org/users API call.
func (*Client) AddOrgUser ¶
AddOrgUser add user to organization with oid. Reflects POST /api/orgs/:orgId/users API call.
func (*Client) AddTeamMember ¶ added in v0.9.12
func (r *Client) AddTeamMember(ctx context.Context, teamId uint, userId uint) (StatusMessage, error)
AddTeamMember adds a member to a team. Reflects POST /api/teams/:teamId/members API call.
func (*Client) CreateAlertNotification ¶
CreateAlertNotification creates a new alert notification channel. Reflects POST /api/alert-notifications API call.
func (*Client) CreateAnnotation ¶
func (r *Client) CreateAnnotation(ctx context.Context, a CreateAnnotationRequest) (StatusMessage, error)
CreateAnnotation creates a new annotation from the annotation request
func (*Client) CreateDatasource ¶
func (r *Client) CreateDatasource(ctx context.Context, ds Datasource) (StatusMessage, error)
CreateDatasource creates a new datasource. Reflects POST /api/datasources API call.
func (*Client) CreateFolder ¶
CreateFolder create folders. Reflects POST /api/folders API call.
func (*Client) CreateOrg ¶
CreateOrg creates a new organization. It reflects POST /api/orgs API call.
func (*Client) CreateSnapshot ¶ added in v0.9.10
func (r *Client) CreateSnapshot(ctx context.Context, a CreateSnapshotRequest) (StatusMessage, error)
CreateAnnotation creates a new snapshot.
func (*Client) CreateTeam ¶ added in v0.9.12
CreateTeam creates a new team. Reflects POST /api/teams API call.
func (*Client) CreateUser ¶
CreateUser creates a new global user. Requires basic authentication and that the authenticated user is a Grafana Admin. Reflects POST /api/admin/users API call.
func (*Client) DeleteActualOrgUser ¶
DeleteActualOrgUser delete user in actual organization. Reflects DELETE /api/org/users/:userId API call.
func (*Client) DeleteAlertNotificationID ¶
DeleteAlertNotificationID deletes the specified alert notification channel. Reflects DELETE /api/alert-notifications/:id API call.
func (*Client) DeleteAlertNotificationUID ¶
DeleteAlertNotificationUID deletes the specified alert notification channel. Reflects DELETE /api/alert-notifications/uid/:uid API call.
func (*Client) DeleteAnnotation ¶
DeleteAnnotation deletes the annotation with id
func (*Client) DeleteDashboard ¶
DeleteDashboard deletes dashboard that selected by slug string. Grafana only can delete a dashboard in a database. File dashboards may be only loaded with HTTP API but not deteled.
Reflects DELETE /api/dashboards/db/:slug API call.
func (*Client) DeleteDashboardByUID ¶ added in v0.9.10
DeleteDashboard deletes dashboard by UID Reflects DELETE /api/dashboards/uid/:uid API call.
func (*Client) DeleteDatasource ¶
DeleteDatasource deletes an existing datasource by ID. Reflects DELETE /api/datasources/:datasourceId API call.
func (*Client) DeleteDatasourceByName ¶
DeleteDatasourceByName deletes an existing datasource by Name. Reflects DELETE /api/datasources/name/:datasourceName API call.
func (*Client) DeleteDatasourceByUID ¶ added in v0.9.5
DeleteDatasourceByUID deletes an existing datasource by UID. Reflects DELETE /api/datasources/uid/:datasourceUID API call.
func (*Client) DeleteFolderByUID ¶
DeleteFolderByUID deletes an existing folder by uid. Reflects DELETE /api/folders/:uid API call.
func (*Client) DeleteOrg ¶
DeleteOrg deletes the organization identified by the oid. Reflects DELETE /api/orgs/:orgId API call.
func (*Client) DeleteOrgUser ¶
DeleteOrgUser deletes the user specified by uid within the organization specified by oid. Reflects DELETE /api/orgs/:orgId/users/:userId API call.
func (*Client) DeleteTeam ¶ added in v0.9.12
DeleteTeam deletes a team. Reflects DELETE /api/teams/:id API call.
func (*Client) DeleteTeamMember ¶ added in v0.9.12
func (r *Client) DeleteTeamMember(ctx context.Context, teamId uint, userId uint) (StatusMessage, error)
DeleteTeamMember removes a ream member from a team by id. Reflects DELETE /api/teams/:teamId/:userId API call.
func (*Client) DeleteUser ¶ added in v0.9.13
DeleteUser deletes a global user Requires basic authentication and that the authenticated user ia Grafana Admin Reflects DELETE /api/admin/users/:userId API call.
func (*Client) GetActualOrg ¶
GetActualOrg gets current organization. It reflects GET /api/org API call.
func (*Client) GetActualOrgPreferences ¶
func (r *Client) GetActualOrgPreferences(ctx context.Context) (Preferences, error)
GetActualOrgPreferences gets preferences of the actual organization. It reflects GET /api/org/preferences API call.
func (*Client) GetActualOrgUsers ¶
GetActualOrgUsers get all users within the actual organisation. Reflects GET /api/org/users API call.
func (*Client) GetActualUser ¶
GetActualUser gets an actual user. Reflects GET /api/user API call.
func (*Client) GetAlertNotificationID ¶
GetAlertNotificationID gets the alert notification channel which has the specified id. Reflects GET /api/alert-notifications/:id API call.
func (*Client) GetAlertNotificationUID ¶
func (c *Client) GetAlertNotificationUID(ctx context.Context, uid string) (AlertNotification, error)
GetAlertNotificationUID gets the alert notification channel which has the specified uid. Reflects GET /api/alert-notifications/uid/:uid API call.
func (*Client) GetAllAlertNotifications ¶
func (c *Client) GetAllAlertNotifications(ctx context.Context) ([]AlertNotification, error)
GetAllAlertNotifications gets all alert notification channels. Reflects GET /api/alert-notifications API call.
func (*Client) GetAllDatasources ¶
func (r *Client) GetAllDatasources(ctx context.Context) ([]Datasource, error)
GetAllDatasources gets all datasources. Reflects GET /api/datasources API call.
func (*Client) GetAllFolders ¶
GetAllFolders gets all folders. Reflects GET /api/folders API call.
func (*Client) GetAllOrgs ¶
GetAllOrgs returns all organizations. It reflects GET /api/orgs API call.
func (*Client) GetAllUsers ¶
GetAllUsers gets all users. Reflects GET /api/users API call.
func (*Client) GetAnnotations ¶
func (r *Client) GetAnnotations(ctx context.Context, params ...GetAnnotationsParams) ([]AnnotationResponse, error)
GetAnnotations gets annotations matching the annotation parameters
func (*Client) GetDashboardBySlug ¶
func (r *Client) GetDashboardBySlug(ctx context.Context, slug string) (Board, BoardProperties, error)
GetDashboardBySlug loads a dashboard and its metadata from Grafana by dashboard slug.
For dashboards from a filesystem set "file/" prefix for slug. By default dashboards from a database assumed. Database dashboards may have "db/" prefix or may have not, it will be appended automatically.
Reflects GET /api/dashboards/db/:slug API call. Deprecated: since Grafana v5 you should use uids. Use GetDashboardByUID() for that.
func (*Client) GetDashboardByUID ¶
GetDashboardByUID loads a dashboard and its metadata from Grafana by dashboard uid.
Reflects GET /api/dashboards/uid/:uid API call.
func (*Client) GetDashboardVersionsByDashboardID ¶ added in v0.9.12
func (r *Client) GetDashboardVersionsByDashboardID(ctx context.Context, dashboardID uint, params ...QueryParam) ([]DashboardVersion, error)
GetDashboardVersionsByDashboardID reflects /api/dashboards/id/:dashboardId/versions API call
func (*Client) GetDatasource ¶
GetDatasource gets an datasource by ID. Reflects GET /api/datasources/:datasourceId API call.
func (*Client) GetDatasourceByName ¶
GetDatasourceByName gets an datasource by Name. Reflects GET /api/datasources/name/:datasourceName API call.
func (*Client) GetDatasourceByUID ¶ added in v0.9.4
GetDatasourceByUID gets an datasource by UID. Reflects GET /api/datasources/uid/:datasourceUID API call.
func (*Client) GetDatasourceTypes ¶
GetDatasourceTypes gets all available plugins for the datasources. Reflects GET /api/datasources/plugins API call.
func (*Client) GetFolderByID ¶
GetFolderByID gets folder by id. Reflects GET /api/folders/id/:id API call.
func (*Client) GetFolderByUID ¶
GetFolderByUID gets folder by uid. Reflects GET /api/folders/:uid API call.
func (*Client) GetFolderPermissions ¶ added in v0.9.12
func (r *Client) GetFolderPermissions(ctx context.Context, folderUID string) ([]FolderPermission, error)
GetFolderPermissions gets permissions for a folder. Reflects GET /api/folders/:uid/permissions API call.
func (*Client) GetHealth ¶
func (r *Client) GetHealth(ctx context.Context) (HealthResponse, error)
GetHealth retrieves the health of the grafana server Reflects GET BaseURL API call.
func (*Client) GetOrgById ¶
GetOrgById gets organization by organization Id. It reflects GET /api/orgs/:orgId API call.
func (*Client) GetOrgByOrgName ¶
GetOrgByOrgName gets organization by organization name. It reflects GET /api/orgs/name/:orgName API call.
func (*Client) GetOrgUsers ¶
GetOrgUsers gets the users for the organization specified by oid. Reflects GET /api/orgs/:orgId/users API call.
func (*Client) GetRawDashboardBySlug ¶
func (r *Client) GetRawDashboardBySlug(ctx context.Context, slug string) ([]byte, BoardProperties, error)
GetRawDashboardBySlug loads a dashboard and its metadata from Grafana by dashboard slug.
For dashboards from a filesystem set "file/" prefix for slug. By default dashboards from a database assumed. Database dashboards may have "db/" prefix or may have not, it will be appended automatically.
Reflects GET /api/dashboards/db/:slug API call. Deprecated: since Grafana v5 you should use uids. Use GetRawDashboardByUID() for that.
func (*Client) GetRawDashboardByUID ¶
func (r *Client) GetRawDashboardByUID(ctx context.Context, uid string) ([]byte, BoardProperties, error)
GetRawDashboardByUID loads a dashboard and its metadata from Grafana by dashboard uid.
Reflects GET /api/dashboards/uid/:uid API call.
func (*Client) GetTeam ¶ added in v0.9.12
GetTeam gets an team by ID. Reflects GET /api/teams/:id API call.
func (*Client) GetTeamByName ¶ added in v0.9.12
func (*Client) GetTeamMembers ¶ added in v0.9.12
GetTeamMembers gets the members of a team by id. Reflects GET /api/teams/:teamId/members API call.
func (*Client) GetTeamPreferences ¶ added in v0.9.12
GetTeamPreferences gets the preferences for a team by id. Reflects GET /api/teams/:teamId/preferences API call.
func (*Client) LookupUser ¶ added in v0.9.7
LookupUser gets single user by Username(login) or Email. Reflects GET /api/users/lookup?loginOrEmail=:loginOrEmail API call.
func (*Client) PatchAnnotation ¶
func (r *Client) PatchAnnotation(ctx context.Context, id uint, a PatchAnnotationRequest) (StatusMessage, error)
PatchAnnotation patches the annotation with id with the request
func (*Client) Search ¶
func (r *Client) Search(ctx context.Context, params ...SearchParam) ([]FoundBoard, error)
Search searches folders and dashboards with query params specified.
Reflects GET /api/search API call.
func (*Client) SearchDashboards ¶
func (r *Client) SearchDashboards(ctx context.Context, query string, starred bool, tags ...string) ([]FoundBoard, error)
SearchDashboards search dashboards by substring of their title. It allows restrict the result set with only starred dashboards and only for tags (logical OR applied to multiple tags).
Reflects GET /api/search API call. Deprecated: This interface does not allow for API extension and is out of date. Please use Search(SearchType(SearchTypeDashboard))
func (*Client) SearchTeams ¶ added in v0.9.12
SearchTeams search teams with optional parameters. Reflects GET /api/teams/search API call.
func (*Client) SearchUsersWithPaging ¶
func (r *Client) SearchUsersWithPaging(ctx context.Context, query *string, perpage, page *int) (PageUsers, error)
SearchUsersWithPaging search users with paging. query optional. query value is contained in one of the name, login or email fields. Query values with spaces need to be url encoded e.g. query=Jane%20Doe perpage optional. default 1000 page optional. default 1 http://docs.grafana.org/http_api/user/#search-users http://docs.grafana.org/http_api/user/#search-users-with-paging
Reflects GET /api/users/search API call.
func (*Client) SetCustomHeader ¶ added in v0.9.6
SetCustomHeader - set additional header that will be sent with each request
func (*Client) SetCustomHeaders ¶ added in v0.9.6
SetCustomHeaders - set additional headers that will be sent with each request
func (*Client) SetDashboard ¶
func (r *Client) SetDashboard(ctx context.Context, board Board, params SetDashboardParams) (StatusMessage, error)
SetDashboard updates existing dashboard or creates a new one. Set dasboard ID to nil to create a new dashboard. Set overwrite to true if you want to overwrite existing dashboard with newer version or with same dashboard title. Grafana only can create or update a dashboard in a database. File dashboards may be only loaded with HTTP API but not created or updated.
Reflects POST /api/dashboards/db API call.
func (*Client) SetOrgIDHeader ¶ added in v0.9.6
SetOrgIDHeader - set `X-Grafana-Org-Id` to specified value
func (*Client) SetRawDashboard ¶
SetRawDashboard updates existing dashboard or creates a new one. Contrary to SetDashboard() it accepts raw JSON instead of Board structure. Grafana only can create or update a dashboard in a database. File dashboards may be only loaded with HTTP API but not created or updated.
Reflects POST /api/dashboards/db API call.
func (*Client) SetRawDashboardWithParam ¶ added in v0.9.10
func (r *Client) SetRawDashboardWithParam(ctx context.Context, request RawBoardRequest) (StatusMessage, error)
SetRawDashboardWithParam sends the serialized along with request parameters
func (*Client) SwitchActualUserContext ¶
SwitchActualUserContext switches current user context to the given organization. Reflects POST /api/user/using/:organizationId API call.
func (*Client) SwitchUserContext ¶
SwitchUserContext switches user context to the given organization. Requires basic authentication and that the authenticated user is a Grafana Admin. Reflects POST /api/users/:userId/using/:organizationId API call.
func (*Client) UpdateActualOrg ¶
UpdateActualOrg updates current organization. It reflects PUT /api/org API call.
func (*Client) UpdateActualOrgAddress ¶
func (r *Client) UpdateActualOrgAddress(ctx context.Context, address Address) (StatusMessage, error)
UpdateActualOrgAddress updates current organization's address. It reflects PUT /api/org/address API call.
func (*Client) UpdateActualOrgPreferences ¶
func (r *Client) UpdateActualOrgPreferences(ctx context.Context, prefs Preferences) (StatusMessage, error)
UpdateActualOrgPreferences updates preferences of the actual organization. Reflects PUT /api/org/preferences API call.
func (*Client) UpdateActualOrgUser ¶
func (r *Client) UpdateActualOrgUser(ctx context.Context, user UserRole, uid uint) (StatusMessage, error)
UpdateActualOrgUser updates the existing user. Reflects POST /api/org/users/:userId API call.
func (*Client) UpdateAlertNotificationID ¶
func (c *Client) UpdateAlertNotificationID(ctx context.Context, an AlertNotification, id uint) error
UpdateAlertNotificationID updates the specified alert notification channel. Reflects PUT /api/alert-notifications/:id API call.
func (*Client) UpdateAlertNotificationUID ¶
func (c *Client) UpdateAlertNotificationUID(ctx context.Context, an AlertNotification, uid string) error
UpdateAlertNotificationUID updates the specified alert notification channel. Reflects PUT /api/alert-notifications/uid/:uid API call.
func (*Client) UpdateDatasource ¶
func (r *Client) UpdateDatasource(ctx context.Context, ds Datasource) (StatusMessage, error)
UpdateDatasource updates a datasource from data passed in argument. Reflects PUT /api/datasources/:datasourceId API call.
func (*Client) UpdateFolderByUID ¶
UpdateFolderByUID update folder by uid Reflects PUT /api/folders/:uid API call.
func (*Client) UpdateFolderPermissions ¶ added in v0.9.12
func (r *Client) UpdateFolderPermissions(ctx context.Context, folderUID string, up ...FolderPermission) (StatusMessage, error)
UpdateFolderPermissions update folders permission Reflects PUT /api/folders/:uid/permissions API call.
func (*Client) UpdateOrg ¶
UpdateOrg updates the organization identified by oid. It reflects PUT /api/orgs/:orgId API call.
func (*Client) UpdateOrgAddress ¶
func (r *Client) UpdateOrgAddress(ctx context.Context, address Address, oid uint) (StatusMessage, error)
UpdateOrgAddress updates the address of the organization identified by oid. It reflects PUT /api/orgs/:orgId/address API call.
func (*Client) UpdateOrgUser ¶
func (r *Client) UpdateOrgUser(ctx context.Context, user UserRole, oid, uid uint) (StatusMessage, error)
UpdateOrgUser updates the user specified by uid within the organization specified by oid. Reflects PATCH /api/orgs/:orgId/users/:userId API call.
func (*Client) UpdateTeam ¶ added in v0.9.12
UpdateTeam updates a team. Reflects PUT /api/teams/:id API call.
func (*Client) UpdateTeamPreferences ¶ added in v0.9.12
func (r *Client) UpdateTeamPreferences(ctx context.Context, teamId uint, tp TeamPreferences) (StatusMessage, error)
UpdateTeamPreferences updates the preferences for a team by id. Reflects PUT /api/teams/:teamId/preferences API call.
func (*Client) UpdateUserPassword ¶ added in v0.9.13
func (r *Client) UpdateUserPassword(ctx context.Context, password UserPassword, uid uint) (StatusMessage, error)
UpdateUserPassword updates the password of a global user. Requires basic authentication and that the authenticated user is a Grafana Admin. Reflects PUT /api/admin/users/:userId/password API call.
func (*Client) UpdateUserPermissions ¶
func (r *Client) UpdateUserPermissions(ctx context.Context, permissions UserPermissions, uid uint) (StatusMessage, error)
UpdateUserPermissions updates the permissions of a global user. Requires basic authentication and that the authenticated user is a Grafana Admin. Reflects PUT /api/admin/users/:userId/permissions API call.
func (*Client) WithOrgIDHeader ¶ added in v0.9.9
type ColumnStyle ¶
type ColumnStyle struct { Alias *string `json:"alias"` DateFormat *string `json:"dateFormat,omitempty"` Pattern string `json:"pattern"` Type string `json:"type"` ColorMode *string `json:"colorMode,omitempty"` Colors *[]string `json:"colors,omitempty"` Decimals *int `json:"decimals,omitempty"` Thresholds *[]string `json:"thresholds,omitempty"` Unit *string `json:"unit,omitempty"` MappingType int `json:"mappingType,omitempty"` ValueMaps []ValueMap `json:"valueMaps,omitempty"` Link bool `json:"link,omitempty"` LinkTooltip *string `json:"linkTooltip,omitempty"` LinkUrl *string `json:"linkUrl,omitempty"` LinkTargetBlank bool `json:"linkTargetBlank,omitempty"` }
for a table
type CommonPanel ¶
type CommonPanel struct { Datasource interface{} `json:"datasource,omitempty"` // metrics Editable bool `json:"editable"` Error bool `json:"error"` GridPos struct { H *int `json:"h,omitempty"` W *int `json:"w,omitempty"` X *int `json:"x,omitempty"` Y *int `json:"y,omitempty"` } `json:"gridPos,omitempty"` Height interface{} `json:"height,omitempty"` // general HideTimeOverride *bool `json:"hideTimeOverride,omitempty"` ID uint `json:"id"` IsNew bool `json:"isNew"` Links []Link `json:"links,omitempty"` // general MinSpan *float32 `json:"minSpan,omitempty"` // templating options OfType panelType `json:"-"` // it required for defining type of the panel Renderer *string `json:"renderer,omitempty"` // display styles Repeat *string `json:"repeat,omitempty"` // templating options // RepeatIteration *int64 `json:"repeatIteration,omitempty"` RepeatPanelID *uint `json:"repeatPanelId,omitempty"` ScopedVars map[string]struct { Selected bool `json:"selected"` Text string `json:"text"` Value string `json:"value"` } `json:"scopedVars,omitempty"` Span float32 `json:"span"` // general Title string `json:"title"` // general Description *string `json:"description,omitempty"` // general Transparent bool `json:"transparent"` Type string `json:"type"` Alert *Alert `json:"alert,omitempty"` }
type CreateAnnotationRequest ¶
type CreateAnnotationRequest struct { DashboardID uint `json:"dashboardId,omitempty"` PanelID uint `json:"panelId,omitempty"` Time int64 `json:"time,omitempty"` TimeEnd int64 `json:"timeEnd,omitempty"` Tags []string `json:"tags,omitempty"` Text string `json:"text,omitempty"` }
CreateAnnotationRequest is a request to create a new annotation
type CreateSnapshotRequest ¶ added in v0.9.10
type CreateSnapshotRequest struct { Expires uint `json:"expires"` Dashboard Board `json:"dashboard"` }
CreateSnapshotRequest is representation of a snapshot request.
type Current ¶
type Current struct { Tags []*string `json:"tags,omitempty"` Text *StringSliceString `json:"text"` Value interface{} `json:"value"` // TODO select more precise type }
for templateVar
type CustomPanel ¶
type CustomPanel map[string]interface{}
type DashboardVersion ¶ added in v0.9.12
type DashboardVersion struct { ID uint `json:"id"` DashboardID uint `json:"dashboardId"` ParentVersion uint `json:"parentVersion"` RestoredFrom uint `json:"restoredFrom"` Version uint `json:"version"` Created time.Time `json:"created"` CreatedBy string `json:"createdBy"` Message string `json:"message"` }
DashboardVersion represents a response from /api/dashboards/id/:dashboardId/versions API
type DashlistPanel ¶
type Datasource ¶
type Datasource struct { ID uint `json:"id"` UID string `json:"uid"` OrgID uint `json:"orgId"` Name string `json:"name"` Type string `json:"type"` TypeLogoURL string `json:"typeLogoUrl"` Access string `json:"access"` // direct or proxy URL string `json:"url"` Password *string `json:"password,omitempty"` User *string `json:"user,omitempty"` Database *string `json:"database,omitempty"` BasicAuth *bool `json:"basicAuth,omitempty"` ReadOnly *bool `json:"readOnly,omitempty"` BasicAuthUser *string `json:"basicAuthUser,omitempty"` BasicAuthPassword *string `json:"basicAuthPassword,omitempty"` IsDefault bool `json:"isDefault"` JSONData interface{} `json:"jsonData"` SecureJSONData interface{} `json:"secureJsonData"` }
Datasource as described in the doc http://docs.grafana.org/reference/http_api/#get-all-datasources
type DatasourceType ¶
type DatasourceType struct { Metrics bool `json:"metrics"` Module string `json:"module"` Name string `json:"name"` Partials struct { Query string `json:"query"` } `json:"datasource"` PluginType string `json:"pluginType"` ServiceName string `json:"serviceName"` Type string `json:"type"` }
Datasource type as described in http://docs.grafana.org/reference/http_api/#available-data-source-types
type ErrNotFound ¶ added in v0.9.4
type ErrNotFound struct {
Message string
}
ErrNotFound is the error returned when 404 HTTP status returned
func (ErrNotFound) Error ¶ added in v0.9.4
func (e ErrNotFound) Error() string
Error implements the error interface for ErrNotFound.
type FieldConfig ¶
type FieldConfig struct {
Defaults FieldConfigDefaults `json:"defaults"`
}
type FieldConfigColor ¶ added in v0.9.12
type FieldConfigCustom ¶ added in v0.9.12
type FieldConfigCustom struct { AxisLabel string `json:"axisLabel,omitempty"` AxisPlacement string `json:"axisPlacement"` AxisSoftMin *int `json:"axisSoftMin,omitempty"` AxisSoftMax *int `json:"axisSoftMax,omitempty"` BarAlignment int `json:"barAlignment"` DrawStyle string `json:"drawStyle"` FillOpacity int `json:"fillOpacity"` GradientMode string `json:"gradientMode"` LineInterpolation string `json:"lineInterpolation"` LineWidth int `json:"lineWidth"` PointSize int `json:"pointSize"` ShowPoints string `json:"showPoints"` SpanNulls bool `json:"spanNulls"` HideFrom struct { Legend bool `json:"legend"` Tooltip bool `json:"tooltip"` Viz bool `json:"viz"` } `json:"hideFrom"` LineStyle struct { Fill string `json:"fill"` } `json:"lineStyle"` ScaleDistribution struct { Type string `json:"type"` Log int `json:"log,omitempty"` } `json:"scaleDistribution"` Stacking struct { Group string `json:"group"` Mode string `json:"mode"` } `json:"stacking"` ThresholdsStyle struct { Mode string `json:"mode"` } `json:"thresholdsStyle"` }
type FieldConfigDefaults ¶ added in v0.9.12
type FieldConfigDefaults struct { Unit string `json:"unit"` Decimals *int `json:"decimals,omitempty"` Min *float64 `json:"min,omitempty"` Max *float64 `json:"max,omitempty"` Color FieldConfigColor `json:"color"` Thresholds Thresholds `json:"thresholds"` Custom FieldConfigCustom `json:"custom"` Links []Link `json:"links,omitempty"` }
type FloatString ¶
FloatString represents special type for json values that could be strings or ints: 100 or "100"
func NewFloatString ¶
func NewFloatString(i float64) *FloatString
func (*FloatString) MarshalJSON ¶
func (v *FloatString) MarshalJSON() ([]byte, error)
MarshalJSON implements custom marshalling for FloatString type
func (*FloatString) UnmarshalJSON ¶
func (v *FloatString) UnmarshalJSON(raw []byte) error
UnmarshalJSON implements custom unmarshalling for FloatString type
type Folder ¶
type Folder struct { ID int `json:"id"` UID string `json:"uid"` Title string `json:"title"` URL string `json:"url"` HasAcl bool `json:"hasAcl"` CanSave bool `json:"canSave"` CanEdit bool `json:"canEdit"` CanAdmin bool `json:"canAdmin"` CreatedBy string `json:"createdBy"` Created string `json:"created"` UpdatedBy string `json:"updatedBy"` Updated string `json:"updated"` Version int `json:"version"` Overwrite bool `json:"overwrite"` }
Folder as described in the doc https://grafana.com/docs/grafana/latest/http_api/folder/#get-all-folders
type FolderPermission ¶ added in v0.9.12
type FolderPermission struct { Id uint `json:"id"` FolderId uint `json:"folderId"` Created string `json:"created"` Updated string `json:"updated"` UserId uint `json:"userId,omitempty"` UserLogin string `json:"userLogin,omitempty"` UserEmail string `json:"userEmail,omitempty"` TeamId uint `json:"teamId,omitempty"` Team string `json:"team,omitempty"` Role string `json:"role,omitempty"` Permission PermissionType `json:"permission"` PermissionName string `json:"permissionName"` Uid string `json:"uid,omitempty"` Title string `json:"title,omitempty"` Slug string `json:"slug,omitempty"` IsFolder bool `json:"isFolder"` Url string `json:"url,omitempty"` }
type FoundBoard ¶
type FoundBoard struct { ID uint `json:"id"` UID string `json:"uid"` Title string `json:"title"` URI string `json:"uri"` URL string `json:"url"` Slug string `json:"slug"` Type string `json:"type"` Tags []string `json:"tags"` IsStarred bool `json:"isStarred"` FolderID int `json:"folderId"` FolderUID string `json:"folderUid"` FolderTitle string `json:"folderTitle"` FolderURL string `json:"folderUrl"` }
FoundBoard keeps result of search with metadata of a dashboard.
type Gauge ¶
type Gauge struct { MaxValue float32 `json:"maxValue"` MinValue float32 `json:"minValue"` Show bool `json:"show"` ThresholdLabels bool `json:"thresholdLabels"` ThresholdMarkers bool `json:"thresholdMarkers"` }
for a stat
type GetAnnotationsParams ¶
GetAnnotationsParams is the type for all options implementing query parameters https://grafana.com/docs/grafana/latest/http_api/annotations/#find-annotations
func WithAlertType ¶
func WithAlertType() GetAnnotationsParams
WithAlertType filters the type to alerts
func WithAnnotationType ¶
func WithAnnotationType() GetAnnotationsParams
WithAnnotationType filters the type to annotations
func WithDashboard ¶
func WithDashboard(id uint) GetAnnotationsParams
WithDashboard filters the response to the specified dashboard ID
func WithEndTime ¶
func WithEndTime(t time.Time) GetAnnotationsParams
WithEndTime filters the annotations to before the specified time
func WithLimit ¶
func WithLimit(limit uint) GetAnnotationsParams
WithLimit sets the max number of alerts to return
func WithPanel ¶
func WithPanel(id uint) GetAnnotationsParams
WithPanel filters the response to the specified panel ID
func WithStartTime ¶
func WithStartTime(t time.Time) GetAnnotationsParams
WithStartTime filters the annotations to after the specified time
func WithUser ¶
func WithUser(id uint) GetAnnotationsParams
WithUser filters the annotations to only be made by the specified user ID
type GetFolderParams ¶
GetFolderParams is the type for all options implementing query parameters
type GraphPanel ¶
type GraphPanel struct { AliasColors interface{} `json:"aliasColors"` // XXX Bars bool `json:"bars"` DashLength *uint `json:"dashLength,omitempty"` Dashes *bool `json:"dashes,omitempty"` Decimals *int `json:"decimals,omitempty"` Fill int `json:"fill"` Legend Legend `json:"legend,omitempty"` LeftYAxisLabel *string `json:"leftYAxisLabel,omitempty"` Lines bool `json:"lines"` Linewidth uint `json:"linewidth"` NullPointMode string `json:"nullPointMode"` Percentage bool `json:"percentage"` Pointradius float32 `json:"pointradius"` Points bool `json:"points"` RightYAxisLabel *string `json:"rightYAxisLabel,omitempty"` SeriesOverrides []SeriesOverride `json:"seriesOverrides,omitempty"` SpaceLength *uint `json:"spaceLength,omitempty"` Stack bool `json:"stack"` SteppedLine bool `json:"steppedLine"` Targets []Target `json:"targets,omitempty"` Thresholds []Threshold `json:"thresholds,omitempty"` TimeFrom *string `json:"timeFrom,omitempty"` TimeShift *string `json:"timeShift,omitempty"` Tooltip Tooltip `json:"tooltip"` XAxis bool `json:"x-axis,omitempty"` YAxis bool `json:"y-axis,omitempty"` YFormats []string `json:"y_formats,omitempty"` Xaxis Axis `json:"xaxis"` // was added in Grafana 4.x? Yaxes []Axis `json:"yaxes"` // was added in Grafana 4.x? FieldConfig *FieldConfig `json:"fieldConfig,omitempty"` }
type HealthResponse ¶
type HealthResponse struct { Commit string `json:"commit"` Database string `json:"database"` Version string `json:"version"` }
HealthResponse represents the health of grafana server
type HeatmapPanel ¶
type HeatmapPanel struct { Cards struct { CardPadding *float64 `json:"cardPadding"` CardRound *float64 `json:"cardRound"` } `json:"cards"` Color struct { CardColor string `json:"cardColor"` ColorScale string `json:"colorScale"` ColorScheme string `json:"colorScheme"` Exponent float64 `json:"exponent"` Min *float64 `json:"min,omitempty"` Max *float64 `json:"max,omitempty"` Mode string `json:"mode"` } `json:"color"` DataFormat string `json:"dataFormat"` HideZeroBuckets bool `json:"hideZeroBuckets"` HighlightCards bool `json:"highlightCards"` Legend struct { Show bool `json:"show"` } `json:"legend"` ReverseYBuckets bool `json:"reverseYBuckets"` Targets []Target `json:"targets,omitempty"` Tooltip struct { Show bool `json:"show"` ShowHistogram bool `json:"showHistogram"` } `json:"tooltip"` TooltipDecimals int `json:"tooltipDecimals"` XAxis struct { Show bool `json:"show"` } `json:"xAxis"` XBucketNumber *float64 `json:"xBucketNumber"` XBucketSize *string `json:"xBucketSize"` YAxis struct { Decimals *int `json:"decimals"` Format string `json:"format"` LogBase int `json:"logBase"` Show bool `json:"show"` Max *string `json:"max"` Min *string `json:"min"` SplitFactor *float64 `json:"splitFactor"` } `json:"yAxis"` YBucketBound string `json:"yBucketBound"` YBucketNumber *float64 `json:"yBucketNumber"` YBucketSize *float64 `json:"yBucketSize"` }
type Height ¶
type Height string
Height of rows maybe passed as number (ex 200) or as string (ex "200px") or empty string
func (*Height) UnmarshalJSON ¶
type IntString ¶
IntString represents special type for json values that could be strings or ints: 100 or "100"
func NewIntString ¶
func (*IntString) MarshalJSON ¶
MarshalJSON implements custom marshalling for IntString type
func (*IntString) UnmarshalJSON ¶
UnmarshalJSON implements custom unmarshalling for IntString type
type Legend ¶
type Legend struct { AlignAsTable bool `json:"alignAsTable"` Avg bool `json:"avg"` Current bool `json:"current"` HideEmpty bool `json:"hideEmpty"` HideZero bool `json:"hideZero"` Max bool `json:"max"` Min bool `json:"min"` RightSide bool `json:"rightSide"` Show bool `json:"show"` SideWidth *uint `json:"sideWidth,omitempty"` Total bool `json:"total"` Values bool `json:"values"` }
for a graph panel
type Link ¶
type Link struct { Title string `json:"title"` Type string `json:"type"` AsDropdown *bool `json:"asDropdown,omitempty"` DashURI *string `json:"dashUri,omitempty"` Dashboard *string `json:"dashboard,omitempty"` Icon *string `json:"icon,omitempty"` IncludeVars bool `json:"includeVars"` KeepTime *bool `json:"keepTime,omitempty"` Params *string `json:"params,omitempty"` Tags []string `json:"tags,omitempty"` TargetBlank *bool `json:"targetBlank,omitempty"` Tooltip *string `json:"tooltip,omitempty"` URL *string `json:"url,omitempty"` }
Link represents link to another dashboard or external weblink
type Option ¶
type Option struct { Text string `json:"text"` Value string `json:"value"` Selected bool `json:"selected"` }
for templateVar
type Options ¶
type Options struct { Orientation string `json:"orientation"` TextMode string `json:"textMode"` ColorMode string `json:"colorMode"` GraphMode string `json:"graphMode"` JustifyMode string `json:"justifyMode"` DisplayMode string `json:"displayMode"` Content string `json:"content"` Mode string `json:"mode"` ReduceOptions struct { Values bool `json:"values"` Fields string `json:"fields"` Calcs []string `json:"calcs"` } `json:"reduceOptions"` }
type Panel ¶
type Panel struct { CommonPanel // Should be initialized only one type of panels. // OfType field defines which of types below will be used. *GraphPanel *TablePanel *TextPanel *SinglestatPanel *StatPanel *DashlistPanel *PluginlistPanel *RowPanel *AlertlistPanel *BarGaugePanel *HeatmapPanel *TimeseriesPanel *CustomPanel }
Panel represents panels of different types defined in Grafana.
func NewAlertlist ¶
func NewDashlist ¶
NewDashlist initializes panel with a dashlist panel.
func NewHeatmap ¶
func NewPluginlist ¶
NewPluginlist initializes panel with a stat panel.
func NewSinglestat ¶
NewSinglestat initializes panel with a singlestat panel.
func NewTimeseries ¶ added in v0.9.12
NewTimeseries initializes panel with a timeseries panel.
func (*Panel) AddTarget ¶
AddTarget adds a new target as defined in the argument but with refId letter incremented. Value of refID from the argument will be used only if no target with such value already exists.
func (*Panel) GetTargets ¶
GetTargets is iterate over all panel targets. It just returns nil if no targets defined for panel of concrete type.
func (*Panel) MarshalJSON ¶
func (*Panel) RepeatDatasourcesForEachTarget ¶
MapDatasources on all existing targets for the panel.
func (*Panel) RepeatTargetsForDatasources ¶
RepeatTargetsForDatasources repeats all existing targets for a panel for all provided in the argument datasources. Existing datasources of targets are ignored.
func (*Panel) ResetTargets ¶
func (p *Panel) ResetTargets()
ResetTargets delete all targets defined for a panel.
func (*Panel) SetTarget ¶
SetTarget updates a target if target with such refId exists or creates a new one.
func (*Panel) UnmarshalJSON ¶
type PatchAnnotationRequest ¶
type PatchAnnotationRequest struct { Time int64 `json:"time,omitempty"` TimeEnd int64 `json:"timeEnd,omitempty"` Tags []string `json:"tags,omitempty"` Text string `json:"text,omitempty"` }
PatchAnnotationRequest is a request to patch an existing annotation
type PermissionType ¶ added in v0.9.12
type PermissionType uint
type PluginlistPanel ¶
type PluginlistPanel struct {
Limit int `json:"limit,omitempty"`
}
type Preferences ¶
type QueryParam ¶ added in v0.9.12
QueryParam is a type for specifying arbitrary API parameters
func QueryParamLimit ¶ added in v0.9.12
func QueryParamLimit(limit uint) QueryParam
QueryParamLimit sets `limit` parameter
func QueryParamStart ¶ added in v0.9.12
func QueryParamStart(start uint) QueryParam
QueryParamStart sets `start` parameter
type RawBoardRequest ¶ added in v0.9.10
type RawBoardRequest struct { Dashboard []byte Parameters SetDashboardParams }
RawBoardRequest struct that wraps Board and parameters being sent
func (RawBoardRequest) MarshalJSON ¶ added in v0.9.10
func (d RawBoardRequest) MarshalJSON() ([]byte, error)
MarshalJSON serializes the request to match the expectations of the grafana API. Additionally, if preseveID is false, then the dashboard id is set to 0
type RoleType ¶ added in v0.9.11
type RoleType string
RoleType is an alias for github.com/grafana/grafana/pkg/models.RoleType, copied here to avoid having to introduce a dependency on Grafana, as Grafana is not very Go-import-friendly.
type Row ¶
type Row struct { Title string `json:"title"` ShowTitle bool `json:"showTitle"` Collapse bool `json:"collapse"` Editable bool `json:"editable"` Height Height `json:"height"` Panels []Panel `json:"panels"` Repeat *string `json:"repeat"` }
Row represents single row of Grafana dashboard.
func (*Row) AddCustom ¶
func (r *Row) AddCustom(data *CustomPanel)
func (*Row) AddDashlist ¶
func (r *Row) AddDashlist(data *DashlistPanel)
func (*Row) AddGraph ¶
func (r *Row) AddGraph(data *GraphPanel)
func (*Row) AddSinglestat ¶
func (r *Row) AddSinglestat(data *SinglestatPanel)
func (*Row) AddTable ¶
func (r *Row) AddTable(data *TablePanel)
type SearchParam ¶
SearchParam is a type for specifying Search params.
func SearchDashboardID ¶
func SearchDashboardID(dashboardID int) SearchParam
SearchDashboardID specifies Search dashboard id's to search for. Can be specified multiple times, logical OR is applied.
func SearchFolderID ¶
func SearchFolderID(folderID int) SearchParam
SearchFolderID specifies Search folder id's to search for. Can be specified multiple times, logical OR is applied.
func SearchLimit ¶
func SearchLimit(limit uint) SearchParam
SearchLimit specifies maximum number of results from Search query. As of grafana 6.7 it has to be <= 5000. 0 stands for absence of parameter in a query. Specifying it multiple times is futile, only last one will be sent.
func SearchPage ¶
func SearchPage(page uint) SearchParam
SearchPage specifies Search page number to be queried for. Zero page is silently ignored, page numbers start from one. Specifying it multiple times is futile, only last one will be sent.
func SearchQuery ¶
func SearchQuery(query string) SearchParam
SearchQuery specifies Search search query. Empty query is silently ignored. Specifying it multiple times is futile, only last one will be sent.
func SearchStarred ¶
func SearchStarred(starred bool) SearchParam
SearchStarred specifies if Search should search for starred dashboards only. Specifying it multiple times is futile, only last one will be sent.
func SearchTag ¶
func SearchTag(tag string) SearchParam
SearchTag specifies Search tag to search for. Empty tag is silently ignored. Can be specified multiple times, logical OR is applied.
func SearchType ¶
func SearchType(searchType SearchParamType) SearchParam
SearchType specifies Search type to search for. Specifying it multiple times is futile, only last one will be sent.
type SearchParamType ¶
type SearchParamType string
SearchParamType is a type accepted by SearchType func.
const ( SearchTypeFolder SearchParamType = "dash-folder" SearchTypeDashboard SearchParamType = "dash-db" )
Search entities to be used with SearchType().
type SearchTeamParams ¶ added in v0.9.12
SearchTeamParams is the type for all options implementing query parameters perpage optional. default 1000 page optional. default 1 http://docs.grafana.org/http_api/team/#search-teams http://docs.grafana.org/http_api/team/#search-teams-with-paging
func WithPage ¶ added in v0.9.12
func WithPage(page uint) SearchTeamParams
WithPage adds a page number query parameter
func WithPagesize ¶ added in v0.9.12
func WithPagesize(size uint) SearchTeamParams
WithPagesize adds a page size query parameter
func WithQuery ¶ added in v0.9.12
func WithQuery(query string) SearchTeamParams
WithQuery adds a query parameter
func WithTeam ¶ added in v0.9.12
func WithTeam(team string) SearchTeamParams
WithTeam adds a query parameter
type SeriesOverride ¶
type SeriesOverride struct { Alias string `json:"alias"` Bars *bool `json:"bars,omitempty"` Color *string `json:"color,omitempty"` Dashes *bool `json:"dashes,omitempty"` Fill *int `json:"fill,omitempty"` FillBelowTo *string `json:"fillBelowTo,omitempty"` Legend *bool `json:"legend,omitempty"` Lines *bool `json:"lines,omitempty"` LineWidth *int `json:"linewidth,omitempty"` Stack *BoolString `json:"stack,omitempty"` Transform *string `json:"transform,omitempty"` YAxis *int `json:"yaxis,omitempty"` ZIndex *int `json:"zindex,omitempty"` NullPointMode *string `json:"nullPointMode,omitempty"` }
for a graph panel
type SetDashboardParams ¶
SetDashboardParams contains the extra parameters that affects where and how the dashboard will be stored
type SinglestatPanel ¶
type SinglestatPanel struct { Colors []string `json:"colors"` ColorValue bool `json:"colorValue"` ColorBackground bool `json:"colorBackground"` Decimals int `json:"decimals"` Format string `json:"format"` Gauge Gauge `json:"gauge,omitempty"` MappingType *uint `json:"mappingType,omitempty"` MappingTypes []*MapType `json:"mappingTypes,omitempty"` MaxDataPoints *IntString `json:"maxDataPoints,omitempty"` NullPointMode string `json:"nullPointMode"` Postfix *string `json:"postfix,omitempty"` PostfixFontSize *string `json:"postfixFontSize,omitempty"` Prefix *string `json:"prefix,omitempty"` PrefixFontSize *string `json:"prefixFontSize,omitempty"` RangeMaps []*RangeMap `json:"rangeMaps,omitempty"` SparkLine SparkLine `json:"sparkline,omitempty"` Targets []Target `json:"targets,omitempty"` Thresholds string `json:"thresholds"` ValueFontSize string `json:"valueFontSize"` ValueMaps []ValueMap `json:"valueMaps"` ValueName string `json:"valueName"` }
type SparkLine ¶
type SparkLine struct { FillColor *string `json:"fillColor,omitempty"` Full bool `json:"full,omitempty"` LineColor *string `json:"lineColor,omitempty"` Show bool `json:"show,omitempty"` YMin *float64 `json:"ymin,omitempty"` YMax *float64 `json:"ymax,omitempty"` }
for a stat
type StackdriverAlignOption ¶
type StackdriverAlignOption struct { Label string `json:"label"` MetricKinds []string `json:"metricKinds"` Text string `json:"text"` Value string `json:"value"` ValueTypes []string `json:"valueTypes"` }
StackdriverAlignOption defines a single alignment option shown in Grafana during query configuration.
type StackdriverAlignOptions ¶
type StackdriverAlignOptions struct { Expanded bool `json:"expanded"` Label string `json:"label"` Options []StackdriverAlignOption `json:"options"` }
StackdriverAlignOptions defines the list of alignment options shown in Grafana during query configuration.
type StatPanel ¶
type StatPanel struct { Colors []string `json:"colors"` ColorValue bool `json:"colorValue"` ColorBackground bool `json:"colorBackground"` Decimals int `json:"decimals"` Format string `json:"format"` FieldConfig *FieldConfig `json:"fieldConfig,omitempty"` Gauge Gauge `json:"gauge,omitempty"` MappingType *uint `json:"mappingType,omitempty"` MappingTypes []*MapType `json:"mappingTypes,omitempty"` MaxDataPoints *IntString `json:"maxDataPoints,omitempty"` NullPointMode string `json:"nullPointMode"` Postfix *string `json:"postfix,omitempty"` PostfixFontSize *string `json:"postfixFontSize,omitempty"` Prefix *string `json:"prefix,omitempty"` PrefixFontSize *string `json:"prefixFontSize,omitempty"` RangeMaps []*RangeMap `json:"rangeMaps,omitempty"` SparkLine SparkLine `json:"sparkline,omitempty"` Targets []Target `json:"targets,omitempty"` Thresholds string `json:"thresholds"` ValueFontSize string `json:"valueFontSize"` ValueMaps []ValueMap `json:"valueMaps"` ValueName string `json:"valueName"` Options Options `json:"options"` }
type StatusMessage ¶
type StatusMessage struct { ID *uint `json:"id"` OrgID *uint `json:"orgId"` Message *string `json:"message"` Slug *string `json:"slug"` Version *int `json:"version"` Status *string `json:"status"` UID *string `json:"uid"` URL *string `json:"url"` }
StatusMessage reflects status message as it returned by Grafana REST API.
type StringSliceString ¶
StringSliceString represents special type for json values that could be strings or slice of strings: "something" or ["something"].
func (*StringSliceString) MarshalJSON ¶
func (v *StringSliceString) MarshalJSON() ([]byte, error)
MarshalJSON implements custom marshalling for StringSliceString type.
func (*StringSliceString) UnmarshalJSON ¶
func (v *StringSliceString) UnmarshalJSON(raw []byte) error
UnmarshalJSON implements custom unmarshalling for StringSliceString type.
type TablePanel ¶
type Target ¶
type Target struct { RefID string `json:"refId"` Datasource interface{} `json:"datasource,omitempty"` Hide bool `json:"hide,omitempty"` // For PostgreSQL Table string `json:"table,omitempty"` TimeColumn string `json:"timeColumn,omitempty"` MetricColumn string `json:"metricColumn,omitempty"` RawSql string `json:"rawSql,omitempty"` Select [][]struct { Params []string `json:"params,omitempty"` Type string `json:"type,omitempty"` } `json:"select,omitempty"` Where []struct { Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Params []string `json:"params,omitempty"` Datatype string `json:"datatype,omitempty"` } `json:"where,omitempty"` Group []struct { Type string `json:"type,omitempty"` Params []string `json:"params,omitempty"` } `json:"group,omitempty"` // For Prometheus Expr string `json:"expr,omitempty"` IntervalFactor int `json:"intervalFactor,omitempty"` Interval string `json:"interval,omitempty"` Step int `json:"step,omitempty"` LegendFormat string `json:"legendFormat,omitempty"` Instant bool `json:"instant,omitempty"` Format string `json:"format,omitempty"` // For InfluxDB Measurement string `json:"measurement,omitempty"` // For Elasticsearch DsType *string `json:"dsType,omitempty"` Metrics []struct { ID string `json:"id"` Field string `json:"field"` Type string `json:"type"` } `json:"metrics,omitempty"` Query string `json:"query,omitempty"` Alias string `json:"alias,omitempty"` RawQuery bool `json:"rawQuery,omitempty"` TimeField string `json:"timeField,omitempty"` BucketAggs []struct { ID string `json:"id"` Field string `json:"field"` Type string `json:"type"` Settings struct { Interval string `json:"interval,omitempty"` MinDocCount interface{} `json:"min_doc_count"` Order string `json:"order,omitempty"` OrderBy string `json:"orderBy,omitempty"` Size string `json:"size,omitempty"` } `json:"settings"` } `json:"bucketAggs,omitempty"` // For Graphite Target string `json:"target,omitempty"` // For CloudWatch Namespace string `json:"namespace,omitempty"` MetricName string `json:"metricName,omitempty"` Statistics []string `json:"statistics,omitempty"` Dimensions map[string]string `json:"dimensions,omitempty"` Period string `json:"period,omitempty"` Region string `json:"region,omitempty"` // For the Stackdriver data source. Find out more information at // https:/grafana.com/docs/grafana/v6.0/features/datasources/stackdriver/ ProjectName string `json:"projectName,omitempty"` AlignOptions []StackdriverAlignOptions `json:"alignOptions,omitempty"` AliasBy string `json:"aliasBy,omitempty"` MetricType string `json:"metricType,omitempty"` MetricKind string `json:"metricKind,omitempty"` Filters []string `json:"filters,omitempty"` AlignmentPeriod string `json:"alignmentPeriod,omitempty"` CrossSeriesReducer string `json:"crossSeriesReducer,omitempty"` PerSeriesAligner string `json:"perSeriesAligner,omitempty"` ValueType string `json:"valueType,omitempty"` GroupBy []string `json:"groupBy,omitempty"` Tags []struct { Key string `json:"key,omitempty"` Operator string `json:"operator,omitempty"` Value string `json:"value,omitempty"` } `json:"tags,omitempty"` }
for an any panel
type TeamMember ¶ added in v0.9.12
type TeamPreferences ¶ added in v0.9.12
type TemplateVar ¶
type TemplateVar struct { Name string `json:"name"` Type string `json:"type"` Auto bool `json:"auto,omitempty"` AutoCount *int `json:"auto_count,omitempty"` Datasource interface{} `json:"datasource"` Refresh BoolInt `json:"refresh"` Options []Option `json:"options"` IncludeAll bool `json:"includeAll"` AllFormat string `json:"allFormat"` AllValue string `json:"allValue"` Multi bool `json:"multi"` MultiFormat string `json:"multiFormat"` Query interface{} `json:"query"` Regex string `json:"regex"` Current Current `json:"current"` Label string `json:"label"` Hide uint8 `json:"hide"` Sort int `json:"sort"` }
type Templating ¶
type Templating struct {
List []TemplateVar `json:"list"`
}
type TextPanel ¶
type TextPanel struct { Content string `json:"content"` Mode string `json:"mode"` PageSize uint `json:"pageSize"` Scroll bool `json:"scroll"` ShowHeader bool `json:"showHeader"` Sort Sort `json:"sort"` Styles []ColumnStyle `json:"styles"` FieldConfig FieldConfig `json:"fieldConfig"` Options struct { Content string `json:"content"` Mode string `json:"mode"` } `json:"options"` }
type Threshold ¶
type Threshold struct { // the alert threshold value, we do not omitempty, since 0 is a valid // threshold Value float32 `json:"value"` // critical, warning, ok, custom ColorMode string `json:"colorMode,omitempty"` // gt or lt Op string `json:"op,omitempty"` Fill bool `json:"fill"` Line bool `json:"line"` // hexadecimal color (e.g. #629e51, only when ColorMode is "custom") FillColor string `json:"fillColor,omitempty"` // hexadecimal color (e.g. #629e51, only when ColorMode is "custom") LineColor string `json:"lineColor,omitempty"` // left or right Yaxis string `json:"yaxis,omitempty"` }
type ThresholdStep ¶ added in v0.9.12
type Thresholds ¶ added in v0.9.12
type Thresholds struct { Mode string `json:"mode"` Steps []ThresholdStep `json:"steps"` }
type Timepicker ¶
type TimeseriesLegendOptions ¶ added in v0.9.12
type TimeseriesOptions ¶ added in v0.9.12
type TimeseriesOptions struct { Legend TimeseriesLegendOptions `json:"legend,omitempty"` Tooltip TimeseriesTooltipOptions `json:"tooltip,omitempty"` }
type TimeseriesPanel ¶ added in v0.9.12
type TimeseriesPanel struct { Targets []Target `json:"targets,omitempty"` Options TimeseriesOptions `json:"options"` FieldConfig FieldConfig `json:"fieldConfig"` }
type TimeseriesTooltipOptions ¶ added in v0.9.12
type TimeseriesTooltipOptions struct {
Mode string `json:"mode"`
}
type User ¶
type User struct { ID uint `json:"id"` Login string `json:"login"` Name string `json:"name"` Email string `json:"email"` OrgID uint `json:"orgId"` Theme string `json:"theme"` Password string `json:"password"` IsDisabled bool `json:"isDisabled"` AuthLabels []string `json:"authLabels"` IsGrafanaAdmin bool `json:"isGrafanaAdmin"` IsExternal bool `json:"isExternal"` IsAdmin bool `json:"isAdmin"` //Different value used for Search Endpoint }
type UserPassword ¶ added in v0.9.13
type UserPassword struct {
Password string `json:"password"`
}
type UserPermissions ¶
type UserPermissions struct {
IsGrafanaAdmin bool `json:"isGrafanaAdmin"`
}
Source Files ¶
- address.go
- alertnotification.go
- annotation.go
- board.go
- constants.go
- custom-types.go
- datasource.go
- errors.go
- folder-permissions.go
- folder.go
- org.go
- panel.go
- preferences.go
- rest-admin.go
- rest-alertnotification.go
- rest-annotation.go
- rest-dashboard.go
- rest-datasource.go
- rest-folder-permissions.go
- rest-folder.go
- rest-get_health.go
- rest-org.go
- rest-request.go
- rest-snapshot.go
- rest-team.go
- rest-user.go
- row.go
- snapshot.go
- team.go
- user.go
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
backup-dashboards
This is a simple example of usage of Grafana client for copying dashboards and saving them to a disk.
|
This is a simple example of usage of Grafana client for copying dashboards and saving them to a disk. |
backup-datasources
This is a simple example of usage of Grafana client for copying dashboards and saving them to a disk.
|
This is a simple example of usage of Grafana client for copying dashboards and saving them to a disk. |
import-dashboards
This is a simple example of usage of Grafana client for importing dashboards from a bunch of JSON files (current dir used).
|
This is a simple example of usage of Grafana client for importing dashboards from a bunch of JSON files (current dir used). |
import-dashboards-raw
This is a simple example of usage of Grafana sdk for importing dashboards from a bunch of JSON files (current dir used).
|
This is a simple example of usage of Grafana sdk for importing dashboards from a bunch of JSON files (current dir used). |
import-datasources
This is a simple example of usage of Grafana client for importing datasources from a bunch of JSON files (current dir used).
|
This is a simple example of usage of Grafana client for importing datasources from a bunch of JSON files (current dir used). |