gapi

package module
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 13 Imported by: 24

README

Grafana HTTP API Client for Go

This library provides a low-level client to access Grafana HTTP API.

⚠ This repository is still active but not under heavy development. Contributions to this library offering support for the Terraform provider for Grafana will be prioritized over generic ones.

Tests

To run the tests:

make test

Documentation

Overview

Slo types lifted from github.com/grafana/slo/pkg/generated/models/slo/slo_type_gen.go

Index

Constants

View Source
const (
	ErrOK          ExecErrState = "OK"
	ErrError       ExecErrState = "Error"
	ErrAlerting    ExecErrState = "Alerting"
	NoDataOk       NoDataState  = "OK"
	NoData         NoDataState  = "NoData"
	NoDataAlerting NoDataState  = "Alerting"
)
View Source
const (
	DashboardsResource      = "dashboards"
	DatasourcesResource     = "datasources"
	FoldersResource         = "folders"
	ServiceAccountsResource = "serviceaccounts"
	TeamsResource           = "teams"
	UsersResource           = "users"
	BuiltInRolesResource    = "builtInRoles"
)

Variables

This section is empty.

Functions

func ExtractHeadersFromJSONData added in v0.11.1

func ExtractHeadersFromJSONData(jsonData, secureJSONData map[string]interface{}) (map[string]interface{}, map[string]interface{}, map[string]string)

func ForceDeleteFolderRules added in v0.19.0

func ForceDeleteFolderRules() url.Values

func JSONDataWithHeaders added in v0.11.0

func JSONDataWithHeaders(jsonData, secureJSONData map[string]interface{}, headers map[string]string) (map[string]interface{}, map[string]interface{})

Types

type Alert

type Alert struct {
	ID             int64  `json:"id,omitempty"`
	DashboardID    int64  `json:"dashboardId,omitempty"`
	DashboardUID   string `json:"dashboardUid,omitempty"`
	DashboardSlug  string `json:"dashboardSlug,omitempty"`
	PanelID        int64  `json:"panelId,omitempty"`
	Name           string `json:"name,omitempty"`
	State          string `json:"state,omitempty"`
	NewStateDate   string `json:"newStateDate,omitempty"`
	EvalDate       string `json:"evalDate,omitempty"`
	ExecutionError string `json:"executionError,omitempty"`
	URL            string `json:"url,omitempty"`
}

Alert represents a Grafana API Alert

type AlertNotification

type AlertNotification struct {
	ID                    int64       `json:"id,omitempty"`
	UID                   string      `json:"uid"`
	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"`
	SecureFields          interface{} `json:"secureFields,omitempty"`
	SecureSettings        interface{} `json:"secureSettings,omitempty"`
}

AlertNotification represents a Grafana alert notification. Deprecated: Grafana Legacy Alerting is deprecated as of 9.0 and will be removed in the future. Use ContactPoint instead.

type AlertQuery added in v0.8.0

type AlertQuery struct {
	DatasourceUID     string            `json:"datasourceUid,omitempty"`
	Model             interface{}       `json:"model"`
	QueryType         string            `json:"queryType,omitempty"`
	RefID             string            `json:"refId,omitempty"`
	RelativeTimeRange RelativeTimeRange `json:"relativeTimeRange"`
}

AlertQuery represents a single query stage associated with an alert definition.

type AlertRule added in v0.8.0

type AlertRule struct {
	Annotations  map[string]string `json:"annotations,omitempty"`
	Condition    string            `json:"condition"`
	Data         []*AlertQuery     `json:"data"`
	ExecErrState ExecErrState      `json:"execErrState"`
	FolderUID    string            `json:"folderUid"`
	ID           int64             `json:"id,omitempty"`
	Labels       map[string]string `json:"labels,omitempty"`
	NoDataState  NoDataState       `json:"noDataState"`
	OrgID        int64             `json:"orgId"`
	RuleGroup    string            `json:"ruleGroup"`
	Title        string            `json:"title"`
	UID          string            `json:"uid,omitempty"`
	Updated      time.Time         `json:"updated"`
	For          string            `json:"for"`
	ForDuration  time.Duration     `json:"-"`
	Provenance   string            `json:"provenance"`
	IsPaused     bool              `json:"isPaused"`
}

AlertRule represents a Grafana Alert Rule.

type Alerting added in v0.21.0

type Alerting struct {
	Annotations []Label           `json:"annotations,omitempty"`
	FastBurn    *AlertingMetadata `json:"fastBurn,omitempty"`
	Labels      []Label           `json:"labels,omitempty"`
	SlowBurn    *AlertingMetadata `json:"slowBurn,omitempty"`
}

Alerting defines model for Alerting.

type AlertingMessageTemplate added in v0.8.0

type AlertingMessageTemplate struct {
	Name     string `json:"name"`
	Template string `json:"template"`
}

AlertingMessageTemplate is a re-usable template for Grafana Alerting messages.

type AlertingMetadata added in v0.21.0

type AlertingMetadata struct {
	Annotations []Label `json:"annotations,omitempty"`
	Labels      []Label `json:"labels,omitempty"`
}

AlertingMetadata defines model for AlertingMetadata.

type Annotation

type Annotation struct {
	ID           int64    `json:"id,omitempty"`
	AlertID      int64    `json:"alertId,omitempty"`
	DashboardID  int64    `json:"dashboardId,omitempty"`
	DashboardUID string   `json:"dashboardUID,omitempty"`
	PanelID      int64    `json:"panelId"`
	UserID       int64    `json:"userId,omitempty"`
	UserName     string   `json:"userName,omitempty"`
	NewState     string   `json:"newState,omitempty"`
	PrevState    string   `json:"prevState,omitempty"`
	Time         int64    `json:"time"`
	TimeEnd      int64    `json:"timeEnd,omitempty"`
	Text         string   `json:"text"`
	Metric       string   `json:"metric,omitempty"`
	RegionID     int64    `json:"regionId,omitempty"`
	Type         string   `json:"type,omitempty"`
	Tags         []string `json:"tags,omitempty"`
	IsRegion     bool     `json:"isRegion,omitempty"`
}

Annotation represents a Grafana API Annotation

type BuiltInRoleAssignment

type BuiltInRoleAssignment struct {
	BuiltinRole string `json:"builtInRole"`
	RoleUID     string `json:"roleUid"`
	Global      bool   `json:"global"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a Grafana API client.

func New

func New(baseURL string, cfg Config) (*Client, error)

New creates a new Grafana client.

func (*Client) AddDatasourcePermission

func (c *Client) AddDatasourcePermission(id int64, item *DatasourcePermissionAddPayload) error

AddDatasourcePermission adds the given permission item

func (*Client) AddOrgUser

func (c *Client) AddOrgUser(orgID int64, user, role string) error

AddOrgUser adds a user to an org with the specified role.

func (*Client) AddTeam

func (c *Client) AddTeam(name string, email string) (int64, error)

AddTeam makes a new team email arg is an optional value. If you don't want to set email, please set "" (empty string). When team creation is successful, returns the team ID.

func (*Client) AddTeamMember

func (c *Client) AddTeamMember(id int64, userID int64) error

AddTeamMember adds a user to the Grafana team whose ID it's passed.

func (*Client) Alert

func (c *Client) Alert(id int64) (Alert, error)

Alert fetches and returns an individual Grafana alert.

func (*Client) AlertNotification

func (c *Client) AlertNotification(id int64) (*AlertNotification, error)

AlertNotification fetches and returns a Grafana alert notification. Deprecated: Grafana Legacy Alerting is deprecated as of 9.0 and will be removed in the future. Use ContactPoint instead.

func (*Client) AlertNotifications

func (c *Client) AlertNotifications() ([]AlertNotification, error)

AlertNotifications fetches and returns Grafana alert notifications. Deprecated: Grafana Legacy Alerting is deprecated as of 9.0 and will be removed in the future. Use ContactPoints instead.

func (*Client) AlertRule added in v0.8.0

func (c *Client) AlertRule(uid string) (AlertRule, error)

AlertRule fetches a single alert rule, identified by its UID.

func (*Client) AlertRuleGroup added in v0.8.0

func (c *Client) AlertRuleGroup(folderUID string, name string) (RuleGroup, error)

AlertRuleGroup fetches a group of alert rules, identified by its name and the UID of its folder.

func (*Client) Alerts

func (c *Client) Alerts(params url.Values) ([]Alert, error)

Alerts fetches the annotations queried with the params it's passed.

func (*Client) Annotations

func (c *Client) Annotations(params url.Values) ([]Annotation, error)

Annotations fetches the annotations queried with the params it's passed

func (*Client) CloudAccessPolicies added in v0.17.0

func (c *Client) CloudAccessPolicies(region string) (CloudAccessPolicyItems, error)

func (*Client) CloudAccessPolicyByID added in v0.17.0

func (c *Client) CloudAccessPolicyByID(region, id string) (CloudAccessPolicy, error)

func (*Client) CloudAccessPolicyTokenByID added in v0.17.0

func (c *Client) CloudAccessPolicyTokenByID(region, id string) (CloudAccessPolicyToken, error)

func (*Client) CloudAccessPolicyTokens added in v0.17.0

func (c *Client) CloudAccessPolicyTokens(region, accessPolicyID string) (CloudAccessPolicyTokenItems, error)

func (*Client) ContactPoint added in v0.8.0

func (c *Client) ContactPoint(uid string) (ContactPoint, error)

ContactPoint fetches a single contact point, identified by its UID.

func (*Client) ContactPoints added in v0.8.0

func (c *Client) ContactPoints() ([]ContactPoint, error)

ContactPoints fetches all contact points.

func (*Client) ContactPointsByName added in v0.8.0

func (c *Client) ContactPointsByName(name string) ([]ContactPoint, error)

ContactPointsByName fetches contact points with the given name.

func (*Client) CreateAPIKey

func (c *Client) CreateAPIKey(request CreateAPIKeyRequest) (CreateAPIKeyResponse, error)

CreateAPIKey creates a new Grafana API key.

func (*Client) CreateCloudAPIKey added in v0.4.4

func (c *Client) CreateCloudAPIKey(org string, input *CreateCloudAPIKeyInput) (*CloudAPIKey, error)

func (*Client) CreateCloudAccessPolicy added in v0.17.0

func (c *Client) CreateCloudAccessPolicy(region string, input CreateCloudAccessPolicyInput) (CloudAccessPolicy, error)

func (*Client) CreateCloudAccessPolicyToken added in v0.17.0

func (c *Client) CreateCloudAccessPolicyToken(region string, input CreateCloudAccessPolicyTokenInput) (CloudAccessPolicyToken, error)

func (*Client) CreateGrafanaAPIKeyFromCloud added in v0.4.5

func (c *Client) CreateGrafanaAPIKeyFromCloud(stack string, input *CreateAPIKeyRequest) (*CreateAPIKeyResponse, error)

This function creates a API key inside the Grafana instance running in stack `stack`. It's used in order to provision API keys inside Grafana while just having access to a Grafana Cloud API key.

See https://grafana.com/docs/grafana-cloud/api/#create-grafana-api-keys for more information.

func (*Client) CreateGrafanaServiceAccountFromCloud added in v0.19.0

func (c *Client) CreateGrafanaServiceAccountFromCloud(stack string, input *CreateServiceAccountRequest) (*ServiceAccountDTO, error)

This function creates a service account inside the Grafana instance running in stack `stack`. It's used in order to provision service accounts inside Grafana while just having access to a Grafana Cloud API key.

func (*Client) CreateGrafanaServiceAccountTokenFromCloud added in v0.19.0

func (c *Client) CreateGrafanaServiceAccountTokenFromCloud(stack string, input *CreateServiceAccountTokenRequest) (*CreateServiceAccountTokenResponse, error)

This function creates a service account token inside the Grafana instance running in stack `stack`. It's used in order to provision service accounts inside Grafana while just having access to a Grafana Cloud API key.

func (*Client) CreateServiceAccount added in v0.8.0

func (c *Client) CreateServiceAccount(request CreateServiceAccountRequest) (*ServiceAccountDTO, error)

CreateServiceAccount creates a new Grafana service account.

func (*Client) CreateServiceAccountToken added in v0.8.0

func (c *Client) CreateServiceAccountToken(request CreateServiceAccountTokenRequest) (*CreateServiceAccountTokenResponse, error)

CreateServiceAccountToken creates a new Grafana service account token.

func (*Client) CreateSlo added in v0.21.0

func (c *Client) CreateSlo(slo Slo) (CreateSLOResponse, error)

CreateSLO creates a single Slo

func (*Client) CreateTemporaryStackGrafanaClient added in v0.4.5

func (c *Client) CreateTemporaryStackGrafanaClient(stackSlug, tempSaPrefix string, tempKeyDuration time.Duration) (tempClient *Client, cleanup func() error, err error)

The Grafana Cloud API is disconnected from the Grafana API on the stacks unfortunately. That's why we can't use the Grafana Cloud API key to fully manage service accounts on the Grafana API. The only thing we can do is to create a temporary Admin service account, and create a Grafana API client with that.

func (*Client) CreateUser

func (c *Client) CreateUser(user User) (int64, error)

CreateUser creates a Grafana user.

func (*Client) Dashboard

func (c *Client) Dashboard(slug string) (*Dashboard, error)

Dashboard will be removed. Deprecated: Starting from Grafana v5.0. Use DashboardByUID instead.

func (*Client) DashboardByUID

func (c *Client) DashboardByUID(uid string) (*Dashboard, error)

DashboardByUID gets a dashboard by UID.

func (*Client) DashboardPermissions

func (c *Client) DashboardPermissions(id int64) ([]*DashboardPermission, error)

DashboardPermissions fetches and returns the permissions for the dashboard whose ID it's passed.

func (*Client) DashboardPermissionsByUID added in v0.15.0

func (c *Client) DashboardPermissionsByUID(uid string) ([]*DashboardPermission, error)

DashboardPermissionsByUID fetches and returns the permissions for the dashboard whose UID it's passed.

func (*Client) Dashboards

func (c *Client) Dashboards() ([]FolderDashboardSearchResponse, error)

Dashboards fetches and returns all dashboards.

func (*Client) DashboardsByIDs added in v0.2.5

func (c *Client) DashboardsByIDs(ids []int64) ([]FolderDashboardSearchResponse, error)

DashboardsByIDs uses the folder and dashboard search endpoint to find dashboards by list of dashboard IDs.

func (*Client) DataSource

func (c *Client) DataSource(id int64) (*DataSource, error)

DataSource fetches and returns the Grafana data source whose ID it's passed.

func (*Client) DataSourceByName added in v0.25.0

func (c *Client) DataSourceByName(name string) (*DataSource, error)

DataSourceByName fetches and returns the Grafana data source whose name is passed.

func (*Client) DataSourceByUID added in v0.4.0

func (c *Client) DataSourceByUID(uid string) (*DataSource, error)

DataSourceByUID fetches and returns the Grafana data source whose UID is passed.

func (*Client) DataSourceIDByName added in v0.6.1

func (c *Client) DataSourceIDByName(name string) (int64, error)

DataSourceIDByName returns the Grafana data source ID by name.

func (*Client) DataSources added in v0.6.1

func (c *Client) DataSources() ([]*DataSource, error)

DataSources returns all data sources as defined in Grafana.

func (*Client) DatasourceCache added in v0.24.0

func (c *Client) DatasourceCache(id int64) (*DatasourceCache, error)

DatasourceCache fetches datasource cache configuration

func (*Client) DatasourcePermissions

func (c *Client) DatasourcePermissions(id int64) (*DatasourcePermissionsResponse, error)

DatasourcePermissions fetches and returns the permissions for the datasource whose ID it's passed.

func (*Client) DeleteAPIKey

func (c *Client) DeleteAPIKey(id int64) (DeleteAPIKeyResponse, error)

DeleteAPIKey deletes the Grafana API key with the specified ID.

func (*Client) DeleteAlertNotification

func (c *Client) DeleteAlertNotification(id int64) error

DeleteAlertNotification deletes a Grafana alert notification. Deprecated: Grafana Legacy Alerting is deprecated as of 9.0 and will be removed in the future. Use DeleteContactPoint instead.

func (*Client) DeleteAlertRule added in v0.8.0

func (c *Client) DeleteAlertRule(uid string) error

DeleteAlertRule deletes a alert rule, identified by the alert rule's UID.

func (*Client) DeleteAnnotation

func (c *Client) DeleteAnnotation(id int64) (string, error)

DeleteAnnotation deletes the annotation of the ID it is passed

func (*Client) DeleteAnnotationByRegionID

func (c *Client) DeleteAnnotationByRegionID(id int64) (string, error)

DeleteAnnotationByRegionID deletes the annotation corresponding to the region ID it is passed

func (*Client) DeleteBuiltInRoleAssignment

func (c *Client) DeleteBuiltInRoleAssignment(builtInRole BuiltInRoleAssignment) error

DeleteBuiltInRoleAssignment remove the built-in role assignments. Available only in Grafana Enterprise 8.+.

func (*Client) DeleteCloudAPIKey added in v0.4.4

func (c *Client) DeleteCloudAPIKey(org string, keyName string) error

func (*Client) DeleteCloudAccessPolicy added in v0.17.0

func (c *Client) DeleteCloudAccessPolicy(region, id string) error

func (*Client) DeleteCloudAccessPolicyToken added in v0.17.0

func (c *Client) DeleteCloudAccessPolicyToken(region, id string) error

func (*Client) DeleteContactPoint added in v0.8.0

func (c *Client) DeleteContactPoint(uid string) error

DeleteContactPoint deletes a contact point.

func (*Client) DeleteDashboard

func (c *Client) DeleteDashboard(slug string) error

DeleteDashboard will be removed. Deprecated: Starting from Grafana v5.0. Use DeleteDashboardByUID instead.

func (*Client) DeleteDashboardByUID

func (c *Client) DeleteDashboardByUID(uid string) error

DeleteDashboardByUID deletes a dashboard by UID.

func (*Client) DeleteDataSource

func (c *Client) DeleteDataSource(id int64) error

DeleteDataSource deletes the Grafana data source whose ID it's passed.

func (*Client) DeleteDataSourceByName added in v0.14.0

func (c *Client) DeleteDataSourceByName(name string) error

DeleteDataSourceByName deletes the Grafana data source whose NAME it's passed.

func (*Client) DeleteFolder

func (c *Client) DeleteFolder(id string, optionalQueryParams ...url.Values) error

DeleteFolder deletes the folder whose ID it's passed.

func (*Client) DeleteLibraryPanel added in v0.2.5

func (c *Client) DeleteLibraryPanel(uid string) (*LibraryPanelDeleteResponse, error)

DeleteLibraryPanel deletes a panel by UID.

func (*Client) DeleteMessageTemplate added in v0.8.0

func (c *Client) DeleteMessageTemplate(name string) error

DeleteMessageTemplate deletes a message template.

func (*Client) DeleteMuteTiming added in v0.8.0

func (c *Client) DeleteMuteTiming(name string) error

DeleteMutetiming deletes a mute timing.

func (*Client) DeleteOrg

func (c *Client) DeleteOrg(id int64) error

DeleteOrg deletes the Grafana org whose ID it's passed.

func (*Client) DeletePlaylist

func (c *Client) DeletePlaylist(idOrUID string) error

DeletePlaylist deletes the Grafana playlist whose ID it's passed.

func (*Client) DeletePublicDashboard added in v0.24.0

func (c *Client) DeletePublicDashboard(dashboardUID string, publicDashboardUID string) error

DeletePublicDashboard deletes a Grafana public dashboard.

func (*Client) DeleteReport added in v0.2.2

func (c *Client) DeleteReport(id int64) error

DeleteReport deletes the Grafana report whose ID it's passed.

func (*Client) DeleteRole

func (c *Client) DeleteRole(uid string, global bool) error

DeleteRole deletes the role with it's permissions. Available only in Grafana Enterprise 8.+.

func (*Client) DeleteServiceAccount added in v0.8.0

func (c *Client) DeleteServiceAccount(serviceAccountID int64) (*DeleteServiceAccountResponse, error)

DeleteServiceAccount deletes the Grafana service account with the specified ID.

func (*Client) DeleteServiceAccountToken added in v0.8.0

func (c *Client) DeleteServiceAccountToken(serviceAccountID, tokenID int64) (*DeleteServiceAccountResponse, error)

DeleteServiceAccountToken deletes the Grafana service account token with the specified ID.

func (*Client) DeleteSlo added in v0.21.0

func (c *Client) DeleteSlo(uuid string) error

DeleteSLO deletes the Slo with the passed in UUID

func (*Client) DeleteStack added in v0.2.6

func (c *Client) DeleteStack(stackSlug string) error

DeleteStack deletes the Grafana stack whose slug it passed in.

func (*Client) DeleteTeam

func (c *Client) DeleteTeam(id int64) error

DeleteTeam deletes the Grafana team whose ID it's passed.

func (*Client) DeleteTeamGroup

func (c *Client) DeleteTeamGroup(id int64, groupID string) error

DeleteTeam deletes the Grafana team whose ID it's passed.

func (*Client) DeleteUser

func (c *Client) DeleteUser(id int64) error

DeleteUser deletes a Grafana user.

func (*Client) DisableDatasourceCache added in v0.24.0

func (c *Client) DisableDatasourceCache(id int64) error

DisableDatasourceCache disables the datasource cache (this is a datasource setting)

func (*Client) DisableDatasourcePermissions

func (c *Client) DisableDatasourcePermissions(id int64) error

DisableDatasourcePermissions disables the datasource permissions (this is a datasource setting)

func (*Client) EnableDatasourceCache added in v0.24.0

func (c *Client) EnableDatasourceCache(id int64) error

EnableDatasourceCache enables the datasource cache (this is a datasource setting)

func (*Client) EnableDatasourcePermissions

func (c *Client) EnableDatasourcePermissions(id int64) error

EnableDatasourcePermissions enables the datasource permissions (this is a datasource setting)

func (*Client) Folder

func (c *Client) Folder(id int64) (*Folder, error)

Folder fetches and returns the Grafana folder whose ID it's passed.

func (*Client) FolderByUID added in v0.2.2

func (c *Client) FolderByUID(uid string) (*Folder, error)

Folder fetches and returns the Grafana folder whose UID it's passed.

func (*Client) FolderDashboardSearch

func (c *Client) FolderDashboardSearch(params url.Values) (resp []FolderDashboardSearchResponse, err error)

FolderDashboardSearch uses the folder and dashboard search endpoint to find dashboards based on the params passed in.

func (*Client) FolderPermissions

func (c *Client) FolderPermissions(fid string) ([]*FolderPermission, error)

FolderPermissions fetches and returns the permissions for the folder whose ID it's passed.

func (*Client) Folders

func (c *Client) Folders() ([]Folder, error)

Folders fetches and returns Grafana folders.

func (*Client) GetAPIKeys

func (c *Client) GetAPIKeys(includeExpired bool) ([]*GetAPIKeysResponse, error)

GetAPIKeys retrieves a list of all API keys.

func (*Client) GetBuiltInRoleAssignments

func (c *Client) GetBuiltInRoleAssignments() (map[string][]*Role, error)

GetBuiltInRoleAssignments gets all built-in role assignments. Available only in Grafana Enterprise 8.+.

func (*Client) GetCloudOrg added in v0.17.0

func (c *Client) GetCloudOrg(org string) (CloudOrg, error)

func (*Client) GetCloudPluginInstallation added in v0.4.6

func (c *Client) GetCloudPluginInstallation(stackSlug string, pluginSlug string) (*CloudPluginInstallation, error)

GetCloudPluginInstallation returns the cloud plugin installation details for the specified plugin.

func (*Client) GetCloudRegionBySlug added in v0.4.3

func (c *Client) GetCloudRegionBySlug(slug string) (CloudRegion, error)

GetCloudRegionBySlug fetches and returns the cloud region which matches the given slug. You can also provide a numeric region ID.

func (*Client) GetCloudRegions added in v0.4.3

func (c *Client) GetCloudRegions() (CloudRegionsResponse, error)

GetCloudRegions fetches and returns all Grafana Cloud regions.

func (*Client) GetRole

func (c *Client) GetRole(uid string) (*Role, error)

GetRole gets a role with permissions for the given UID. Available only in Grafana Enterprise 8.+.

func (*Client) GetRoleAssignments added in v0.12.0

func (c *Client) GetRoleAssignments(uid string) (*RoleAssignments, error)

func (*Client) GetRoles added in v0.22.0

func (c *Client) GetRoles() ([]Role, error)

GetRole fetches and returns Grafana roles. Available only in Grafana Enterprise 8.+.

func (*Client) GetServiceAccountTokens added in v0.8.0

func (c *Client) GetServiceAccountTokens(serviceAccountID int64) ([]GetServiceAccountTokensResponse, error)

GetServiceAccountTokens retrieves a list of all service account tokens for a specific service account.

func (*Client) GetServiceAccounts added in v0.8.0

func (c *Client) GetServiceAccounts() ([]ServiceAccountDTO, error)

GetServiceAccounts retrieves a list of all service accounts for the organization.

func (*Client) GetSlo added in v0.21.0

func (c *Client) GetSlo(uuid string) (Slo, error)

GetSLO returns a single Slo based on its uuid

func (*Client) Health added in v0.12.1

func (c *Client) Health() (HealthResponse, error)

func (*Client) InstallCloudPlugin added in v0.4.6

func (c *Client) InstallCloudPlugin(stackSlug string, pluginSlug string, pluginVersion string) (*CloudPluginInstallation, error)

InstallCloudPlugin installs the specified plugin to the given stack.

func (*Client) IsCloudPluginInstalled added in v0.4.6

func (c *Client) IsCloudPluginInstalled(stackSlug string, pluginSlug string) (bool, error)

IsCloudPluginInstalled returns a boolean if the specified plugin is installed on the stack.

func (*Client) LibraryPanelByName added in v0.2.5

func (c *Client) LibraryPanelByName(name string) (*LibraryPanel, error)

LibraryPanelByName gets a library panel by name.

func (*Client) LibraryPanelByUID added in v0.2.5

func (c *Client) LibraryPanelByUID(uid string) (*LibraryPanel, error)

LibraryPanelByUID gets a library panel by UID.

func (*Client) LibraryPanelConnectedDashboards added in v0.2.5

func (c *Client) LibraryPanelConnectedDashboards(uid string) ([]FolderDashboardSearchResponse, error)

LibraryPanelConnectedDashboards gets Dashboards using this Library Panel.

func (*Client) LibraryPanelConnections added in v0.2.5

func (c *Client) LibraryPanelConnections(uid string) (*[]LibraryPanelConnection, error)

LibraryPanelConnections gets library panel connections by UID.

func (*Client) LibraryPanels added in v0.2.5

func (c *Client) LibraryPanels() ([]LibraryPanel, error)

Dashboards fetches and returns all dashboards.

func (*Client) ListCloudAPIKeys added in v0.4.4

func (c *Client) ListCloudAPIKeys(org string) (*ListCloudAPIKeysOutput, error)

func (*Client) ListDashboardResourcePermissions added in v0.26.0

func (c *Client) ListDashboardResourcePermissions(uid string) ([]*ResourcePermission, error)

func (*Client) ListDatasourceResourcePermissions added in v0.26.0

func (c *Client) ListDatasourceResourcePermissions(uid string) ([]*ResourcePermission, error)

func (*Client) ListFolderResourcePermissions added in v0.26.0

func (c *Client) ListFolderResourcePermissions(uid string) ([]*ResourcePermission, error)

func (*Client) ListServiceAccountResourcePermissions added in v0.26.0

func (c *Client) ListServiceAccountResourcePermissions(id int64) ([]*ResourcePermission, error)

func (*Client) ListSlos added in v0.21.0

func (c *Client) ListSlos() (Slos, error)

ListSlos retrieves a list of all Slos

func (*Client) ListTeamResourcePermissions added in v0.26.0

func (c *Client) ListTeamResourcePermissions(uid string) ([]*ResourcePermission, error)

func (*Client) MessageTemplate added in v0.8.0

func (c *Client) MessageTemplate(name string) (*AlertingMessageTemplate, error)

MessageTemplate fetches a single message template, identified by its name.

func (*Client) MessageTemplates added in v0.8.0

func (c *Client) MessageTemplates() ([]AlertingMessageTemplate, error)

MessageTemplates fetches all message templates.

func (*Client) MuteTiming added in v0.8.0

func (c *Client) MuteTiming(name string) (MuteTiming, error)

MuteTiming fetches a single mute timing, identified by its name.

func (*Client) MuteTimings added in v0.8.0

func (c *Client) MuteTimings() ([]MuteTiming, error)

MuteTimings fetches all mute timings.

func (*Client) NewAlertNotification

func (c *Client) NewAlertNotification(a *AlertNotification) (int64, error)

NewAlertNotification creates a new Grafana alert notification. Deprecated: Grafana Legacy Alerting is deprecated as of 9.0 and will be removed in the future. Use NewContactPoint instead.

func (*Client) NewAlertRule added in v0.8.0

func (c *Client) NewAlertRule(ar *AlertRule) (string, error)

NewAlertRule creates a new alert rule and returns its UID.

func (*Client) NewAnnotation

func (c *Client) NewAnnotation(a *Annotation) (int64, error)

NewAnnotation creates a new annotation with the Annotation it is passed

func (*Client) NewBuiltInRoleAssignment

func (c *Client) NewBuiltInRoleAssignment(builtInRoleAssignment BuiltInRoleAssignment) (*BuiltInRoleAssignment, error)

NewBuiltInRoleAssignment creates a new built-in role assignment. Available only in Grafana Enterprise 8.+.

func (*Client) NewContactPoint added in v0.8.0

func (c *Client) NewContactPoint(p *ContactPoint) (string, error)

NewContactPoint creates a new contact point.

func (*Client) NewDashboard

func (c *Client) NewDashboard(dashboard Dashboard) (*DashboardSaveResponse, error)

NewDashboard creates a new Grafana dashboard.

func (*Client) NewDataSource

func (c *Client) NewDataSource(s *DataSource) (int64, error)

NewDataSource creates a new Grafana data source.

func (*Client) NewFolder

func (c *Client) NewFolder(title string, uid ...string) (Folder, error)

NewFolder creates a new Grafana folder.

func (*Client) NewGraphiteAnnotation

func (c *Client) NewGraphiteAnnotation(gfa *GraphiteAnnotation) (int64, error)

NewGraphiteAnnotation creates a new annotation with the GraphiteAnnotation it is passed

func (*Client) NewLibraryPanel added in v0.2.5

func (c *Client) NewLibraryPanel(panel LibraryPanel) (*LibraryPanel, error)

NewLibraryPanel creates a new Grafana library panel.

func (*Client) NewMuteTiming added in v0.8.0

func (c *Client) NewMuteTiming(mt *MuteTiming) error

NewMuteTiming creates a new mute timing.

func (*Client) NewOrg

func (c *Client) NewOrg(name string) (int64, error)

NewOrg creates a new Grafana org.

func (*Client) NewPlaylist

func (c *Client) NewPlaylist(playlist Playlist) (string, error)

NewPlaylist creates a new Grafana playlist.

func (*Client) NewPublicDashboard added in v0.24.0

func (c *Client) NewPublicDashboard(dashboardUID string, publicDashboard PublicDashboardPayload) (*PublicDashboard, error)

NewPublicDashboard creates a new Grafana public dashboard.

func (*Client) NewReport added in v0.2.2

func (c *Client) NewReport(report Report) (int64, error)

NewReport creates a new Grafana report.

func (*Client) NewRole

func (c *Client) NewRole(role Role) (*Role, error)

NewRole creates a new role with permissions. Available only in Grafana Enterprise 8.+.

func (*Client) NewSnapshot added in v0.3.0

func (c *Client) NewSnapshot(snapshot Snapshot) (*SnapshotCreateResponse, error)

NewSnapshot creates a new Grafana snapshot.

func (*Client) NewStack added in v0.2.6

func (c *Client) NewStack(stack *CreateStackInput) (int64, error)

NewStack creates a new Grafana Stack

func (*Client) NewTeamGroup

func (c *Client) NewTeamGroup(id int64, groupID string) error

NewTeamGroup creates a new Grafana Team Group .

func (*Client) NotificationPolicyTree added in v0.8.0

func (c *Client) NotificationPolicyTree() (NotificationPolicyTree, error)

NotificationPolicy fetches the notification policy tree.

func (*Client) Org

func (c *Client) Org(id int64) (Org, error)

Org fetches and returns the org whose ID it's passed.

func (*Client) OrgByName

func (c *Client) OrgByName(name string) (Org, error)

OrgByName fetches and returns the org whose name it's passed.

func (*Client) OrgPreferences added in v0.10.0

func (c *Client) OrgPreferences() (Preferences, error)

OrgPreferences fetches org preferences.

func (*Client) OrgUsers

func (c *Client) OrgUsers(orgID int64) ([]OrgUser, error)

OrgUsers fetches and returns the users for the org whose ID it's passed.

func (*Client) OrgUsersCurrent

func (c *Client) OrgUsersCurrent() ([]OrgUser, error)

OrgUsersCurrent returns all org users within the current organization. This endpoint is accessible to users with org admin role.

func (*Client) Orgs

func (c *Client) Orgs() ([]Org, error)

Orgs fetches and returns the Grafana orgs.

func (*Client) PatchAnnotation

func (c *Client) PatchAnnotation(id int64, a *Annotation) (string, error)

PatchAnnotation updates one or more properties of an existing annotation that matches the specified ID.

func (*Client) PatchLibraryPanel added in v0.2.5

func (c *Client) PatchLibraryPanel(uid string, panel LibraryPanel) (*LibraryPanel, error)

PatchLibraryPanel updates one or more properties of an existing panel that matches the specified UID.

func (*Client) PauseAlert

func (c *Client) PauseAlert(id int64) (PauseAlertResponse, error)

PauseAlert pauses the Grafana alert whose ID it's passed.

func (*Client) PauseAllAlerts

func (c *Client) PauseAllAlerts() (PauseAllAlertsResponse, error)

PauseAllAlerts pauses all Grafana alerts.

func (*Client) Playlist

func (c *Client) Playlist(idOrUID string) (*Playlist, error)

Playlist fetches and returns a Grafana playlist.

func (*Client) PluginByID added in v0.4.6

func (c *Client) PluginByID(pluginID int64) (*Plugin, error)

PluginByID returns the plugin with the given id. An error will be returned given an unknown ID.

func (*Client) PluginBySlug added in v0.4.6

func (c *Client) PluginBySlug(slug string) (*Plugin, error)

PluginBySlug returns the plugin with the given slug. An error will be returned given an unknown slug.

func (*Client) PublicDashboardbyUID added in v0.24.0

func (c *Client) PublicDashboardbyUID(dashboardUID string) (*PublicDashboard, error)

PublicDashboardbyUID fetches and returns a Grafana public dashboard by uid.

func (*Client) PublicDashboards added in v0.24.0

func (c *Client) PublicDashboards() (*PublicDashboardListResponseWithPagination, error)

PublicDashboards fetches and returns the Grafana public dashboards.

func (*Client) RemoveDatasourcePermission

func (c *Client) RemoveDatasourcePermission(id, permissionID int64) error

RemoveDatasourcePermission removes the permission with the given id

func (*Client) RemoveMemberFromTeam

func (c *Client) RemoveMemberFromTeam(id int64, userID int64) error

RemoveMemberFromTeam removes a user from the Grafana team whose ID it's passed.

func (*Client) RemoveOrgUser

func (c *Client) RemoveOrgUser(orgID, userID int64) error

RemoveOrgUser removes a user from an org.

func (*Client) Report added in v0.2.2

func (c *Client) Report(id int64) (*Report, error)

Report fetches and returns a Grafana report.

func (*Client) ResetNotificationPolicyTree added in v0.8.0

func (c *Client) ResetNotificationPolicyTree() error

func (*Client) SaveDashboard

func (c *Client) SaveDashboard(model map[string]interface{}, overwrite bool) (*DashboardSaveResponse, error)

SaveDashboard is a deprecated method for saving a Grafana dashboard. Use NewDashboard. Deprecated: Use NewDashboard instead.

func (*Client) SearchTeam

func (c *Client) SearchTeam(query string) (*SearchTeam, error)

SearchTeam searches Grafana teams and returns the results.

func (*Client) SetAlertRuleGroup added in v0.9.2

func (c *Client) SetAlertRuleGroup(group RuleGroup) error

SetAlertRuleGroup overwrites an existing rule group on the server.

func (*Client) SetBuiltInRoleDashboardResourcePermissions added in v0.26.0

func (c *Client) SetBuiltInRoleDashboardResourcePermissions(dashboardUID string, builtInRole string, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetBuiltInRoleDatasourceResourcePermissions added in v0.26.0

func (c *Client) SetBuiltInRoleDatasourceResourcePermissions(datasourceUID string, builtInRole string, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetBuiltInRoleFolderResourcePermissions added in v0.26.0

func (c *Client) SetBuiltInRoleFolderResourcePermissions(folderUID string, builtInRole string, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetDashboardResourcePermissions added in v0.26.0

func (c *Client) SetDashboardResourcePermissions(uid string, body SetResourcePermissionsBody) (*SetResourcePermissionsResponse, error)

func (*Client) SetDatasourceResourcePermissions added in v0.26.0

func (c *Client) SetDatasourceResourcePermissions(uid string, body SetResourcePermissionsBody) (*SetResourcePermissionsResponse, error)

func (*Client) SetFolderResourcePermissions added in v0.26.0

func (c *Client) SetFolderResourcePermissions(uid string, body SetResourcePermissionsBody) (*SetResourcePermissionsResponse, error)

func (*Client) SetMessageTemplate added in v0.8.0

func (c *Client) SetMessageTemplate(name, content string) error

SetMessageTemplate creates or updates a message template.

func (*Client) SetNotificationPolicyTree added in v0.8.0

func (c *Client) SetNotificationPolicyTree(np *NotificationPolicyTree) error

SetNotificationPolicy sets the notification policy tree.

func (*Client) SetServiceAccountResourcePermissions added in v0.26.0

func (c *Client) SetServiceAccountResourcePermissions(id int64, body SetResourcePermissionsBody) (*SetResourcePermissionsResponse, error)

func (*Client) SetTeamDashboardResourcePermissions added in v0.26.0

func (c *Client) SetTeamDashboardResourcePermissions(dashboardUID string, teamID int64, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetTeamDatasourceResourcePermissions added in v0.26.0

func (c *Client) SetTeamDatasourceResourcePermissions(datasourceUID string, teamID int64, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetTeamFolderResourcePermissions added in v0.26.0

func (c *Client) SetTeamFolderResourcePermissions(folderUID string, teamID int64, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetTeamResourcePermissions added in v0.26.0

func (c *Client) SetTeamResourcePermissions(uid string, body SetResourcePermissionsBody) (*SetResourcePermissionsResponse, error)

func (*Client) SetTeamServiceAccountResourcePermissions added in v0.26.0

func (c *Client) SetTeamServiceAccountResourcePermissions(id int64, teamID int64, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetUserDashboardResourcePermissions added in v0.26.0

func (c *Client) SetUserDashboardResourcePermissions(dashboardUID string, userID int64, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetUserDatasourceResourcePermissions added in v0.26.0

func (c *Client) SetUserDatasourceResourcePermissions(datasourceUID string, userID int64, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetUserFolderResourcePermissions added in v0.26.0

func (c *Client) SetUserFolderResourcePermissions(folderUID string, userID int64, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetUserServiceAccountResourcePermissions added in v0.26.0

func (c *Client) SetUserServiceAccountResourcePermissions(id int64, userID int64, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) SetUserTeamResourcePermissions added in v0.26.0

func (c *Client) SetUserTeamResourcePermissions(teamUID string, userID int64, permission string) (*SetResourcePermissionsResponse, error)

func (*Client) StackByID added in v0.2.6

func (c *Client) StackByID(id int64) (Stack, error)

StackByID fetches and returns the stack whose name it's passed. This returns deleted instances as well with `status=deleted`.

func (*Client) StackBySlug added in v0.2.6

func (c *Client) StackBySlug(slug string) (Stack, error)

StackByName fetches and returns the stack whose slug it's passed.

func (*Client) Stacks added in v0.2.6

func (c *Client) Stacks() (StackItems, error)

Stacks fetches and returns the Grafana stacks.

func (*Client) Team

func (c *Client) Team(id int64) (*Team, error)

Team fetches and returns the Grafana team whose ID it's passed.

func (*Client) TeamGroups

func (c *Client) TeamGroups(id int64) ([]TeamGroup, error)

TeamGroups fetches and returns the list of Grafana team group whose Team ID it's passed.

func (*Client) TeamMembers

func (c *Client) TeamMembers(id int64) ([]*TeamMember, error)

TeamMembers fetches and returns the team members for the Grafana team whose ID it's passed.

func (*Client) TeamPreferences

func (c *Client) TeamPreferences(id int64) (*Preferences, error)

TeamPreferences fetches and returns preferences for the Grafana team whose ID it's passed.

func (*Client) UninstallCloudPlugin added in v0.4.6

func (c *Client) UninstallCloudPlugin(stackSlug string, pluginSlug string) error

UninstallCloudPlugin uninstalls the specified plugin to the given stack.

func (*Client) UpdateAlertNotification

func (c *Client) UpdateAlertNotification(a *AlertNotification) error

UpdateAlertNotification updates a Grafana alert notification. Deprecated: Grafana Legacy Alerting is deprecated as of 9.0 and will be removed in the future. Use UpdateContactPoint instead.

func (*Client) UpdateAlertRule added in v0.8.0

func (c *Client) UpdateAlertRule(ar *AlertRule) error

UpdateAlertRule replaces an alert rule, identified by the alert rule's UID.

func (*Client) UpdateAllOrgPreferences added in v0.10.0

func (c *Client) UpdateAllOrgPreferences(p Preferences) (UpdateOrgPreferencesResponse, error)

UpdateAllOrgPreferences overrwrites all org preferences with the passed Preferences.

func (*Client) UpdateAnnotation

func (c *Client) UpdateAnnotation(id int64, a *Annotation) (string, error)

UpdateAnnotation updates all properties an existing annotation with the Annotation it is passed.

func (*Client) UpdateCloudAccessPolicy added in v0.17.0

func (c *Client) UpdateCloudAccessPolicy(region, id string, input UpdateCloudAccessPolicyInput) (CloudAccessPolicy, error)

func (*Client) UpdateCloudAccessPolicyToken added in v0.17.0

func (c *Client) UpdateCloudAccessPolicyToken(region, id string, input UpdateCloudAccessPolicyTokenInput) (CloudAccessPolicyToken, error)

func (*Client) UpdateContactPoint added in v0.8.0

func (c *Client) UpdateContactPoint(p *ContactPoint) error

UpdateContactPoint replaces a contact point, identified by contact point's UID.

func (*Client) UpdateDashboardPermissions

func (c *Client) UpdateDashboardPermissions(id int64, items *PermissionItems) error

UpdateDashboardPermissions remove existing permissions if items are not included in the request.

func (*Client) UpdateDashboardPermissionsByUID added in v0.15.0

func (c *Client) UpdateDashboardPermissionsByUID(uid string, items *PermissionItems) error

UpdateDashboardPermissionsByUID remove existing permissions if items are not included in the request.

func (*Client) UpdateDataSource

func (c *Client) UpdateDataSource(s *DataSource) error

UpdateDataSource updates a Grafana data source.

func (*Client) UpdateDataSourceByUID added in v0.12.0

func (c *Client) UpdateDataSourceByUID(s *DataSource) error

func (*Client) UpdateDatasourceCache added in v0.24.0

func (c *Client) UpdateDatasourceCache(id int64, payload *DatasourceCachePayload) error

UpdateDatasourceCache updates the cache configurations

func (*Client) UpdateFolder

func (c *Client) UpdateFolder(uid string, title string, newUID ...string) error

UpdateFolder updates the folder whose UID it's passed.

func (*Client) UpdateFolderPermissions

func (c *Client) UpdateFolderPermissions(fid string, items *PermissionItems) error

UpdateFolderPermissions remove existing permissions if items are not included in the request.

func (*Client) UpdateMuteTiming added in v0.8.0

func (c *Client) UpdateMuteTiming(mt *MuteTiming) error

UpdateMuteTiming updates a mute timing.

func (*Client) UpdateOrg

func (c *Client) UpdateOrg(id int64, name string) error

UpdateOrg updates a Grafana org.

func (*Client) UpdateOrgPreferences added in v0.10.0

func (c *Client) UpdateOrgPreferences(p Preferences) (UpdateOrgPreferencesResponse, error)

UpdateOrgPreferences updates only those org preferences specified in the passed Preferences, without impacting others.

func (*Client) UpdateOrgUser

func (c *Client) UpdateOrgUser(orgID, userID int64, role string) error

UpdateOrgUser updates and org user.

func (*Client) UpdatePlaylist

func (c *Client) UpdatePlaylist(playlist Playlist) error

UpdatePlaylist updates a Grafana playlist.

func (*Client) UpdatePublicDashboard added in v0.24.0

func (c *Client) UpdatePublicDashboard(dashboardUID string, publicDashboardUID string, publicDashboard PublicDashboardPayload) (*PublicDashboard, error)

UpdatePublicDashboard updates a Grafana public dashboard.

func (*Client) UpdateReport added in v0.2.2

func (c *Client) UpdateReport(report Report) error

UpdateReport updates a Grafana report.

func (*Client) UpdateRole

func (c *Client) UpdateRole(role Role) error

UpdateRole updates the role and permissions. Available only in Grafana Enterprise 8.+.

func (*Client) UpdateRoleAssignments added in v0.12.0

func (c *Client) UpdateRoleAssignments(ra *RoleAssignments) (*RoleAssignments, error)

func (*Client) UpdateServiceAccount added in v0.8.0

func (c *Client) UpdateServiceAccount(serviceAccountID int64, request UpdateServiceAccountRequest) (*ServiceAccountDTO, error)

UpdateServiceAccount updates a specific serviceAccountID

func (*Client) UpdateSlo added in v0.21.0

func (c *Client) UpdateSlo(uuid string, slo Slo) error

UpdateSLO updates the Slo with the passed in UUID and Slo

func (*Client) UpdateStack added in v0.2.6

func (c *Client) UpdateStack(id int64, stack *UpdateStackInput) error

UpdateOrg updates a Grafana stack. Only name, slug and description can be updated. No other parameters of the stack are updateable

func (*Client) UpdateTeam

func (c *Client) UpdateTeam(id int64, name string, email string) error

UpdateTeam updates a Grafana team.

func (*Client) UpdateTeamPreferences

func (c *Client) UpdateTeamPreferences(id int64, preferences Preferences) error

UpdateTeamPreferences updates team preferences for the Grafana team whose ID it's passed.

func (*Client) UpdateUserPassword

func (c *Client) UpdateUserPassword(id int64, password string) error

UpdateUserPassword updates a user password.

func (*Client) UpdateUserPermissions

func (c *Client) UpdateUserPermissions(id int64, isAdmin bool) error

UpdateUserPermissions sets a user's admin status.

func (*Client) User

func (c *Client) User(id int64) (user User, err error)

User fetches a user by ID.

func (*Client) UserByEmail

func (c *Client) UserByEmail(email string) (user User, err error)

UserByEmail fetches a user by email address.

func (*Client) UserUpdate

func (c *Client) UserUpdate(u User) error

UserUpdate updates a user by ID.

func (*Client) Users

func (c *Client) Users() (users []UserSearch, err error)

Users fetches and returns Grafana users.

func (Client) WithOrgID added in v0.18.0

func (c Client) WithOrgID(orgID int64) *Client

WithOrgID returns a new client with the provided organization ID.

type CloudAPIKey added in v0.4.4

type CloudAPIKey struct {
	ID         int
	Name       string
	Role       string
	Token      string
	Expiration string
}

type CloudAccessPolicy added in v0.17.0

type CloudAccessPolicy struct {
	Name        string                   `json:"name"`
	DisplayName string                   `json:"displayName"`
	Scopes      []string                 `json:"scopes"`
	Realms      []CloudAccessPolicyRealm `json:"realms"`

	// The following fields are not part of the input, but are returned by the API.
	ID        string    `json:"id"`
	OrgID     string    `json:"orgId"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type CloudAccessPolicyItems added in v0.17.0

type CloudAccessPolicyItems struct {
	Items []*CloudAccessPolicy `json:"items"`
}

type CloudAccessPolicyLabelPolicy added in v0.17.0

type CloudAccessPolicyLabelPolicy struct {
	Selector string `json:"selector"`
}

type CloudAccessPolicyRealm added in v0.17.0

type CloudAccessPolicyRealm struct {
	Type          string                         `json:"type"`
	Identifier    string                         `json:"identifier"`
	LabelPolicies []CloudAccessPolicyLabelPolicy `json:"labelPolicies"`
}

type CloudAccessPolicyToken added in v0.17.0

type CloudAccessPolicyToken struct {
	ID             string     `json:"id"`
	AccessPolicyID string     `json:"accessPolicyId"`
	Name           string     `json:"name"`
	DisplayName    string     `json:"displayName"`
	ExpiresAt      *time.Time `json:"expiresAt"`
	FirstUsedAt    time.Time  `json:"firstUsedAt"`
	CreatedAt      time.Time  `json:"createdAt"`
	UpdatedAt      *time.Time `json:"updatedAt"`

	Token string `json:"token,omitempty"` // Only returned when creating a token.
}

type CloudAccessPolicyTokenItems added in v0.17.0

type CloudAccessPolicyTokenItems struct {
	Items []*CloudAccessPolicyToken `json:"items"`
}

type CloudOrg added in v0.17.0

type CloudOrg struct {
	ID        int64     `json:"id"`
	Slug      string    `json:"slug"`
	Name      string    `json:"name"`
	URL       string    `json:"url"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type CloudPluginInstallation added in v0.4.6

type CloudPluginInstallation struct {
	ID           int    `json:"id"`
	InstanceID   int    `json:"instanceId"`
	InstanceURL  string `json:"instanceUrl"`
	InstanceSlug string `json:"instanceSlug"`
	PluginID     int    `json:"pluginId"`
	PluginSlug   string `json:"pluginSlug"`
	PluginName   string `json:"pluginName"`
	Version      string `json:"version"`
}

type CloudRegion added in v0.4.3

type CloudRegion struct {
	ID          int    `json:"id"`
	Status      string `json:"status"`
	Slug        string `json:"slug"`
	Name        string `json:"name"`
	Description string `json:"description"`
	CreatedAt   string `json:"createdAt"`
	UpdatedAt   string `json:"updatedAt"`
	Visibility  string `json:"visibility"`

	// Service URLs for the region
	StackStateServiceURL      string `json:"stackStateServiceUrl"`
	SyntheticMonitoringAPIURL string `json:"syntheticMonitoringApiUrl"`
	IntegrationsAPIURL        string `json:"integrationsApiUrl"`
	HostedExportersAPIURL     string `json:"hostedExportersApiUrl"`
	MachineLearningAPIURL     string `json:"machineLearningApiUrl"`
	IncidentsAPIURL           string `json:"incidentsApiUrl"`

	// Hosted Grafana
	HGClusterID   int    `json:"hgClusterId"`
	HGClusterSlug string `json:"hgClusterSlug"`
	HGClusterName string `json:"hgClusterName"`
	HGClusterURL  string `json:"hgClusterUrl"`

	// Hosted Metrics: Prometheus
	HMPromClusterID   int    `json:"hmPromClusterId"`
	HMPromClusterSlug string `json:"hmPromClusterSlug"`
	HMPromClusterName string `json:"hmPromClusterName"`
	HMPromClusterURL  string `json:"hmPromClusterUrl"`

	// Hosted Metrics: Graphite
	HMGraphiteClusterID   int    `json:"hmGraphiteClusterId"`
	HMGraphiteClusterSlug string `json:"hmGraphiteClusterSlug"`
	HMGraphiteClusterName string `json:"hmGraphiteClusterName"`
	HMGraphiteClusterURL  string `json:"hmGraphiteClusterUrl"`

	// Hosted Logs
	HLClusterID   int    `json:"hlClusterId"`
	HLClusterSlug string `json:"hlClusterSlug"`
	HLClusterName string `json:"hlClusterName"`
	HLClusterURL  string `json:"hlClusterUrl"`

	// Alertmanager
	AMClusterID   int    `json:"amClusterId"`
	AMClusterSlug string `json:"amClusterSlug"`
	AMClusterName string `json:"amClusterName"`
	AMClusterURL  string `json:"amClusterUrl"`

	// Hosted Traces
	HTClusterID   int    `json:"htClusterId"`
	HTClusterSlug string `json:"htClusterSlug"`
	HTClusterName string `json:"htClusterName"`
	HTClusterURL  string `json:"htClusterUrl"`
}

CloudRegion represents a Grafana Cloud region. https://grafana.com/docs/grafana-cloud/reference/cloud-api/#list-regions

type CloudRegionsResponse added in v0.4.3

type CloudRegionsResponse struct {
	Items []CloudRegion `json:"items"`
}

CloudRegionsResponse represents the response from the Grafana Cloud regions API.

type Config

type Config struct {
	// APIKey is an optional API key or service account token.
	APIKey string
	// BasicAuth is optional basic auth credentials.
	BasicAuth *url.Userinfo
	// HTTPHeaders are optional HTTP headers.
	HTTPHeaders map[string]string
	// Client provides an optional HTTP client, otherwise a default will be used.
	Client *http.Client
	// OrgID provides an optional organization ID
	// with BasicAuth, it defaults to last used org
	// with APIKey, it is disallowed because service account tokens are scoped to a single org
	OrgID int64
	// NumRetries contains the number of attempted retries
	NumRetries int
	// RetryTimeout says how long to wait before retrying a request
	RetryTimeout time.Duration
	// RetryStatusCodes contains the list of status codes to retry, use "x" as a wildcard for a single digit (default: [429, 5xx])
	RetryStatusCodes []string
}

Config contains client configuration.

type ContactPoint added in v0.8.0

type ContactPoint struct {
	UID                   string                 `json:"uid"`
	Name                  string                 `json:"name"`
	Type                  string                 `json:"type"`
	Settings              map[string]interface{} `json:"settings"`
	DisableResolveMessage bool                   `json:"disableResolveMessage"`
	Provenance            string                 `json:"provenance"`
}

ContactPoint represents a Grafana Alerting contact point.

type CreateAPIKeyRequest

type CreateAPIKeyRequest struct {
	Name          string `json:"name"`
	Role          string `json:"role"`
	SecondsToLive int64  `json:"secondsToLive,omitempty"`
}

type CreateAPIKeyResponse

type CreateAPIKeyResponse struct {
	// ID field only returned after Grafana v7.
	ID   int64  `json:"id,omitempty"`
	Name string `json:"name"`
	Key  string `json:"key"`
}

type CreateCloudAPIKeyInput added in v0.4.4

type CreateCloudAPIKeyInput struct {
	Name string `json:"name"`
	Role string `json:"role"`
}

type CreateCloudAccessPolicyInput added in v0.17.0

type CreateCloudAccessPolicyInput struct {
	Name        string                   `json:"name"`
	DisplayName string                   `json:"displayName"`
	Scopes      []string                 `json:"scopes"`
	Realms      []CloudAccessPolicyRealm `json:"realms"`
}

type CreateCloudAccessPolicyTokenInput added in v0.17.0

type CreateCloudAccessPolicyTokenInput struct {
	AccessPolicyID string     `json:"accessPolicyId"`
	Name           string     `json:"name"`
	DisplayName    string     `json:"displayName,omitempty"`
	ExpiresAt      *time.Time `json:"expiresAt,omitempty"`
}

type CreateSLOResponse added in v0.21.0

type CreateSLOResponse struct {
	Message string `json:"message,omitempty"`
	UUID    string `json:"uuid,omitempty"`
}

type CreateServiceAccountRequest added in v0.8.0

type CreateServiceAccountRequest struct {
	Name       string `json:"name"`
	Role       string `json:"role,omitempty"`
	IsDisabled *bool  `json:"isDisabled,omitempty"`
}

CreateServiceAccountRequest is the request body for creating a new service account.

type CreateServiceAccountTokenRequest added in v0.8.0

type CreateServiceAccountTokenRequest struct {
	Name             string `json:"name"`
	ServiceAccountID int64  `json:"-"`
	SecondsToLive    int64  `json:"secondsToLive,omitempty"`
}

CreateServiceAccountTokenRequest represents the request body for creating a new service account token.

type CreateServiceAccountTokenResponse added in v0.8.0

type CreateServiceAccountTokenResponse struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	Key  string `json:"key"`
}

CreateServiceAccountTokenResponse represents the response from the Grafana API when creating a service account token.

type CreateStackInput added in v0.2.6

type CreateStackInput struct {
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	URL         string `json:"url"`
	Region      string `json:"region"`
	Description string `json:"description"`
}

type Dashboard

type Dashboard struct {
	Model    map[string]interface{} `json:"dashboard"`
	FolderID int64                  `json:"folderId"`

	// This field is read-only. It is not used when creating a new dashboard.
	Meta DashboardMeta `json:"meta"`

	// These fields are only used when creating a new dashboard, they will always be empty when getting a dashboard.
	Overwrite bool   `json:"overwrite,omitempty"`
	Message   string `json:"message,omitempty"`
	FolderUID string `json:"folderUid,omitempty"`
}

Dashboard represents a Grafana dashboard.

type DashboardMeta

type DashboardMeta struct {
	IsStarred bool   `json:"isStarred"`
	Slug      string `json:"slug"`
	Folder    int64  `json:"folderId"`
	FolderUID string `json:"folderUid"`
	URL       string `json:"url"`
}

DashboardMeta represents Grafana dashboard meta.

type DashboardPermission

type DashboardPermission struct {
	DashboardID  int64  `json:"dashboardId"`
	DashboardUID string `json:"uid"`
	UserID       int64  `json:"userId"`
	TeamID       int64  `json:"teamId"`
	Role         string `json:"role"`
	IsFolder     bool   `json:"isFolder"`
	Inherited    bool   `json:"inherited"`

	// Permission levels are
	// 1 = View
	// 2 = Edit
	// 4 = Admin
	Permission     int64  `json:"permission"`
	PermissionName string `json:"permissionName"`
}

DashboardPermission has information such as a dashboard, user, team, role and permission.

type DashboardRef added in v0.21.0

type DashboardRef struct {
	UID string `json:"UID"`
}

DashboardRef defines model for DashboardRef.

type DashboardSaveResponse

type DashboardSaveResponse struct {
	Slug    string `json:"slug"`
	ID      int64  `json:"id"`
	UID     string `json:"uid"`
	Status  string `json:"status"`
	Version int64  `json:"version"`
}

DashboardSaveResponse represents the Grafana API response to creating or saving a dashboard.

type DataSource

type DataSource struct {
	ID   int64  `json:"id,omitempty"`
	UID  string `json:"uid,omitempty"`
	Name string `json:"name"`

	Type string `json:"type"`
	// This is only returned by the API. It depends on the Type.
	TypeLogoURL string `json:"typeLogoUrl,omitempty"`

	URL    string `json:"url"`
	Access string `json:"access"`

	// This is only returned by the API. It can only be set through the `editable` attribute of provisioned data sources.
	ReadOnly bool `json:"readOnly"`

	Database string `json:"database,omitempty"`
	User     string `json:"user,omitempty"`

	OrgID     int64 `json:"orgId,omitempty"`
	IsDefault bool  `json:"isDefault"`

	BasicAuth     bool   `json:"basicAuth"`
	BasicAuthUser string `json:"basicAuthUser,omitempty"`

	WithCredentials bool `json:"withCredentials,omitempty"`

	JSONData       map[string]interface{} `json:"jsonData,omitempty"`
	SecureJSONData map[string]interface{} `json:"secureJsonData,omitempty"`

	Version int `json:"version,omitempty"`
}

DataSource represents a Grafana data source.

type DatasourceCache added in v0.24.0

type DatasourceCache struct {
	Message        string `json:"message"`
	DatasourceID   int64  `json:"dataSourceID"`
	DatasourceUID  string `json:"dataSourceUID"`
	Enabled        bool   `json:"enabled"`
	TTLQueriesMs   int64  `json:"ttlQueriesMs"`
	TTLResourcesMs int64  `json:"ttlResourcesMs"`
	UseDefaultTLS  bool   `json:"useDefaultTTL"`
	DefaultTTLMs   int64  `json:"defaultTTLMs"`
	Created        string `json:"created"`
	Updated        string `json:"updated"`
}

type DatasourceCachePayload added in v0.24.0

type DatasourceCachePayload struct {
	DatasourceID   int64  `json:"dataSourceID"`
	DatasourceUID  string `json:"dataSourceUID"`
	Enabled        bool   `json:"enabled"`
	UseDefaultTLS  bool   `json:"useDefaultTTL"`
	TTLQueriesMs   int64  `json:"ttlQueriesMs"`
	TTLResourcesMs int64  `json:"ttlResourcesMs"`
}

type DatasourcePermission

type DatasourcePermission struct {
	ID           int64  `json:"id"`
	DatasourceID int64  `json:"datasourceId"`
	UserID       int64  `json:"userId"`
	UserEmail    string `json:"userEmail"`
	TeamID       int64  `json:"teamId"`
	BuiltInRole  string `json:"builtInRole"`

	// Permission levels are
	// 1 = Query
	// 2 = Edit
	Permission     DatasourcePermissionType `json:"permission"`
	PermissionName string                   `json:"permissionName"`
}

DatasourcePermission has information such as a datasource, user, team, role and permission.

type DatasourcePermissionAddPayload

type DatasourcePermissionAddPayload struct {
	UserID      int64                    `json:"userId"`
	TeamID      int64                    `json:"teamId"`
	BuiltInRole string                   `json:"builtinRole"`
	Permission  DatasourcePermissionType `json:"permission"`
}

type DatasourcePermissionType

type DatasourcePermissionType int
const (
	DatasourcePermissionQuery DatasourcePermissionType
	DatasourcePermissionEdit
)

type DatasourcePermissionsResponse

type DatasourcePermissionsResponse struct {
	DatasourceID int64                   `json:"datasourceId"`
	Enabled      bool                    `json:"enabled"`
	Permissions  []*DatasourcePermission `json:"permissions"`
}

type DayOfMonthRange added in v0.8.0

type DayOfMonthRange string

A DayOfMonthRange is an inclusive range of days, 1-31, within a month, e.g. "1" or "14:16". Negative values can be used to represent days counting from the end of a month, e.g. "-1".

type DeleteAPIKeyResponse

type DeleteAPIKeyResponse struct {
	Message string `json:"message"`
}

type DeleteServiceAccountResponse added in v0.8.0

type DeleteServiceAccountResponse struct {
	Message string `json:"message"`
}

DeleteServiceAccountResponse represents the response from deleting a service account or a service account token.

type DestinationDatasource added in v0.25.0

type DestinationDatasource struct {
	Type string `json:"type,omitempty"`
	UID  string `json:"uid,omitempty"`
}

DestinationDatasource defines model for DestinationDatasource.

type ErrNotFound added in v0.25.0

type ErrNotFound struct {
	BodyContents []byte
}

func (ErrNotFound) Error added in v0.25.0

func (e ErrNotFound) Error() string

type ExecErrState added in v0.8.0

type ExecErrState string

type Folder

type Folder struct {
	ID    int64  `json:"id"`
	UID   string `json:"uid"`
	Title string `json:"title"`
	URL   string `json:"url"`
}

Folder represents a Grafana folder.

type FolderDashboardSearchResponse

type FolderDashboardSearchResponse 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    uint     `json:"folderId"`
	FolderUID   string   `json:"folderUid"`
	FolderTitle string   `json:"folderTitle"`
	FolderURL   string   `json:"folderUrl"`
}

FolderDashboardSearchResponse represents the Grafana API dashboard search response.

type FolderPayload added in v0.5.0

type FolderPayload struct {
	Title     string `json:"title"`
	UID       string `json:"uid,omitempty"`
	Overwrite bool   `json:"overwrite,omitempty"`
}

type FolderPermission

type FolderPermission struct {
	ID        int64  `json:"id"`
	FolderUID string `json:"uid"`
	UserID    int64  `json:"userId"`
	TeamID    int64  `json:"teamId"`
	Role      string `json:"role"`
	IsFolder  bool   `json:"isFolder"`

	// Permission levels are
	// 1 = View
	// 2 = Edit
	// 4 = Admin
	Permission     int64  `json:"permission"`
	PermissionName string `json:"permissionName"`

	// optional fields
	FolderID    int64 `json:"folderId,omitempty"`
	DashboardID int64 `json:"dashboardId,omitempty"`
}

FolderPermission has information such as a folder, user, team, role and permission.

type FreeformQuery added in v0.21.0

type FreeformQuery struct {
	Query string `json:"query"`
}

FreeformQuery defines model for FreeformQuery.

type GetAPIKeysResponse

type GetAPIKeysResponse struct {
	ID         int64     `json:"id"`
	Name       string    `json:"name"`
	Role       string    `json:"role"`
	Expiration time.Time `json:"expiration,omitempty"`
}

type GetServiceAccountTokensResponse added in v0.8.0

type GetServiceAccountTokensResponse struct {
	ID                     int64      `json:"id"`
	Name                   string     `json:"name"`
	Created                time.Time  `json:"created,omitempty"`
	Expiration             *time.Time `json:"expiration,omitempty"`
	SecondsUntilExpiration *float64   `json:"secondsUntilExpiration,omitempty"`
	HasExpired             bool       `json:"hasExpired,omitempty"`
}

GetServiceAccountTokensResponse represents a Grafana service account token.

type GraphiteAnnotation

type GraphiteAnnotation struct {
	What string   `json:"what"`
	When int64    `json:"when"`
	Data string   `json:"data"`
	Tags []string `json:"tags,omitempty"`
}

GraphiteAnnotation represents a Grafana API annotation in Graphite format

type HealthResponse added in v0.12.1

type HealthResponse struct {
	Commit   string `json:"commit,omitempty"`
	Database string `json:"database,omitempty"`
	Version  string `json:"version,omitempty"`
}

type HistogramQuery added in v0.21.0

type HistogramQuery struct {
	GroupByLabels []string  `json:"groupByLabels,omitempty"`
	Metric        MetricDef `json:"metric"`
	Percentile    float64   `json:"percentile"`
	Threshold     Threshold `json:"threshold"`
}

HistogramQuery defines model for HistogramQuery.

type Label added in v0.21.0

type Label struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Label defines model for Label.

type LibraryPanel added in v0.2.5

type LibraryPanel struct {
	Folder      int64                  `json:"folderId,omitempty"`
	Name        string                 `json:"name"`
	Model       map[string]interface{} `json:"model"`
	Type        string                 `json:"type,omitempty"`
	Description string                 `json:"description,omitempty"`
	ID          int64                  `json:"id,omitempty"`
	Kind        int64                  `json:"kind,omitempty"`
	OrgID       int64                  `json:"orgId,omitempty"`
	UID         string                 `json:"uid,omitempty"`
	Version     int64                  `json:"version,omitempty"`
	Meta        LibraryPanelMeta       `json:"meta,omitempty"`
}

LibraryPanel represents a Grafana library panel.

type LibraryPanelConnection added in v0.2.5

type LibraryPanelConnection struct {
	ID          int64                `json:"id"`
	Kind        int64                `json:"kind"`
	PanelID     int64                `json:"elementId"`
	DashboardID int64                `json:"connectionId"`
	Created     time.Time            `json:"created"`
	CreatedBy   LibraryPanelMetaUser `json:"createdBy"`
}

LibraryPanelConnection represents a Grafana connection between a library panel and a dashboard.

type LibraryPanelCreateResponse added in v0.2.5

type LibraryPanelCreateResponse struct {
	Result LibraryPanel `json:"result"`
}

LibraryPanelCreateResponse represents the Grafana API response to creating or saving a library panel.

type LibraryPanelDeleteResponse added in v0.2.5

type LibraryPanelDeleteResponse struct {
	Message string `json:"message"`
	ID      int64  `json:"id,omitempty"`
}

LibraryPanelDeleteResponse represents the Grafana API response to deleting a library panel.

type LibraryPanelGetAllResponse added in v0.2.5

type LibraryPanelGetAllResponse struct {
	TotalCount int64          `json:"totalCount"`
	Page       int64          `json:"page"`
	PerPage    int64          `json:"perPage"`
	Elements   []LibraryPanel `json:"elements"`
}

LibraryPanelGetAllResponse represents the Grafana API response to getting all library panels.

type LibraryPanelMeta added in v0.2.5

type LibraryPanelMeta struct {
	FolderName          string               `json:"folderName,,omitempty"`
	FolderUID           string               `json:"folderUid,omitempty"`
	ConnectedDashboards int64                `json:"connectedDashboards,omitempty"`
	Created             time.Time            `json:"created,omitempty"`
	Updated             time.Time            `json:"updated,omitempty"`
	CreatedBy           LibraryPanelMetaUser `json:"createdBy,omitempty"`
	UpdatedBy           LibraryPanelMetaUser `json:"updatedBy,omitempty"`
}

LibraryPanelMeta represents Grafana library panel metadata.

type LibraryPanelMetaUser added in v0.2.5

type LibraryPanelMetaUser struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	AvatarURL string `json:"folderId"`
}

LibraryPanelMetaUser represents the Grafana library panel createdBy and updatedBy fields

type ListCloudAPIKeysOutput added in v0.4.4

type ListCloudAPIKeysOutput struct {
	Items []*CloudAPIKey
}

type Location added in v0.27.0

type Location string

A Location time zone for the time interval in IANA time zone database, e.g. "America/New_York"

type MatchType added in v0.8.0

type MatchType int
const (
	MatchEqual MatchType = iota
	MatchNotEqual
	MatchRegexp
	MatchNotRegexp
)

func (MatchType) String added in v0.8.0

func (m MatchType) String() string

type Matcher added in v0.8.0

type Matcher struct {
	Type  MatchType
	Name  string
	Value string
}

type Matchers added in v0.8.0

type Matchers []Matcher

func (Matchers) MarshalJSON added in v0.8.0

func (m Matchers) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Matchers.

func (*Matchers) UnmarshalJSON added in v0.8.0

func (m *Matchers) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Matchers.

type MetricDef added in v0.21.0

type MetricDef struct {
	PrometheusMetric string `json:"prometheusMetric"`
	Type             string `json:"type,omitempty"`
}

MetricDef defines model for MetricDef.

type MonthRange added in v0.8.0

type MonthRange string

A MonthRange is an inclusive range of months, either numerical or full calendar month, e.g "1:3", "december", or "may:august".

type MuteTiming added in v0.8.0

type MuteTiming struct {
	Name          string         `json:"name"`
	TimeIntervals []TimeInterval `json:"time_intervals"`
	Provenance    string         `json:"provenance,omitempty"`
}

MuteTiming represents a Grafana Alerting mute timing.

type NavLink struct {
	ID     string `json:"id,omitempty"`
	Text   string `json:"text,omitempty"`
	URL    string `json:"url,omitempty"`
	Target string `json:"target,omitempty"`
}

NavLink represents a Grafana nav link.

type NavbarPreference struct {
	SavedItems []NavLink `json:"savedItems"`
}

NavbarPreference represents a Grafana navbar preference.

type NoDataState added in v0.8.0

type NoDataState string

type NotificationPolicyTree added in v0.8.0

type NotificationPolicyTree struct {
	Receiver       string           `json:"receiver,omitempty"`
	GroupBy        []string         `json:"group_by,omitempty"`
	Routes         []SpecificPolicy `json:"routes,omitempty"`
	GroupWait      string           `json:"group_wait,omitempty"`
	GroupInterval  string           `json:"group_interval,omitempty"`
	RepeatInterval string           `json:"repeat_interval,omitempty"`
	Provenance     string           `json:"provenance,omitempty"`
}

Represents a notification routing tree in Grafana Alerting.

type Objective added in v0.21.0

type Objective struct {
	Value  float64 `json:"value"`
	Window string  `json:"window"`
}

Objective defines model for Objective.

type Org

type Org struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

Org represents a Grafana org.

type OrgUser

type OrgUser struct {
	OrgID  int64  `json:"orgId"`
	UserID int64  `json:"userId"`
	Email  string `json:"email"`
	Login  string `json:"login"`
	Role   string `json:"role"`
}

OrgUser represents a Grafana org user.

type PauseAlertRequest

type PauseAlertRequest struct {
	Paused bool `json:"paused"`
}

PauseAlertRequest represents the request payload for a PauseAlert request.

type PauseAlertResponse

type PauseAlertResponse struct {
	AlertID int64  `json:"alertId,omitempty"`
	State   string `json:"state,omitempty"`
	Message string `json:"message,omitempty"`
}

PauseAlertResponse represents the response body for a PauseAlert request.

type PauseAllAlertsResponse

type PauseAllAlertsResponse struct {
	AlertsAffected int64  `json:"alertsAffected,omitempty"`
	State          string `json:"state,omitempty"`
	Message        string `json:"message,omitempty"`
}

PauseAllAlertsResponse represents the response body for a PauseAllAlerts request.

type Permission

type Permission struct {
	Action string `json:"action"`
	Scope  string `json:"scope"`
}

type PermissionItem

type PermissionItem struct {
	// As you can see the docs, each item has a pair of [Role|TeamID|UserID] and Permission.
	// unnecessary fields are omitted.
	Role       string `json:"role,omitempty"`
	TeamID     int64  `json:"teamId,omitempty"`
	UserID     int64  `json:"userId,omitempty"`
	Permission int64  `json:"permission"`
}

PermissionItem represents a Grafana folder permission item.

type PermissionItems

type PermissionItems struct {
	Items []*PermissionItem `json:"items"`
}

PermissionItems represents Grafana folder permission items.

type Playlist

type Playlist struct {
	ID       int            `json:"id,omitempty"`  // Grafana < 9.0
	UID      string         `json:"uid,omitempty"` // Grafana >= 9.0
	Name     string         `json:"name"`
	Interval string         `json:"interval"`
	Items    []PlaylistItem `json:"items"`
}

Playlist represents a Grafana playlist.

func (*Playlist) QueryID added in v0.9.0

func (p *Playlist) QueryID() string

Grafana 9.0+ returns the ID and the UID but uses the UID in the API calls. Grafana <9 only returns the ID.

type PlaylistItem

type PlaylistItem struct {
	Type  string `json:"type"`
	Value string `json:"value"`
	Order int    `json:"order"`
	Title string `json:"title"`
}

PlaylistItem represents a Grafana playlist item.

type Plugin added in v0.4.6

type Plugin struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Version     string `json:"version"`
	Description string `json:"description"`
}

type Preferences

type Preferences struct {
	Theme            string                 `json:"theme,omitempty"`
	HomeDashboardID  int64                  `json:"homeDashboardId,omitempty"`
	HomeDashboardUID string                 `json:"homeDashboardUID,omitempty"`
	Timezone         string                 `json:"timezone,omitempty"`
	WeekStart        string                 `json:"weekStart,omitempty"`
	Locale           string                 `json:"locale,omitempty"`
	Navbar           NavbarPreference       `json:"navbar,omitempty"`
	QueryHistory     QueryHistoryPreference `json:"queryHistory,omitempty"`
}

Preferences represents Grafana preferences.

type PublicDashboard added in v0.24.0

type PublicDashboard struct {
	UID                  string    `json:"uid"`
	DashboardUID         string    `json:"dashboardUid"`
	AccessToken          string    `json:"accessToken"`
	TimeSelectionEnabled bool      `json:"timeSelectionEnabled"`
	IsEnabled            bool      `json:"isEnabled"`
	AnnotationsEnabled   bool      `json:"annotationsEnabled"`
	Share                string    `json:"share"`
	CreatedBy            int64     `json:"createdBy"`
	UpdatedBy            int64     `json:"updatedBy"`
	CreatedAt            time.Time `json:"createdAt"`
	UpdatedAt            time.Time `json:"updatedAt"`
}

PublicDashboard represents a public dashboard.

type PublicDashboardListResponse added in v0.24.0

type PublicDashboardListResponse struct {
	UID          string `json:"uid"`
	AccessToken  string `json:"accessToken"`
	Title        string `json:"title"`
	DashboardUID string `json:"dashboardUid"`
	IsEnabled    bool   `json:"isEnabled"`
}

type PublicDashboardListResponseWithPagination added in v0.24.0

type PublicDashboardListResponseWithPagination struct {
	PublicDashboards []*PublicDashboardListResponse `json:"publicDashboards"`
	TotalCount       int64                          `json:"totalCount"`
	Page             int                            `json:"page"`
	PerPage          int                            `json:"perPage"`
}

type PublicDashboardPayload added in v0.24.0

type PublicDashboardPayload struct {
	UID                  string `json:"uid"`
	AccessToken          string `json:"accessToken"`
	TimeSelectionEnabled bool   `json:"timeSelectionEnabled"`
	IsEnabled            bool   `json:"isEnabled"`
	AnnotationsEnabled   bool   `json:"annotationsEnabled"`
	Share                string `json:"share"`
}

PublicDashboardPayload represents a public dashboard payload.

type Query added in v0.21.0

type Query struct {
	Freeform  *FreeformQuery  `json:"freeform,omitempty"`
	Histogram *HistogramQuery `json:"histogram,omitempty"`
	Ratio     *RatioQuery     `json:"ratio,omitempty"`
	Threshold *ThresholdQuery `json:"threshold,omitempty"`
	Type      QueryType       `json:"type"`
}

Query defines model for Query.

type QueryHistoryPreference added in v0.10.0

type QueryHistoryPreference struct {
	HomeTab string `json:"homeTab"`
}

QueryHistoryPreference represents a Grafana query history preference.

type QueryType added in v0.21.0

type QueryType string

QueryType defines model for Query.Type.

const (
	QueryTypeFreeform  QueryType = "freeform"
	QueryTypeHistogram QueryType = "histogram"
	QueryTypeRatio     QueryType = "ratio"
	QueryTypeThreshold QueryType = "threshold"
)

Defines values for QueryType.

type RatioQuery added in v0.21.0

type RatioQuery struct {
	GroupByLabels []string  `json:"groupByLabels,omitempty"`
	SuccessMetric MetricDef `json:"successMetric"`
	TotalMetric   MetricDef `json:"totalMetric"`
}

RatioQuery defines model for RatioQuery.

type ReadOnly added in v0.25.0

type ReadOnly struct {
	DrillDownDashboardRef *DashboardRef `json:"drillDownDashboardRef,omitempty"`
	Provenance            string        `json:"provenance,omitempty"`
	Status                *Status       `json:"status,omitempty"`
}

ReadOnly defines model for ReadOnly.

type RelativeTimeRange added in v0.8.0

type RelativeTimeRange struct {
	From time.Duration `json:"from"`
	To   time.Duration `json:"to"`
}

RelativeTimeRange represents the time range for an alert query.

type Report added in v0.2.2

type Report struct {
	// ReadOnly
	ID     int64  `json:"id,omitempty"`
	UserID int64  `json:"userId,omitempty"`
	OrgID  int64  `json:"orgId,omitempty"`
	State  string `json:"state,omitempty"`

	Dashboards []ReportDashboard `json:"dashboards"`

	Name               string         `json:"name"`
	Recipients         string         `json:"recipients"`
	ReplyTo            string         `json:"replyTo"`
	Message            string         `json:"message"`
	Schedule           ReportSchedule `json:"schedule"`
	Options            ReportOptions  `json:"options"`
	EnableDashboardURL bool           `json:"enableDashboardUrl"`
	EnableCSV          bool           `json:"enableCsv"`
	Formats            []string       `json:"formats"`
	ScaleFactor        int64          `json:"scaleFactor"`
}

Report represents a Grafana report.

type ReportDashboard added in v0.16.0

type ReportDashboard struct {
	Dashboard ReportDashboardIdentifier `json:"dashboard"`
	TimeRange ReportDashboardTimeRange  `json:"timeRange"`
	Variables map[string]string         `json:"reportVariables"`
}

ReportDashboard represents a dashboard on a Grafana report.

type ReportDashboardIdentifier added in v0.16.0

type ReportDashboardIdentifier struct {
	ID   int64  `json:"id,omitempty"`
	UID  string `json:"uid,omitempty"`
	Name string `json:"name,omitempty"`
}

ReportDashboardIdentifier represents the identifier for a dashboard on a Grafana report.

type ReportDashboardTimeRange added in v0.16.0

type ReportDashboardTimeRange struct {
	From string `json:"from"`
	To   string `json:"to"`
}

ReportDashboardTimeRange represents the time range from a dashboard on a Grafana report.

type ReportOptions added in v0.2.2

type ReportOptions struct {
	Orientation string `json:"orientation"`
	Layout      string `json:"layout"`
}

ReportOptions represents the options for a Grafana report.

type ReportSchedule added in v0.2.2

type ReportSchedule struct {
	StartDate         *time.Time `json:"startDate,omitempty"`
	EndDate           *time.Time `json:"endDate,omitempty"`
	Frequency         string     `json:"frequency"`
	IntervalFrequency string     `json:"intervalFrequency"`
	IntervalAmount    int64      `json:"intervalAmount"`
	WorkdaysOnly      bool       `json:"workdaysOnly"`
	TimeZone          string     `json:"timeZone"`
	DayOfMonth        string     `json:"dayOfMonth,omitempty"`
}

ReportSchedule represents the schedule from a Grafana report.

type ResourceID added in v0.26.0

type ResourceID int64

ResourceID wraps `int64` to be a valid `ResourceIdent`

func (ResourceID) String added in v0.26.0

func (id ResourceID) String() string

type ResourceIdent added in v0.26.0

type ResourceIdent interface {
	fmt.Stringer
}

ResourceIdent represents anything that can be considered a resource identifier.

type ResourcePermission added in v0.26.0

type ResourcePermission struct {
	ID               int64    `json:"id"`
	RoleName         string   `json:"roleName"`
	IsManaged        bool     `json:"isManaged"`
	IsInherited      bool     `json:"isInherited"`
	IsServiceAccount bool     `json:"isServiceAccount"`
	UserID           int64    `json:"userId,omitempty"`
	UserLogin        string   `json:"userLogin,omitempty"`
	Team             string   `json:"team,omitempty"`
	TeamID           int64    `json:"teamId,omitempty"`
	BuiltInRole      string   `json:"builtInRole,omitempty"`
	Actions          []string `json:"actions"`
	Permission       string   `json:"permission"`
}

type ResourceUID added in v0.26.0

type ResourceUID string

ResourceUID wraps `string` to be a valid `ResourceIdent`

func (ResourceUID) String added in v0.26.0

func (id ResourceUID) String() string

type RetrieveServiceAccountResponse added in v0.8.0

type RetrieveServiceAccountResponse struct {
	TotalCount      int64               `json:"totalCount"`
	ServiceAccounts []ServiceAccountDTO `json:"serviceAccounts"`
	Page            int64               `json:"page"`
	PerPage         int64               `json:"perPage"`
}

type Role

type Role struct {
	Version     int64        `json:"version"`
	UID         string       `json:"uid,omitempty"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Global      bool         `json:"global"`
	Group       string       `json:"group"`
	DisplayName string       `json:"displayName"`
	Hidden      bool         `json:"hidden"`
	Permissions []Permission `json:"permissions,omitempty"`
}

type RoleAssignments added in v0.12.0

type RoleAssignments struct {
	RoleUID         string `json:"role_uid"`
	Users           []int  `json:"users,omitempty"`
	Teams           []int  `json:"teams,omitempty"`
	ServiceAccounts []int  `json:"service_accounts,omitempty"`
}

type RuleGroup added in v0.8.0

type RuleGroup struct {
	Title     string      `json:"title"`
	FolderUID string      `json:"folderUid"`
	Interval  int64       `json:"interval"`
	Rules     []AlertRule `json:"rules"`
}

RuleGroup represents a group of rules in Grafana Alerting.

type SearchTeam

type SearchTeam struct {
	TotalCount int64   `json:"totalCount,omitempty"`
	Teams      []*Team `json:"teams,omitempty"`
	Page       int64   `json:"page,omitempty"`
	PerPage    int64   `json:"perPage,omitempty"`
}

SearchTeam represents a search for a Grafana team.

type ServiceAccountDTO added in v0.8.0

type ServiceAccountDTO struct {
	ID         int64  `json:"id"`
	Name       string `json:"name"`
	Login      string `json:"login"`
	OrgID      int64  `json:"orgId"`
	IsDisabled bool   `json:"isDisabled"`
	Role       string `json:"role"`
	Tokens     int64  `json:"tokens"`
	AvatarURL  string `json:"avatarUrl"`
}

ServiceAccountDTO represents a Grafana service account.

type SetResourcePermissionBody added in v0.26.0

type SetResourcePermissionBody struct {
	Permission SetResourcePermissionItem `json:"permission"`
}

type SetResourcePermissionItem added in v0.26.0

type SetResourcePermissionItem struct {
	UserID      int64  `json:"userId,omitempty"`
	TeamID      int64  `json:"teamId,omitempty"`
	BuiltinRole string `json:"builtInRole,omitempty"`
	Permission  string `json:"permission"`
}

type SetResourcePermissionsBody added in v0.26.0

type SetResourcePermissionsBody struct {
	Permissions []SetResourcePermissionItem `json:"permissions"`
}

type SetResourcePermissionsResponse added in v0.26.0

type SetResourcePermissionsResponse struct {
	Message string `json:"message"`
}

type Slo added in v0.21.0

type Slo struct {
	Alerting              *Alerting              `json:"alerting,omitempty"`
	Description           string                 `json:"description"`
	DestinationDatasource *DestinationDatasource `json:"destinationDatasource,omitempty"`
	Labels                []Label                `json:"labels,omitempty"`
	Name                  string                 `json:"name"`
	Objectives            []Objective            `json:"objectives"`
	Query                 Query                  `json:"query"`
	ReadOnly              *ReadOnly              `json:"readOnly,omitempty"`
	UUID                  string                 `json:"uuid"`
}

Slo defines model for Slo.

type Slos added in v0.21.0

type Slos struct {
	Slos []Slo `json:"slos"`
}

type Snapshot added in v0.3.0

type Snapshot struct {
	Model   map[string]interface{} `json:"dashboard"`
	Expires int64                  `json:"expires"`
}

Snapshot represents a Grafana snapshot.

type SnapshotCreateResponse added in v0.3.0

type SnapshotCreateResponse struct {
	DeleteKey string `json:"deleteKey"`
	DeleteURL string `json:"deleteUrl"`
	Key       string `json:"key"`
	URL       string `json:"url"`
	ID        int64  `json:"id"`
}

SnapshotResponse represents the Grafana API response to creating a dashboard.

type SpecificPolicy added in v0.8.0

type SpecificPolicy struct {
	Receiver          string           `json:"receiver,omitempty"`
	GroupBy           []string         `json:"group_by,omitempty"`
	ObjectMatchers    Matchers         `json:"object_matchers,omitempty"`
	MuteTimeIntervals []string         `json:"mute_time_intervals,omitempty"`
	Continue          bool             `json:"continue"`
	Routes            []SpecificPolicy `json:"routes,omitempty"`
	GroupWait         string           `json:"group_wait,omitempty"`
	GroupInterval     string           `json:"group_interval,omitempty"`
	RepeatInterval    string           `json:"repeat_interval,omitempty"`
}

Represents a non-root node in a notification routing tree.

type Stack added in v0.2.6

type Stack struct {
	ID                       int64     `json:"id"`
	OrgID                    int64     `json:"orgId"`
	OrgSlug                  string    `json:"orgSlug"`
	OrgName                  string    `json:"orgName"`
	Name                     string    `json:"name"`
	URL                      string    `json:"url"`
	Slug                     string    `json:"slug"`
	Version                  string    `json:"version"`
	Description              string    `json:"description"`
	Status                   string    `json:"status"`
	Gateway                  string    `json:"gateway"`
	CreatedAt                time.Time `json:"createdAt"`
	CreatedBy                string    `json:"createdBy"`
	UpdatedAt                time.Time `json:"updatedAt"`
	UpdatedBy                string    `json:"updatedBy"`
	Trial                    int       `json:"trial"`
	TrialExpiresAt           time.Time `json:"trialExpiresAt"`
	ClusterID                int       `json:"clusterId"`
	ClusterSlug              string    `json:"clusterSlug"`
	ClusterName              string    `json:"clusterName"`
	Plan                     string    `json:"plan"`
	PlanName                 string    `json:"planName"`
	BillingStartDate         time.Time `json:"billingStartDate"`
	BillingEndDate           time.Time `json:"billingEndDate"`
	BillingActiveUsers       int       `json:"billingActiveUsers"`
	CurrentActiveUsers       int       `json:"currentActiveUsers"`
	CurrentActiveAdminUsers  int       `json:"currentActiveAdminUsers"`
	CurrentActiveEditorUsers int       `json:"currentActiveEditorUsers"`
	CurrentActiveViewerUsers int       `json:"currentActiveViewerUsers"`
	DailyUserCnt             int       `json:"dailyUserCnt"`
	DailyAdminCnt            int       `json:"dailyAdminCnt"`
	DailyEditorCnt           int       `json:"dailyEditorCnt"`
	DailyViewerCnt           int       `json:"dailyViewerCnt"`
	BillableUserCnt          int       `json:"billableUserCnt"`
	DashboardCnt             int       `json:"dashboardCnt"`
	DatasourceCnts           struct {
	} `json:"datasourceCnts"`
	UserQuota                         int     `json:"userQuota"`
	DashboardQuota                    int     `json:"dashboardQuota"`
	AlertQuota                        int     `json:"alertQuota"`
	Ssl                               bool    `json:"ssl"`
	CustomAuth                        bool    `json:"customAuth"`
	CustomDomain                      bool    `json:"customDomain"`
	Support                           bool    `json:"support"`
	RunningVersion                    string  `json:"runningVersion"`
	MachineLearning                   int     `json:"machineLearning"`
	HmInstancePromID                  int     `json:"hmInstancePromId"`
	HmInstancePromURL                 string  `json:"hmInstancePromUrl"`
	HmInstancePromName                string  `json:"hmInstancePromName"`
	HmInstancePromStatus              string  `json:"hmInstancePromStatus"`
	HmInstancePromCurrentUsage        float64 `json:"hmInstancePromCurrentUsage"`
	HmInstancePromCurrentActiveSeries int     `json:"hmInstancePromCurrentActiveSeries"`
	HmInstanceGraphiteID              int     `json:"hmInstanceGraphiteId"`
	HmInstanceGraphiteURL             string  `json:"hmInstanceGraphiteUrl"`
	HmInstanceGraphiteName            string  `json:"hmInstanceGraphiteName"`
	HmInstanceGraphiteType            string  `json:"hmInstanceGraphiteType"`
	HmInstanceGraphiteStatus          string  `json:"hmInstanceGraphiteStatus"`
	HmInstanceGraphiteCurrentUsage    float64 `json:"hmInstanceGraphiteCurrentUsage"`
	HlInstanceID                      int     `json:"hlInstanceId"`
	HlInstanceURL                     string  `json:"hlInstanceUrl"`
	HlInstanceName                    string  `json:"hlInstanceName"`
	HlInstanceStatus                  string  `json:"hlInstanceStatus"`
	HlInstanceCurrentUsage            float64 `json:"hlInstanceCurrentUsage"`
	AmInstanceID                      int     `json:"amInstanceId"`
	AmInstanceName                    string  `json:"amInstanceName"`
	AmInstanceURL                     string  `json:"amInstanceUrl"`
	AmInstanceStatus                  string  `json:"amInstanceStatus"`
	AmInstanceGeneratorURL            string  `json:"amInstanceGeneratorUrl"`
	HtInstanceID                      int     `json:"htInstanceId"`
	HtInstanceURL                     string  `json:"htInstanceUrl"`
	HtInstanceName                    string  `json:"htInstanceName"`
	HtInstanceStatus                  string  `json:"htInstanceStatus"`
	RegionID                          int     `json:"regionId"`
	RegionSlug                        string  `json:"regionSlug"`
	Links                             []struct {
		Rel  string `json:"rel"`
		Href string `json:"href"`
	} `json:"links"`
}

https://grafana.com/docs/grafana-cloud/reference/cloud-api/#stacks

type StackItems added in v0.2.6

type StackItems struct {
	Items []*Stack `json:"items"`
}

StackItems represents Grafana stack items.

type Status added in v0.25.0

type Status struct {
	Message string `json:"message,omitempty"`
	Type    string `json:"type"`
}

Status defines model for Status.

type Team

type Team struct {
	ID          int64  `json:"id,omitempty"`
	OrgID       int64  `json:"orgId,omitempty"`
	Name        string `json:"name"`
	Email       string `json:"email,omitempty"`
	AvatarURL   string `json:"avatarUrl,omitempty"`
	MemberCount int64  `json:"memberCount,omitempty"`
	Permission  int64  `json:"permission,omitempty"`
}

Team consists of a get response It's used in Add and Update API

type TeamGroup

type TeamGroup struct {
	OrgID   int64  `json:"orgId,omitempty"`
	TeamID  int64  `json:"teamId,omitempty"`
	GroupID string `json:"groupID,omitempty"`
}

TeamGroup represents a Grafana TeamGroup.

type TeamMember

type TeamMember struct {
	OrgID      int64    `json:"orgId,omitempty"`
	TeamID     int64    `json:"teamId,omitempty"`
	UserID     int64    `json:"userID,omitempty"`
	Email      string   `json:"email,omitempty"`
	Login      string   `json:"login,omitempty"`
	AvatarURL  string   `json:"avatarUrl,omitempty"`
	Permission int64    `json:"permission,omitempty"`
	Labels     []string `json:"labels,omitempty"`
}

TeamMember represents a Grafana team member.

type Threshold added in v0.21.0

type Threshold struct {
	Operator ThresholdOperator `json:"operator"`
	Value    float64           `json:"value"`
}

Threshold defines model for Threshold.

type ThresholdOperator added in v0.21.0

type ThresholdOperator string

ThresholdOperator defines model for Threshold.Operator.

const (
	ThresholdOperatorEmpty      ThresholdOperator = "<"
	ThresholdOperatorEqualEqual ThresholdOperator = "=="
	ThresholdOperatorN1         ThresholdOperator = "<="
	ThresholdOperatorN2         ThresholdOperator = ">="
	ThresholdOperatorN3         ThresholdOperator = ">"
)

Defines values for ThresholdOperator.

type ThresholdQuery added in v0.21.0

type ThresholdQuery struct {
	GroupByLabels []string  `json:"groupByLabels,omitempty"`
	Metric        MetricDef `json:"metric"`
	Threshold     Threshold `json:"threshold"`
}

ThresholdQuery defines model for ThresholdQuery.

type TimeInterval added in v0.8.0

type TimeInterval struct {
	Times       []TimeRange       `json:"times,omitempty"`
	Weekdays    []WeekdayRange    `json:"weekdays,omitempty"`
	DaysOfMonth []DayOfMonthRange `json:"days_of_month,omitempty"`
	Months      []MonthRange      `json:"months,omitempty"`
	Years       []YearRange       `json:"years,omitempty"`
	Location    Location          `json:"location,omitempty"`
}

TimeInterval describes intervals of time using a Prometheus-defined standard.

type TimeRange added in v0.8.0

type TimeRange struct {
	StartMinute string `json:"start_time"`
	EndMinute   string `json:"end_time"`
}

TimeRange represents a range of minutes within a 1440 minute day, exclusive of the End minute.

type UpdateCloudAccessPolicyInput added in v0.17.0

type UpdateCloudAccessPolicyInput struct {
	DisplayName string                   `json:"displayName"`
	Scopes      []string                 `json:"scopes"`
	Realms      []CloudAccessPolicyRealm `json:"realms"`
}

type UpdateCloudAccessPolicyTokenInput added in v0.17.0

type UpdateCloudAccessPolicyTokenInput struct {
	DisplayName string `json:"displayName"`
}

type UpdateOrgPreferencesResponse added in v0.10.0

type UpdateOrgPreferencesResponse struct {
	Message string `json:"message"`
}

UpdateOrgPreferencesResponse represents the response to a request updating Grafana org preferences.

type UpdateServiceAccountRequest added in v0.8.0

type UpdateServiceAccountRequest struct {
	Name       string `json:"name,omitempty"`
	Role       string `json:"role,omitempty"`
	IsDisabled *bool  `json:"isDisabled,omitempty"`
}

UpdateServiceAccountRequest is the request body for modifying a service account.

type UpdateStackInput added in v0.2.6

type UpdateStackInput struct {
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
}

type User

type User struct {
	ID         int64     `json:"id,omitempty"`
	Email      string    `json:"email,omitempty"`
	Name       string    `json:"name,omitempty"`
	Login      string    `json:"login,omitempty"`
	Theme      string    `json:"theme,omitempty"`
	OrgID      int64     `json:"orgId,omitempty"`
	IsAdmin    bool      `json:"isGrafanaAdmin,omitempty"`
	IsDisabled bool      `json:"isDisabled,omitempty"`
	IsExternal bool      `json:"isExternal,omitempty"`
	UpdatedAt  time.Time `json:"updatedAt,omitempty"`
	CreatedAt  time.Time `json:"createdAt,omitempty"`
	AuthLabels []string  `json:"authLabels,omitempty"`
	AvatarURL  string    `json:"avatarUrl,omitempty"`
	Password   string    `json:"password,omitempty"`
}

User represents a Grafana user. It is structured after the UserProfileDTO struct in the Grafana codebase.

type UserSearch

type UserSearch struct {
	ID            int64     `json:"id,omitempty"`
	Email         string    `json:"email,omitempty"`
	Name          string    `json:"name,omitempty"`
	Login         string    `json:"login,omitempty"`
	IsAdmin       bool      `json:"isAdmin,omitempty"`
	IsDisabled    bool      `json:"isDisabled,omitempty"`
	LastSeenAt    time.Time `json:"lastSeenAt,omitempty"`
	LastSeenAtAge string    `json:"lastSeenAtAge,omitempty"`
	AuthLabels    []string  `json:"authLabels,omitempty"`
	AvatarURL     string    `json:"avatarUrl,omitempty"`
}

UserSearch represents a Grafana user as returned by API endpoints that return a collection of Grafana users. This representation of user has reduced and differing fields. It is structured after the UserSearchHitDTO struct in the Grafana codebase.

type WeekdayRange added in v0.8.0

type WeekdayRange string

A WeekdayRange is an inclusive range of weekdays, e.g. "monday" or "tuesday:thursday".

type YearRange added in v0.8.0

type YearRange string

A YearRange is a positive inclusive range of years, e.g. "2030" or "2021:2022".

Jump to

Keyboard shortcuts

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