Documentation ¶
Index ¶
- type Alert
- type AlertNotification
- type Annotation
- type BuiltInRoleAssignment
- type Client
- func (c *Client) AddDatasourcePermission(id int64, item *DatasourcePermissionAddPayload) error
- func (c *Client) AddOrgUser(orgID int64, user, role string) error
- func (c *Client) AddTeam(name string, email string) (int64, error)
- func (c *Client) AddTeamMember(id int64, userID int64) error
- func (c *Client) Alert(id int64) (Alert, error)
- func (c *Client) AlertNotification(id int64) (*AlertNotification, error)
- func (c *Client) AlertNotifications() ([]AlertNotification, error)
- func (c *Client) Alerts(params url.Values) ([]Alert, error)
- func (c *Client) Annotations(params url.Values) ([]Annotation, error)
- func (c *Client) CreateAPIKey(request CreateAPIKeyRequest) (CreateAPIKeyResponse, error)
- func (c *Client) CreateCloudAPIKey(org string, input *CreateCloudAPIKeyInput) (*CloudAPIKey, error)
- func (c *Client) CreateGrafanaAPIKeyFromCloud(stack string, input *CreateAPIKeyRequest) (*CreateAPIKeyResponse, error)
- func (c *Client) CreateTemporaryStackGrafanaClient(stackSlug, tempKeyPrefix string, tempKeyDuration time.Duration) (tempClient *Client, cleanup func() error, err error)
- func (c *Client) CreateUser(user User) (int64, error)
- func (c *Client) Dashboard(slug string) (*Dashboard, error)
- func (c *Client) DashboardByUID(uid string) (*Dashboard, error)
- func (c *Client) DashboardPermissions(id int64) ([]*DashboardPermission, error)
- func (c *Client) Dashboards() ([]FolderDashboardSearchResponse, error)
- func (c *Client) DashboardsByIDs(ids []int64) ([]FolderDashboardSearchResponse, error)
- func (c *Client) DataSource(id int64) (*DataSource, error)
- func (c *Client) DataSourceByUID(uid string) (*DataSource, error)
- func (c *Client) DatasourcePermissions(id int64) (*DatasourcePermissionsResponse, error)
- func (c *Client) DeleteAPIKey(id int64) (DeleteAPIKeyResponse, error)
- func (c *Client) DeleteAlertNotification(id int64) error
- func (c *Client) DeleteAnnotation(id int64) (string, error)
- func (c *Client) DeleteAnnotationByRegionID(id int64) (string, error)
- func (c *Client) DeleteBuiltInRoleAssignment(builtInRole BuiltInRoleAssignment) error
- func (c *Client) DeleteCloudAPIKey(org string, keyName string) error
- func (c *Client) DeleteDashboard(slug string) error
- func (c *Client) DeleteDashboardByUID(uid string) error
- func (c *Client) DeleteDataSource(id int64) error
- func (c *Client) DeleteFolder(id string) error
- func (c *Client) DeleteLibraryPanel(uid string) (*LibraryPanelDeleteResponse, error)
- func (c *Client) DeleteOrg(id int64) error
- func (c *Client) DeletePlaylist(id int) error
- func (c *Client) DeleteReport(id int64) error
- func (c *Client) DeleteRole(uid string, global bool) error
- func (c *Client) DeleteStack(stackSlug string) error
- func (c *Client) DeleteTeam(id int64) error
- func (c *Client) DeleteTeamGroup(id int64, groupID string) error
- func (c *Client) DeleteUser(id int64) error
- func (c *Client) DisableDatasourcePermissions(id int64) error
- func (c *Client) EnableDatasourcePermissions(id int64) error
- func (c *Client) Folder(id int64) (*Folder, error)
- func (c *Client) FolderByUID(uid string) (*Folder, error)
- func (c *Client) FolderDashboardSearch(params url.Values) (resp []FolderDashboardSearchResponse, err error)
- func (c *Client) FolderPermissions(fid string) ([]*FolderPermission, error)
- func (c *Client) Folders() ([]Folder, error)
- func (c *Client) GetAPIKeys(includeExpired bool) ([]*GetAPIKeysResponse, error)
- func (c *Client) GetBuiltInRoleAssignments() (map[string][]*Role, error)
- func (c *Client) GetCloudPluginInstallation(stackSlug string, pluginSlug string) (*CloudPluginInstallation, error)
- func (c *Client) GetCloudRegionBySlug(slug string) (CloudRegion, error)
- func (c *Client) GetCloudRegions() (CloudRegionsResponse, error)
- func (c *Client) GetRole(uid string) (*Role, error)
- func (c *Client) InstallCloudPlugin(stackSlug string, pluginSlug string, pluginVersion string) (*CloudPluginInstallation, error)
- func (c *Client) IsCloudPluginInstalled(stackSlug string, pluginSlug string) (bool, error)
- func (c *Client) LibraryPanelByName(name string) (*LibraryPanel, error)
- func (c *Client) LibraryPanelByUID(uid string) (*LibraryPanel, error)
- func (c *Client) LibraryPanelConnectedDashboards(uid string) ([]FolderDashboardSearchResponse, error)
- func (c *Client) LibraryPanelConnections(uid string) (*[]LibraryPanelConnection, error)
- func (c *Client) LibraryPanels() ([]LibraryPanel, error)
- func (c *Client) ListCloudAPIKeys(org string) (*ListCloudAPIKeysOutput, error)
- func (c *Client) NewAlertNotification(a *AlertNotification) (int64, error)
- func (c *Client) NewAnnotation(a *Annotation) (int64, error)
- func (c *Client) NewBuiltInRoleAssignment(builtInRoleAssignment BuiltInRoleAssignment) (*BuiltInRoleAssignment, error)
- func (c *Client) NewDashboard(dashboard Dashboard) (*DashboardSaveResponse, error)
- func (c *Client) NewDataSource(s *DataSource) (int64, error)
- func (c *Client) NewFolder(title string, uid ...string) (Folder, error)
- func (c *Client) NewGraphiteAnnotation(gfa *GraphiteAnnotation) (int64, error)
- func (c *Client) NewLibraryPanel(panel LibraryPanel) (*LibraryPanel, error)
- func (c *Client) NewOrg(name string) (int64, error)
- func (c *Client) NewPlaylist(playlist Playlist) (int, error)
- func (c *Client) NewReport(report Report) (int64, error)
- func (c *Client) NewRole(role Role) (*Role, error)
- func (c *Client) NewSnapshot(snapshot Snapshot) (*SnapshotCreateResponse, error)
- func (c *Client) NewStack(stack *CreateStackInput) (int64, error)
- func (c *Client) NewTeamGroup(id int64, groupID string) error
- func (c *Client) Org(id int64) (Org, error)
- func (c *Client) OrgByName(name string) (Org, error)
- func (c *Client) OrgUsers(orgID int64) ([]OrgUser, error)
- func (c *Client) OrgUsersCurrent() ([]OrgUser, error)
- func (c *Client) Orgs() ([]Org, error)
- func (c *Client) PatchAnnotation(id int64, a *Annotation) (string, error)
- func (c *Client) PatchLibraryPanel(uid string, panel LibraryPanel) (*LibraryPanel, error)
- func (c *Client) PauseAlert(id int64) (PauseAlertResponse, error)
- func (c *Client) PauseAllAlerts() (PauseAllAlertsResponse, error)
- func (c *Client) Playlist(id int) (*Playlist, error)
- func (c *Client) PluginByID(pluginID int64) (*Plugin, error)
- func (c *Client) PluginBySlug(slug string) (*Plugin, error)
- func (c *Client) RemoveDatasourcePermission(id, permissionID int64) error
- func (c *Client) RemoveMemberFromTeam(id int64, userID int64) error
- func (c *Client) RemoveOrgUser(orgID, userID int64) error
- func (c *Client) Report(id int64) (*Report, error)
- func (c *Client) SaveDashboard(model map[string]interface{}, overwrite bool) (*DashboardSaveResponse, error)
- func (c *Client) SearchTeam(query string) (*SearchTeam, error)
- func (c *Client) StackByID(id int64) (Stack, error)
- func (c *Client) StackBySlug(slug string) (Stack, error)
- func (c *Client) Stacks() (StackItems, error)
- func (c *Client) Team(id int64) (*Team, error)
- func (c *Client) TeamGroups(id int64) ([]TeamGroup, error)
- func (c *Client) TeamMembers(id int64) ([]*TeamMember, error)
- func (c *Client) TeamPreferences(id int64) (*Preferences, error)
- func (c *Client) UninstallCloudPlugin(stackSlug string, pluginSlug string) error
- func (c *Client) UpdateAlertNotification(a *AlertNotification) error
- func (c *Client) UpdateAnnotation(id int64, a *Annotation) (string, error)
- func (c *Client) UpdateDashboardPermissions(id int64, items *PermissionItems) error
- func (c *Client) UpdateDataSource(s *DataSource) error
- func (c *Client) UpdateFolder(uid string, title string, newUID ...string) error
- func (c *Client) UpdateFolderPermissions(fid string, items *PermissionItems) error
- func (c *Client) UpdateOrg(id int64, name string) error
- func (c *Client) UpdateOrgUser(orgID, userID int64, role string) error
- func (c *Client) UpdatePlaylist(playlist Playlist) error
- func (c *Client) UpdateReport(report Report) error
- func (c *Client) UpdateRole(role Role) error
- func (c *Client) UpdateStack(id int64, stack *UpdateStackInput) error
- func (c *Client) UpdateTeam(id int64, name string, email string) error
- func (c *Client) UpdateTeamPreferences(id int64, preferences Preferences) error
- func (c *Client) UpdateUserPassword(id int64, password string) error
- func (c *Client) UpdateUserPermissions(id int64, isAdmin bool) error
- func (c *Client) User(id int64) (user User, err error)
- func (c *Client) UserByEmail(email string) (user User, err error)
- func (c *Client) UserUpdate(u User) error
- func (c *Client) Users() (users []UserSearch, err error)
- type CloudAPIKey
- type CloudPluginInstallation
- type CloudRegion
- type CloudRegionsResponse
- type Config
- type CreateAPIKeyRequest
- type CreateAPIKeyResponse
- type CreateCloudAPIKeyInput
- type CreateStackInput
- type Dashboard
- type DashboardMeta
- type DashboardPermission
- type DashboardSaveResponse
- type DataSource
- type DatasourcePermission
- type DatasourcePermissionAddPayload
- type DatasourcePermissionType
- type DatasourcePermissionsResponse
- type DeleteAPIKeyResponse
- type Folder
- type FolderDashboardSearchResponse
- type FolderPayload
- type FolderPermission
- type GetAPIKeysResponse
- type GraphiteAnnotation
- type JSONData
- type LibraryPanel
- type LibraryPanelConnection
- type LibraryPanelCreateResponse
- type LibraryPanelDeleteResponse
- type LibraryPanelGetAllResponse
- type LibraryPanelMeta
- type LibraryPanelMetaUser
- type ListCloudAPIKeysOutput
- type LokiDerivedField
- type Org
- type OrgUser
- type PauseAlertRequest
- type PauseAlertResponse
- type PauseAllAlertsResponse
- type Permission
- type PermissionItem
- type PermissionItems
- type Playlist
- type PlaylistItem
- type Plugin
- type Preferences
- type Report
- type ReportOptions
- type ReportSchedule
- type ReportTimeRange
- type Role
- type SearchTeam
- type SecureJSONData
- type Snapshot
- type SnapshotCreateResponse
- type Stack
- type StackItems
- type Team
- type TeamGroup
- type TeamMember
- type UpdateStackInput
- type User
- type UserSearch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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.
type Annotation ¶
type Annotation struct { ID int64 `json:"id,omitempty"` AlertID int64 `json:"alertId,omitempty"` DashboardID int64 `json:"dashboardId"` 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 Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Grafana API client.
func (*Client) AddDatasourcePermission ¶
func (c *Client) AddDatasourcePermission(id int64, item *DatasourcePermissionAddPayload) error
AddDatasourcePermission adds the given permission item
func (*Client) AddOrgUser ¶
AddOrgUser adds a user to an org with the specified role.
func (*Client) AddTeam ¶
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 ¶
AddTeamMember adds a user to the Grafana team whose ID it's passed.
func (*Client) AlertNotification ¶
func (c *Client) AlertNotification(id int64) (*AlertNotification, error)
AlertNotification fetches and returns a Grafana alert notification.
func (*Client) AlertNotifications ¶
func (c *Client) AlertNotifications() ([]AlertNotification, error)
AlertNotifications fetches and returns Grafana alert notifications.
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) 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) 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) CreateTemporaryStackGrafanaClient ¶ added in v0.4.5
func (c *Client) CreateTemporaryStackGrafanaClient(stackSlug, tempKeyPrefix 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 API keys on the Grafana API. The only thing we can do is to create a temporary Admin key, and create a Grafana API client with that.
func (*Client) CreateUser ¶
CreateUser creates a Grafana user.
func (*Client) Dashboard ¶
Dashboard will be removed. Deprecated: Starting from Grafana v5.0. Use DashboardByUID instead.
func (*Client) DashboardByUID ¶
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) 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) 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) 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 ¶
DeleteAlertNotification deletes a Grafana alert notification.
func (*Client) DeleteAnnotation ¶
DeleteAnnotation deletes the annotation of the ID it is passed
func (*Client) DeleteAnnotationByRegionID ¶
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 (*Client) DeleteDashboard ¶
DeleteDashboard will be removed. Deprecated: Starting from Grafana v5.0. Use DeleteDashboardByUID instead.
func (*Client) DeleteDashboardByUID ¶
DeleteDashboardByUID deletes a dashboard by UID.
func (*Client) DeleteDataSource ¶
DeleteDataSource deletes the Grafana data source whose ID it's passed.
func (*Client) DeleteFolder ¶
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) DeletePlaylist ¶
DeletePlaylist deletes the Grafana playlist whose ID it's passed.
func (*Client) DeleteReport ¶ added in v0.2.2
DeleteReport deletes the Grafana report whose ID it's passed.
func (*Client) DeleteRole ¶
DeleteRole deletes the role with it's permissions. Available only in Grafana Enterprise 8.+.
func (*Client) DeleteStack ¶ added in v0.2.6
DeleteStack deletes the Grafana stack whose slug it passed in.
func (*Client) DeleteTeam ¶
DeleteTeam deletes the Grafana team whose ID it's passed.
func (*Client) DeleteTeamGroup ¶
DeleteTeam deletes the Grafana team whose ID it's passed.
func (*Client) DeleteUser ¶
DeleteUser deletes a Grafana user.
func (*Client) DisableDatasourcePermissions ¶
DisableDatasourcePermissions disables the datasource permissions (this is a datasource setting)
func (*Client) EnableDatasourcePermissions ¶
EnableDatasourcePermissions enables the datasource permissions (this is a datasource setting)
func (*Client) FolderByUID ¶ added in v0.2.2
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) GetAPIKeys ¶
func (c *Client) GetAPIKeys(includeExpired bool) ([]*GetAPIKeysResponse, error)
GetAPIKeys retrieves a list of all API keys.
func (*Client) GetBuiltInRoleAssignments ¶
GetBuiltInRoleAssignments gets all built-in role assignments. Available only in Grafana Enterprise 8.+.
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 ¶
GetRole gets a role with permissions for the given UID. Available only in Grafana Enterprise 8.+.
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
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) NewAlertNotification ¶
func (c *Client) NewAlertNotification(a *AlertNotification) (int64, error)
NewAlertNotification creates a new Grafana alert notification.
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) 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) 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) NewPlaylist ¶
NewPlaylist creates a new Grafana playlist.
func (*Client) NewRole ¶
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 ¶
NewTeamGroup creates a new Grafana Team Group .
func (*Client) OrgUsersCurrent ¶
OrgUsersCurrent returns all org users within the current organization. This endpoint is accessible to users with org admin role.
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) PluginByID ¶ added in v0.4.6
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
PluginBySlug returns the plugin with the given slug. An error will be returned given an unknown slug.
func (*Client) RemoveDatasourcePermission ¶
RemoveDatasourcePermission removes the permission with the given id
func (*Client) RemoveMemberFromTeam ¶
RemoveMemberFromTeam removes a user from the Grafana team whose ID it's passed.
func (*Client) RemoveOrgUser ¶
RemoveOrgUser removes a user from an org.
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) StackByID ¶ added in v0.2.6
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
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) TeamGroups ¶
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
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.
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) UpdateDashboardPermissions ¶
func (c *Client) UpdateDashboardPermissions(id int64, items *PermissionItems) error
UpdateDashboardPermissions 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) UpdateFolder ¶
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) UpdateOrgUser ¶
UpdateOrgUser updates and org user.
func (*Client) UpdatePlaylist ¶
UpdatePlaylist updates a Grafana playlist.
func (*Client) UpdateReport ¶ added in v0.2.2
UpdateReport updates a Grafana report.
func (*Client) UpdateRole ¶
UpdateRole updates the role and permissions. Available only in Grafana Enterprise 8.+.
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 ¶
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 ¶
UpdateUserPassword updates a user password.
func (*Client) UpdateUserPermissions ¶
UpdateUserPermissions sets a user's admin status.
func (*Client) UserByEmail ¶
UserByEmail fetches a user by email address.
func (*Client) UserUpdate ¶
UserUpdate updates a user by ID.
func (*Client) Users ¶
func (c *Client) Users() (users []UserSearch, err error)
Users fetches and returns Grafana users.
type CloudAPIKey ¶ added in v0.4.4
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. 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, ignored when using APIKey, BasicAuth defaults to last used org OrgID int64 // NumRetries contains the number of attempted retries NumRetries int }
Config contains client configuration.
type CreateAPIKeyRequest ¶
type CreateAPIKeyResponse ¶
type CreateCloudAPIKeyInput ¶ added in v0.4.4
type CreateStackInput ¶ added in v0.2.6
type Dashboard ¶
type Dashboard struct { Meta DashboardMeta `json:"meta"` Model map[string]interface{} `json:"dashboard"` Folder int64 `json:"folderId"` Overwrite bool `json:"overwrite"` // This is only used when creating a new dashboard, it will always be empty when getting a dashboard. Message string `json:"message"` }
Dashboard represents a Grafana dashboard.
type DashboardMeta ¶
type DashboardMeta struct { IsStarred bool `json:"isStarred"` Slug string `json:"slug"` Folder int64 `json:"folderId"` 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 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"` 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"` // Deprecated: Use secureJsonData.password instead. Password string `json:"password,omitempty"` OrgID int64 `json:"orgId,omitempty"` IsDefault bool `json:"isDefault"` BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser,omitempty"` // Deprecated: Use secureJsonData.basicAuthPassword instead. BasicAuthPassword string `json:"basicAuthPassword,omitempty"` // Helper to read/write http headers HTTPHeaders map[string]string `json:"-"` JSONData JSONData `json:"jsonData,omitempty"` SecureJSONData SecureJSONData `json:"secureJsonData,omitempty"` }
DataSource represents a Grafana data source.
func (*DataSource) MarshalJSON ¶ added in v0.1.4
func (ds *DataSource) MarshalJSON() ([]byte, error)
Marshal DataSource
func (*DataSource) UnmarshalJSON ¶ added in v0.1.4
func (ds *DataSource) UnmarshalJSON(b []byte) (err error)
Unmarshal DataSource
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"` // Permission levels are // 1 = Query 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"` Permission DatasourcePermissionType `json:"permission"` }
type DatasourcePermissionType ¶
type DatasourcePermissionType int
const (
DatasourcePermissionQuery DatasourcePermissionType
)
type DatasourcePermissionsResponse ¶
type DatasourcePermissionsResponse struct { DatasourceID int64 `json:"datasourceId"` Enabled bool `json:"enabled"` Permissions []*DatasourcePermission `json:"permissions"` }
type DeleteAPIKeyResponse ¶
type DeleteAPIKeyResponse struct {
Message string `json:"message"`
}
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 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 GetAPIKeysResponse ¶
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 JSONData ¶
type JSONData struct { // Used by all datasources TLSAuth bool `json:"tlsAuth,omitempty"` TLSAuthWithCACert bool `json:"tlsAuthWithCACert,omitempty"` TLSConfigurationMethod string `json:"tlsConfigurationMethod,omitempty"` TLSSkipVerify bool `json:"tlsSkipVerify,omitempty"` // Used by Athena Catalog string `json:"catalog,omitempty"` Database string `json:"database,omitempty"` OutputLocation string `json:"outputLocation,omitempty"` Workgroup string `json:"workgroup,omitempty"` // Used by Github GitHubURL string `json:"githubUrl,omitempty"` // Used by Graphite GraphiteVersion string `json:"graphiteVersion,omitempty"` // Used by Prometheus, Elasticsearch, InfluxDB, MySQL, PostgreSQL and MSSQL TimeInterval string `json:"timeInterval,omitempty"` // Used by Elasticsearch // From Grafana 8.x esVersion is the semantic version of Elasticsearch. EsVersion string `json:"esVersion,omitempty"` TimeField string `json:"timeField,omitempty"` Interval string `json:"interval,omitempty"` LogMessageField string `json:"logMessageField,omitempty"` LogLevelField string `json:"logLevelField,omitempty"` MaxConcurrentShardRequests int64 `json:"maxConcurrentShardRequests,omitempty"` // Used by Cloudwatch CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"` TracingDatasourceUID string `json:"tracingDatasourceUid,omitempty"` // Used by Cloudwatch, Athena AuthType string `json:"authType,omitempty"` AssumeRoleArn string `json:"assumeRoleArn,omitempty"` DefaultRegion string `json:"defaultRegion,omitempty"` Endpoint string `json:"endpoint,omitempty"` ExternalID string `json:"externalId,omitempty"` Profile string `json:"profile,omitempty"` // Used by Loki DerivedFields []LokiDerivedField `json:"derivedFields,omitempty"` MaxLines int `json:"maxLines,omitempty"` // Used by OpenTSDB TsdbVersion int64 `json:"tsdbVersion,omitempty"` TsdbResolution int64 `json:"tsdbResolution,omitempty"` // Used by MSSQL Encrypt string `json:"encrypt,omitempty"` // Used by PostgreSQL Sslmode string `json:"sslmode,omitempty"` PostgresVersion int64 `json:"postgresVersion,omitempty"` Timescaledb bool `json:"timescaledb,omitempty"` // Used by MySQL, PostgreSQL and MSSQL MaxOpenConns int64 `json:"maxOpenConns,omitempty"` MaxIdleConns int64 `json:"maxIdleConns,omitempty"` ConnMaxLifetime int64 `json:"connMaxLifetime,omitempty"` // Used by Prometheus HTTPMethod string `json:"httpMethod,omitempty"` QueryTimeout string `json:"queryTimeout,omitempty"` // Used by Stackdriver AuthenticationType string `json:"authenticationType,omitempty"` ClientEmail string `json:"clientEmail,omitempty"` DefaultProject string `json:"defaultProject,omitempty"` TokenURI string `json:"tokenUri,omitempty"` // Used by Prometheus and Elasticsearch SigV4AssumeRoleArn string `json:"sigV4AssumeRoleArn,omitempty"` SigV4Auth bool `json:"sigV4Auth,omitempty"` SigV4AuthType string `json:"sigV4AuthType,omitempty"` SigV4ExternalID string `json:"sigV4ExternalID,omitempty"` SigV4Profile string `json:"sigV4Profile,omitempty"` SigV4Region string `json:"sigV4Region,omitempty"` // Used by Prometheus and Loki ManageAlerts bool `json:"manageAlerts,omitempty"` AlertmanagerUID string `json:"alertmanagerUid,omitempty"` // Used by Alertmanager Implementation string `json:"implementation,omitempty"` // Used by Sentry OrgSlug string `json:"orgSlug,omitempty"` URL string `json:"url,omitempty"` // Sentry is not using the datasource URL attribute // Used by InfluxDB DefaultBucket string `json:"defaultBucket,omitempty"` Organization string `json:"organization,omitempty"` Version string `json:"version,omitempty"` // Used by Azure Monitor AzureLogAnalyticsSameAs bool `json:"azureLogAnalyticsSameAs,omitempty"` ClientID string `json:"clientId,omitempty"` CloudName string `json:"cloudName,omitempty"` LogAnalyticsClientID string `json:"logAnalyticsClientId,omitempty"` LogAnalyticsDefaultWorkspace string `json:"logAnalyticsDefaultWorkspace,omitempty"` LogAnalyticsTenantID string `json:"logAnalyticsTenantId,omitempty"` SubscriptionID string `json:"subscriptionId,omitempty"` TenantID string `json:"tenantId,omitempty"` // contains filtered or unexported fields }
JSONData is a representation of the datasource `jsonData` property
func (JSONData) MarshalJSON ¶ added in v0.1.4
Marshal JSONData
func (*JSONData) UnmarshalJSON ¶ added in v0.1.4
Unmarshal JSONData
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 LokiDerivedField ¶ added in v0.4.0
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 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"` Name string `json:"name"` Interval string `json:"interval"` Items []PlaylistItem `json:"items"` }
Playlist represents a Grafana playlist.
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 Preferences ¶
type Preferences struct { Theme string `json:"theme"` HomeDashboardID int64 `json:"homeDashboardID"` Timezone string `json:"timezone"` }
Preferences represents Grafana preferences.
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"` DashboardID int64 `json:"dashboardId"` DashboardUID string `json:"dashboardUid"` 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"` }
Report represents a Grafana report.
type ReportOptions ¶ added in v0.2.2
type ReportOptions struct { Orientation string `json:"orientation"` Layout string `json:"layout"` TimeRange ReportTimeRange `json:"timeRange"` }
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"` }
ReportSchedule represents the schedule from a Grafana report.
type ReportTimeRange ¶ added in v0.2.2
ReportTimeRange represents the time range from a Grafana report.
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:"string"` Hidden bool `json:"hidden"` Permissions []Permission `json:"permissions,omitempty"` }
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 SecureJSONData ¶
type SecureJSONData struct { // Used by all datasources TLSCACert string `json:"tlsCACert,omitempty"` TLSClientCert string `json:"tlsClientCert,omitempty"` TLSClientKey string `json:"tlsClientKey,omitempty"` Password string `json:"password,omitempty"` BasicAuthPassword string `json:"basicAuthPassword,omitempty"` // Used by Cloudwatch, Athena AccessKey string `json:"accessKey,omitempty"` SecretKey string `json:"secretKey,omitempty"` // Used by Stackdriver PrivateKey string `json:"privateKey,omitempty"` // Used by Prometheus and Elasticsearch SigV4AccessKey string `json:"sigV4AccessKey,omitempty"` SigV4SecretKey string `json:"sigV4SecretKey,omitempty"` // Used by GitHub AccessToken string `json:"accessToken,omitempty"` // Used by Sentry AuthToken string `json:"authToken,omitempty"` // Used by Azure Monitor ClientSecret string `json:"clientSecret,omitempty"` // contains filtered or unexported fields }
SecureJSONData is a representation of the datasource `secureJsonData` property
func (SecureJSONData) MarshalJSON ¶ added in v0.1.4
func (sjd SecureJSONData) MarshalJSON() ([]byte, error)
Marshal SecureJSONData
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 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 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"` }
TeamMember represents a Grafana team member.
type UpdateStackInput ¶ added in v0.2.6
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.
Source Files ¶
- admin.go
- alert.go
- alertnotification.go
- annotation.go
- api_key.go
- builtin_role_assignments.go
- client.go
- cloud_api_key.go
- cloud_grafana_api_key.go
- cloud_plugin.go
- cloud_regions.go
- cloud_stack.go
- dashboard.go
- dashboard_permissions.go
- datasource.go
- datasource_permissions.go
- folder.go
- folder_dashboard_search.go
- folder_permissions.go
- library_panel.go
- mock.go
- org_users.go
- orgs.go
- playlist.go
- report.go
- role.go
- snapshot.go
- team.go
- team_external_group.go
- user.go