Documentation ¶
Index ¶
- Constants
- Variables
- type Address
- type Client
- func (c *Client) CreateDashboard(db DashboardRequest) (DashboardResponse, error)
- func (c *Client) CreateDatasource(ds Datasource) (Datasource, error)
- func (c *Client) CreateFolder(folder Folder) (Folder, error)
- func (c *Client) CreateTeam(team Team) (int, error)
- func (c *Client) DeleteDashboard(uid string) (string, error)
- func (c *Client) DeleteDatasource(ds Datasource) error
- func (c *Client) DeleteFolder(folder Folder) error
- func (c *Client) DeleteTeam(team Team) error
- func (c *Client) GetDashboard(uid string) (DashboardExport, error)
- func (c *Client) GetDatasource(id string) (Datasource, error)
- func (c *Client) GetFolder(uid string) (Folder, error)
- func (c *Client) GetTeam(teamID string) (Team, error)
- func (c *Client) GetUser(ID string) (User, error)
- func (c *Client) ListDashboards() ([]Dashboard, error)
- func (c *Client) ListDatasources() ([]Datasource, error)
- func (c *Client) ListFolders() ([]Folder, error)
- func (c *Client) ListOrgs() ([]Org, error)
- func (c *Client) ListUsers(opt *ListUserOptions) ([]User, error)
- func (c *Client) SearchTeams(opt *SearchTeamsOptions) (TeamPage, error)
- func (c *Client) SetVerbose(verbose bool)
- type Dashboard
- type DashboardExport
- type DashboardMetadata
- type DashboardRequest
- type DashboardResponse
- type Datasource
- type Error
- type Folder
- type ListUserOptions
- type Org
- type SearchTeamsOptions
- type Team
- type TeamPage
- type User
Constants ¶
const ( // AuthorizationHeader value AuthorizationHeader = "Authorization" //AuthorizationTypeBasic value AuthorizationTypeBasic = "Basic " // UsersEndpoint is the API endoint for users. UsersEndpoint = "/api/users" // OrgsUsersEndpoint is the API endoint for organizations. OrgsUsersEndpoint = "/api/org/users" // OrgsEndpoint is the API endoint for organizations. OrgsEndpoint = "/api/org" // DatasourcesEndpoint is the API endoint for datasources. DatasourcesEndpoint = "/api/datasources" // TeamsSearchEndpoint is the API endpoint for searching Teams TeamsSearchEndpoint = "/api/teams/search" // TeamsEndpoint is the API endpoint for searching Teams TeamsEndpoint = "/api/teams" //SearchEndpoint is the API endpoint for searching SearchEndpoint = "/api/search" //DashboardsImportEndpoint is the API endpoint for create/update of dashboards DashboardsImportEndpoint = "/api/dashboards/import" //DashboardsUIDEndpoint is the API endpoint for create/update of dashboards DashboardsUIDEndpoint = "/api/dashboards/uid" //FoldersEndpoint is the API endpoint for folders FoldersEndpoint = "/api/folders" )
Variables ¶
var ( //ErrForbidden error ErrForbidden = newError(403, "Access refused or not allowed") //ErrNotFound error ErrNotFound = newError(404, "Resource not found") //ErrConflict error ErrConflict = newError(409, "Conflict") //ErrTooManyRequests error ErrTooManyRequests = newError(429, "You have exceeded the API call rate limit") //ErrNotImplemented error ErrNotImplemented = newError(501, "Not implemented") //ErrBadGateway error ErrBadGateway = newError(502, "Bad gateway") ErrServiceUnavailable = newError(503, "Service unavailable") //ErrGatewayTimeout error ErrGatewayTimeout = newError(504, "Gateway timeout") )ErrUnauthorized = newError(401, "Not authenticated")
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { Address1 string `json:"address1,omitempty"` Address2 string `json:"address2,omitempty"` City string `json:"city,omitempty"` ZipCode string `json:"zipCode,omitempty"` State string `json:"state,omitempty"` Country string `json:"country,omitempty"` }
Address defines the data struct for an Address object
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for http requests
func (*Client) CreateDashboard ¶ added in v0.0.2
func (c *Client) CreateDashboard(db DashboardRequest) (DashboardResponse, error)
CreateDashboard creates a dashboard.
func (*Client) CreateDatasource ¶
func (c *Client) CreateDatasource(ds Datasource) (Datasource, error)
CreateDatasource creates a datasource
func (*Client) CreateFolder ¶ added in v0.0.3
CreateFolder creates a single folder
func (*Client) CreateTeam ¶ added in v0.0.3
CreateTeam creates a team
func (*Client) DeleteDashboard ¶ added in v0.0.3
DeleteDashboard deletes a dashboard by uid
func (*Client) DeleteDatasource ¶
func (c *Client) DeleteDatasource(ds Datasource) error
DeleteDatasource deletes a datasource
func (*Client) DeleteFolder ¶ added in v0.0.3
DeleteFolder deletes a single folder
func (*Client) DeleteTeam ¶ added in v0.0.3
DeleteTeam deletes a team
func (*Client) GetDashboard ¶ added in v0.0.2
func (c *Client) GetDashboard(uid string) (DashboardExport, error)
GetDashboard returns a byte array representation of the dashboard
func (*Client) GetDatasource ¶
func (c *Client) GetDatasource(id string) (Datasource, error)
GetDatasource returns a datasource by ID
func (*Client) ListDashboards ¶ added in v0.0.2
ListDashboards returns a list of dashboards.
func (*Client) ListDatasources ¶
func (c *Client) ListDatasources() ([]Datasource, error)
ListDatasources returns a list of datasources
func (*Client) ListFolders ¶ added in v0.0.3
ListFolders returns a list of folders.
func (*Client) ListUsers ¶
func (c *Client) ListUsers(opt *ListUserOptions) ([]User, error)
ListUsers returns a list of users.
func (*Client) SearchTeams ¶
func (c *Client) SearchTeams(opt *SearchTeamsOptions) (TeamPage, error)
SearchTeams returns a list of teams
func (*Client) SetVerbose ¶
SetVerbose enables verbous logging of requests and responses
type Dashboard ¶ added in v0.0.2
type Dashboard struct { ID int `json:"id,omitempty"` UID string `json:"uid,omitempty"` Title string `json:"title,omitempty"` URI string `json:"uri,omitempty"` URL string `json:"url,omitempty"` Type string `json:"type,omitempty"` Tags []string `json:"tags,omitempty"` IsStarred bool `json:"isStarred,omitempty"` }
Dashboard defines the data struct for a Dashboard search result
type DashboardExport ¶ added in v0.0.2
type DashboardExport struct { Meta DashboardMetadata `json:"meta,omitempty"` Dashboard interface{} `json:"dashboard,omitempty"` }
DashboardExport struct
type DashboardMetadata ¶ added in v0.0.2
type DashboardMetadata struct { Type string `json:"type,omitempty"` CanSave bool `json:"canSave,omitempty"` CanEdit bool `json:"canEdit,omitempty"` CanAdmin bool `json:"canAdmin,omitempty"` CanStar bool `json:"canStar,omitempty"` Slug string `json:"slug,omitempty"` URL string `json:"url,omitempty"` UpdatedBy string `json:"updatedBy,omitempty"` CreatedBy string `json:"createdBy,omitempty"` Version int `json:"version,omitempty"` HasACL bool `json:"hasAcl,omitempty"` FolderID int `json:"folderId,omitempty"` FolderTitle string `json:"folderTitle,omitempty"` }
DashboardMetadata defines data struct for the metadata when exporting a dashboard
type DashboardRequest ¶ added in v0.0.2
type DashboardRequest struct { Dashboard interface{} `json:"dashboard,omitempty"` Overwrite *bool `json:"overwrite,omitempty"` FolderID int `json:"folderId,omitempty"` Message string `json:"message,omitempty"` }
DashboardRequest defines the data struct for create/update of a Dashbord
type DashboardResponse ¶ added in v0.0.2
type DashboardResponse struct { PluginID string `json:"pluginId,omitempty"` Title string `json:"title,omitempty"` Imported bool `json:"imported,omitempty"` ImportedURI string `json:"importedUri,omitempty"` ImportedURL string `json:"importedUrl,omitempty"` Slug string `json:"slug,omitempty"` DashboardID int `json:"dashboardId,omitempty"` ImportedRevision int `json:"importedRevision,omitempty"` Revision int `json:"revision,omitempty"` Description string `json:"description,omitempty"` Path string `json:"path,omitempty"` Removed bool `json:"removed,omitempty"` }
DashboardResponse defines the data struct for a response after successful Dashboard create
type Datasource ¶
type Datasource struct { ID int `json:"id,omitempty"` OrgID int `json:"orgId,omitempty"` Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` TypeLogoURL string `json:"typeLogoUrl,omitempty"` Access string `json:"access,omitempty"` URL string `json:"url,omitempty"` Password string `json:"password,omitempty"` User string `json:"user,omitempty"` Database string `json:"database,omitempty"` BasicAuth bool `json:"basicAuth,omitempty"` IsDefault bool `json:"isDefault,omitempty"` IsDeReadOnlyfault bool `json:"readOnly,omitempty"` }
Datasource defines the data struct for an Datasource object
type Folder ¶ added in v0.0.3
type Folder struct { ID int `json:"id,omitempty"` UID string `json:"uid,omitempty"` Title string `json:"title,omitempty"` URL string `json:"url,omitempty"` HasACL bool `json:"hasAcl,omitempty"` CanSave bool `json:"canSave,omitempty"` CanEdit bool `json:"canEdit,omitempty"` CanAdmin bool `json:"canAdmin,omitempty"` CreatedBy string `json:"createdBy,omitempty"` UpdatedBy string `json:"updatedBy,omitempty"` Version int `json:"version,omitempty"` }
Folder defines data struct for folders.
type ListUserOptions ¶
type ListUserOptions struct {
CurrentOrg bool
}
ListUserOptions options for querying users
type Org ¶
type Org struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Address Address `json:"address,omitempty"` }
Org defines the data struct for an Organization object
type SearchTeamsOptions ¶
type SearchTeamsOptions struct {
Query string
}
SearchTeamsOptions options for querying teams
type Team ¶
type Team struct { ID int `json:"id,omitempty"` OrgID int `json:"orgId,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` AvatarURL string `json:"avatarUrl,omitempty"` MemberCount int `json:"memberCount,omitempty"` }
Team defines the data struct for a Team
type TeamPage ¶
type TeamPage struct { TotalCount int `json:"totalCount,omitempty"` Teams []Team `json:"teams,omitempty"` Page int `json:"page,omitempty"` PerPage int `json:"perPage,omitempty"` }
TeamPage defines a search page for Teams
type User ¶
type User struct { ID int `json:"id,omitempty"` UserID int `json:"userId,omitempty"` OrgID int `json:"orgId,omitempty"` Name string `json:"name,omitempty"` Login string `json:"login,omitempty"` Email string `json:"email,omitempty"` AvatarURL string `json:"avatarUrl,omitempty"` IsAdmin bool `json:"isAdmin,omitempty"` LastSeenAge string `json:"lastSeenAtAge,omitempty"` }
User defines the data struct for a User object