grafana

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a REST client interacting with the Grafana API.

This class is limited in scope that only deals with APIs useful for `grafsnap`.

func NewClient

func NewClient(config *Config, client *http.Client) (*Client, error)

NewClient constructs a new Grafana client.

func (*Client) ImportSnapshot

func (cli *Client) ImportSnapshot(ctx context.Context, name string, body io.Reader) (string, error)

ImportSnapshot imports the snapshot back into Grafana. Returns the URL to access the snapshot.

func (*Client) ImportSnapshotsFromFiles

func (cli *Client) ImportSnapshotsFromFiles(ctx context.Context, files []string) ([]ImportSnapshotResult, error)

ImportSnapshotsFromFiles imports multiple snapshot files in parallel into Grafana. The files can be plain JSON files backed up from the local snapshot, or a zip file containing these JSON snapshots.

func (*Client) ListDashboards

func (cli *Client) ListDashboards(ctx context.Context) ([]ListDashboardResult, error)

ListDashboards lists all dashboards.

type Config

type Config struct {
	Key         string
	Base        string
	Concurrency int
}

Config configures the Grafana client.

type ImportSnapshotResult

type ImportSnapshotResult struct {
	File    string                 `json:"file"`
	URL     string                 `json:"url,omitempty"`
	Content []ImportSnapshotResult `json:"content,omitempty"`
}

ImportSnapshotResult is the result of importing a file into Grafana.

type ListDashboardResult

type ListDashboardResult struct {
	// Title is the human-readable title of the dashboard.
	Title string `json:"title"`
	// UID is the unique identifier of the dashboard.
	UID string `json:"uid"`
	// URL is the URL to the dashboard.
	URL string `json:"url"`
}

ListDashboardResult is the result of listing dashboards from Grafana.

Jump to

Keyboard shortcuts

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