datasources

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: Apache-2.0 Imports: 8 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 queries Grafana datasources via the NamespacedRESTConfig transport, ensuring OAuth proxy mode and token refresh are respected. It mirrors the approach used by internal/query/prometheus and internal/query/loki.

func NewClient

func NewClient(cfg config.NamespacedRESTConfig) (*Client, error)

NewClient creates a client backed by the given REST config's transport (including WrapTransport / RefreshTransport in OAuth proxy mode).

func (*Client) GetByName

func (c *Client) GetByName(ctx context.Context, name string) (*Datasource, error)

GetByName returns the datasource with the given display name.

func (*Client) GetByUID

func (c *Client) GetByUID(ctx context.Context, uid string) (*Datasource, error)

GetByUID returns the datasource with the given UID.

func (*Client) List

func (c *Client) List(ctx context.Context) ([]*Datasource, error)

List returns all datasources visible to the authenticated user.

type Datasource

type Datasource struct {
	UID             string `json:"uid"`
	Name            string `json:"name"`
	Type            string `json:"type"`
	URL             string `json:"url"`
	IsDefault       bool   `json:"isDefault"`
	ReadOnly        bool   `json:"readOnly"`
	Database        string `json:"database"`
	BasicAuth       bool   `json:"basicAuth"`
	WithCredentials bool   `json:"withCredentials"`
	JSONData        any    `json:"jsonData"`
}

Datasource holds the fields returned by the legacy Grafana datasource REST API.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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