Documentation ¶
Overview ¶
Package grafana provides facilities for working with Grafana.
Index ¶
- type AuthServer
- type Client
- func (c *Client) Collect(ch chan<- prom.Metric)
- func (c *Client) CreateAdminAPIKey(ctx context.Context, name string) (int64, string, error)
- func (c *Client) CreateAnnotation(ctx context.Context, tags []string, from time.Time, text, authorization string) (string, error)
- func (c *Client) DeleteAPIKeyByID(ctx context.Context, id int64) error
- func (c *Client) DeleteAPIKeysWithPrefix(ctx context.Context, prefix string) error
- func (c *Client) Describe(ch chan<- *prom.Desc)
- func (c *Client) IsReady(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthServer ¶
type AuthServer struct {
// contains filtered or unexported fields
}
AuthServer authenticates incoming requests via Grafana API.
func NewAuthServer ¶
func NewAuthServer(c clientInterface, checker awsInstanceChecker) *AuthServer
NewAuthServer creates new AuthServer.
func (*AuthServer) Run ¶
func (s *AuthServer) Run(ctx context.Context)
Run runs cache invalidator which removes expired cache items.
func (*AuthServer) ServeHTTP ¶
func (s *AuthServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP serves internal location /auth_request for both authentication subrequests and subsequent normal requests.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client for Grafana API.
func (*Client) CreateAdminAPIKey ¶
CreateAdminAPIKey creates API key with Admin role and provided name.
func (*Client) CreateAnnotation ¶
func (c *Client) CreateAnnotation(ctx context.Context, tags []string, from time.Time, text, authorization string) (string, error)
CreateAnnotation creates annotation with given text and tags ("pmm_annotation" is added automatically) and returns Grafana's response text which is typically "Annotation added" or "Failed to save annotation".
func (*Client) DeleteAPIKeyByID ¶
DeleteAPIKeyByID deletes API key by ID.
func (*Client) DeleteAPIKeysWithPrefix ¶
DeleteAPIKeysWithPrefix deletes all API keys with provided prefix. If there is no api key with provided prefix just ignores it.