client

package
v0.0.0-...-07526aa Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRFC3339TimeString

func ParseRFC3339TimeString(ts string) (time.Time, error)

ParseRFC3339TimeString parse string to RFC3339 time

Types

type Annotation

type Annotation struct {
	ID          uint64                 `json:"id"`
	AlertID     uint64                 `json:"alertId"`
	AlertName   string                 `json:"alertName"`
	DashboardID uint64                 `json:"dashboardId"`
	PanelID     uint64                 `json:"panelId"`
	UserID      uint64                 `json:"userId"`
	NewState    string                 `json:"newState"`
	PrevState   string                 `json:"prevState"`
	Created     uint64                 `json:"created"`
	Updated     uint64                 `json:"updated"`
	Time        uint64                 `json:"time"`
	TimeEnd     uint64                 `json:"timeEnd"`
	Text        string                 `json:"text"`
	Tags        []string               `json:"tags"`
	Login       string                 `json:"login"`
	Email       string                 `json:"email"`
	AvatarURL   string                 `json:"avatarUrl"`
	Data        map[string]interface{} `json:"data"`
}

Annotation object

type Client

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

Client HTTP client

func New

func New(base, user, password string) Client

New init client

func (Client) AnnotationCreate

func (c Client) AnnotationCreate(dashboardID, panelID uint64, from, to time.Time, text string, tag ...string) error

AnnotationCreate create an annotation

func (Client) AnnotationDelete

func (c Client) AnnotationDelete(id uint64) error

AnnotationDelete delete an annotation

func (Client) AnnotationList

func (c Client) AnnotationList(dashboardID uint64, from, to time.Time) ([]Annotation, error)

AnnotationList list annotations for a dashboard Limitation - only 100 (default) annotations can be gotten for specified time period

func (Client) DashboardDelete

func (c Client) DashboardDelete(uid string) error

DashboardDelete delete a dashboard

func (Client) DashboardExport

func (c Client) DashboardExport(fpath, uid string) error

DashboardExport export a dashboard

func (Client) DashboardImport

func (c Client) DashboardImport(fpath string, folderid uint64) error

DashboardImport import a dashboard

func (Client) DashboardList

func (c Client) DashboardList() ([]Dashboard, error)

DashboardList list dashboards

func (Client) DashboardPanelList

func (c Client) DashboardPanelList(uid string) ([]Panel, error)

DashboardPanelList list panels of a dashboard

func (Client) DataSourceDelete

func (c Client) DataSourceDelete(name string) error

DataSourceDelete delete a data source

func (Client) DataSourceExport

func (c Client) DataSourceExport(name, fpath string) error

DataSourceExport export a data source

func (Client) DataSourceImport

func (c Client) DataSourceImport(name, fpath string) error

DataSourceImport import a data source

func (Client) DataSourceList

func (c Client) DataSourceList() ([]DataSource, error)

DataSourceList list data sources

func (Client) Delete

func (c Client) Delete(uri string) (*resty.Response, error)

Delete HTTP DELETE

func (Client) FolderCreate

func (c Client) FolderCreate(name string) error

FolderCreate create a folder

func (Client) FolderDelete

func (c Client) FolderDelete(uid string) error

FolderDelete delete a folder

func (Client) FolderList

func (c Client) FolderList() ([]Folder, error)

FolderList list folders

func (Client) Get

func (c Client) Get(uri string, params map[string]string) (*resty.Response, error)

Get HTTP GET

func (Client) Login

func (c Client) Login() error

Login verify login

func (Client) Post

func (c Client) Post(uri string, payload map[string]interface{}) (*resty.Response, error)

Post HTTP POST

func (Client) SnapshotDelete

func (c Client) SnapshotDelete(key string) error

SnapshotDelete delete a snapshot

func (Client) SnapshotExport

func (c Client) SnapshotExport(key, fpath string) error

SnapshotExport export an existing snapshot as a file which can be imported as a dashboard by calling DashboardImport

func (Client) SnapshotList

func (c Client) SnapshotList() ([]Snapshot, error)

SnapshotList list snapshots

type Dashboard

type Dashboard struct {
	ID          uint64   `json:"id"`
	UID         string   `json:"uid"`
	Title       string   `json:"title"`
	URL         string   `json:"url"`
	Type        string   `json:"type"`
	Tags        []string `json:"tags"`
	IsStarred   bool     `json:"isStarred"`
	URI         string   `json:"uri"`
	Slug        string   `json:"slug"`
	FolderID    uint64   `json:"folderId"`
	FolderUID   string   `json:"folderUid"`
	FolderTitle string   `json:"folderTitle"`
	FolderURL   string   `json:"folderUrl"`
}

Dashboard object definition

type DataSource

type DataSource struct {
	ID          uint64                 `json:"id"`
	OrgID       uint64                 `json:"orgId"`
	Name        string                 `json:"name"`
	Type        string                 `json:"type"`
	TypeLogoURL string                 `json:"typeLogoUrl"`
	Access      string                 `json:"access"`
	URL         string                 `json:"url"`
	Password    string                 `json:"password"`
	User        string                 `json:"User"`
	Database    string                 `json:"database"`
	BasicAuth   bool                   `json:"basicAuth"`
	IsDefault   bool                   `json:"isDefault"`
	JSONData    map[string]interface{} `json:"jsonData"`
	ReadOnly    bool                   `json:"readOnly"`
}

DataSource object

type Folder

type Folder struct {
	ID        uint64   `json:"id"`
	UID       string   `json:"uid"`
	Title     string   `json:"title"`
	URI       string   `json:"uri"`
	URL       string   `json:"url"`
	Slug      string   `json:"slug"`
	Type      string   `json:"type"`
	Tags      []string `json:"tags"`
	IsStarred bool     `json:"isStarred"`
}

Folder object

type Panel

type Panel struct {
	ID    uint64 `json:"id"`
	Title string `json:"title"`
}

Panel object definition - only the id and title

type Snapshot

type Snapshot struct {
	ID          int64     `json:"id"`
	Name        string    `json:"name"`
	Key         string    `json:"key"`
	OrgID       int64     `json:"orgId"`
	UserID      int64     `json:"userId"`
	External    bool      `json:"external"`
	ExternalURL string    `json:"externalUrl"`
	Expires     time.Time `json:"expires"`
	Created     time.Time `json:"created"`
	Updated     time.Time `json:"updated"`
}

Snapshot object

Jump to

Keyboard shortcuts

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