gapi

package module
v0.0.0-...-7380665 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2018 License: Apache-2.0 Imports: 13 Imported by: 1

README

grafana-api-golang-client

Grafana HTTP API Client for Go

Tests

To run the tests:

go test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertNotification

type AlertNotification struct {
	Id        int64       `json:"id,omitempty"`
	Name      string      `json:"name"`
	Type      string      `json:"type"`
	IsDefault bool        `json:"isDefault"`
	Settings  interface{} `json:"settings"`
}

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func New

func New(auth, baseURL string) (*Client, error)

New creates a new grafana client auth can be in user:pass format, or it can be an api key

func (*Client) AlertNotification

func (c *Client) AlertNotification(id int64) (*AlertNotification, error)

func (*Client) CreateUserForm

func (c *Client) CreateUserForm(settings dtos.AdminCreateUserForm) error

func (*Client) Dashboard

func (c *Client) Dashboard(slug string) (*Dashboard, error)

func (*Client) DataSource

func (c *Client) DataSource(id int64) (*DataSource, error)

func (*Client) DeleteAlertNotification

func (c *Client) DeleteAlertNotification(id int64) error

func (*Client) DeleteDashboard

func (c *Client) DeleteDashboard(slug string) error

func (*Client) DeleteDataSource

func (c *Client) DeleteDataSource(id int64) error

func (*Client) DeleteOrg

func (c *Client) DeleteOrg(id int64) error

func (*Client) DeleteUser

func (c *Client) DeleteUser(id int64) error

func (*Client) NewAlertNotification

func (c *Client) NewAlertNotification(a *AlertNotification) (int64, error)

func (*Client) NewDataSource

func (c *Client) NewDataSource(s *DataSource) (int64, error)

func (*Client) NewOrg

func (c *Client) NewOrg(name string) error

func (*Client) Orgs

func (c *Client) Orgs() ([]Org, error)

func (*Client) SaveDashboard

func (c *Client) SaveDashboard(model map[string]interface{}, overwrite bool) (*DashboardSaveResponse, error)

func (*Client) UpdateAlertNotification

func (c *Client) UpdateAlertNotification(a *AlertNotification) error

func (*Client) UpdateDataSource

func (c *Client) UpdateDataSource(s *DataSource) error

func (*Client) Users

func (c *Client) Users() ([]User, error)

type Dashboard

type Dashboard struct {
	Meta  DashboardMeta          `json:"meta"`
	Model map[string]interface{} `json:"dashboard"`
}

type DashboardMeta

type DashboardMeta struct {
	IsStarred bool   `json:"isStarred"`
	Slug      string `json:"slug"`
}

type DashboardSaveResponse

type DashboardSaveResponse struct {
	Slug    string `json:"slug"`
	Status  string `json:"status"`
	Version int64  `json:"version"`
}

type DataSource

type DataSource struct {
	Id     int64  `json:"id,omitempty"`
	Name   string `json:"name"`
	Type   string `json:"type"`
	URL    string `json:"url"`
	Access string `json:"access"`

	Database string `json:"database,omitempty"`
	User     string `json:"user,omitempty"`
	Password string `json:"password,omitempty"`

	OrgId     int64 `json:"orgId,omitempty"`
	IsDefault bool  `json:"isDefault"`

	BasicAuth         bool   `json:"basicAuth"`
	BasicAuthUser     string `json:"basicAuthUser,omitempty"`
	BasicAuthPassword string `json:"basicAuthPassword,omitempty"`

	JSONData       JSONData       `json:"jsonData,omitempty"`
	SecureJSONData SecureJSONData `json:"secureJsonData,omitempty"`
}

type JSONData

type JSONData struct {
	AssumeRoleArn           string `json:"assumeRoleArn,omitempty"`
	AuthType                string `json:"authType,omitempty"`
	CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"`
	DefaultRegion           string `json:"defaultRegion,omitempty"`
}

JSONData is a representation of the datasource `jsonData` property

type Org

type Org struct {
	Id   int64
	Name string
}

type SecureJSONData

type SecureJSONData struct {
	AccessKey string `json:"accessKey,omitempty"`
	SecretKey string `json:"secretKey,omitempty"`
}

SecureJSONData is a representation of the datasource `secureJsonData` property

type User

type User struct {
	Id      int64
	Email   string
	Name    string
	Login   string
	IsAdmin bool
}

Jump to

Keyboard shortcuts

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