Versions in this module Expand all Collapse all v1 v1.0.1 May 5, 2024 Changes in this version + var ErrAPIKeyNotFound = errors.New("API key not found") + var ErrAlertNotFound = errors.New("alert not found") + var ErrDashboardNotFound = errors.New("dashboard not found") + var ErrDatasourceNotFound = errors.New("datasource not found") + var ErrFolderNotFound = errors.New("folder not found") + type APIKey struct + ID uint + Name string + type APIKeyRole uint8 + const AdminRole + const EditorRole + const ViewerRole + func (role APIKeyRole) MarshalJSON() ([]byte, error) + type Client struct + func NewClient(http *http.Client, host string, options ...Option) *Client + func (client *Client) APIKeys(ctx context.Context) (map[string]APIKey, error) + func (client *Client) AddAlert(ctx context.Context, namespace string, alertDefinition alert.Alert, ...) error + func (client *Client) ConfigureAlertManager(ctx context.Context, manager *alertmanager.Manager) error + func (client *Client) CreateAPIKey(ctx context.Context, request CreateAPIKeyRequest) (string, error) + func (client *Client) CreateFolder(ctx context.Context, name string) (*Folder, error) + func (client *Client) DeleteAPIKeyByName(ctx context.Context, name string) error + func (client *Client) DeleteAlertGroup(ctx context.Context, namespace string, groupName string) error + func (client *Client) DeleteDashboard(ctx context.Context, uid string) error + func (client *Client) DeleteDatasource(ctx context.Context, name string) error + func (client *Client) FindOrCreateFolder(ctx context.Context, name string) (*Folder, error) + func (client *Client) GetDashboardByTitle(ctx context.Context, title string) (*Dashboard, error) + func (client *Client) GetDatasourceUIDByName(ctx context.Context, name string) (string, error) + func (client *Client) GetFolderByTitle(ctx context.Context, title string) (*Folder, error) + func (client *Client) UpsertDashboard(ctx context.Context, folder *Folder, builder dashboard.Builder) (*Dashboard, error) + func (client *Client) UpsertDatasource(ctx context.Context, datasource datasource.Datasource) error + type CreateAPIKeyRequest struct + Name string + Role APIKeyRole + SecondsToLive int + type Dashboard struct + FolderID int + FolderTitle string + FolderUID string + FolderURL string + ID int + IsStarred bool + Tags []string + Title string + UID string + URL string + type Folder struct + ID uint + Title string + UID string + type Option func(client *Client) + func WithAPIToken(token string) Option + func WithBasicAuth(username string, password string) Option