smapi

package module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: Apache-2.0 Imports: 8 Imported by: 7

README

Synthetic Monitoring API Go client

This is a Go client for the API used by Grafana's Synthetic Monitoring application.

For instructions about setting up Synthetic Monitoring in your Grafana Cloud instace, please visit the corresponding page. You will need to generate a new API key to initialize the app. You can run your own private probes.

API documentation

Please consult the [docs/API.md](documentation for the API) that this library accesses.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckDeleteResponse

type CheckDeleteResponse struct {
	Msg     string `json:"msg"`
	CheckID int    `json:"checkId"`
}

type HostedInstance

type HostedInstance struct {
	ID   int    `json:"id"`
	Type string `json:"type"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

type HttpError

type HttpError struct {
	Code   int
	Status string
	Action string
}

func (*HttpError) Error

func (e *HttpError) Error() string

type InitResponse

type InitResponse struct {
	AccessToken string             `json:"accessToken"`
	TenantInfo  *TenantDescription `json:"tenantInfo,omitempty"`
	Instances   []HostedInstance   `json:"instances"`
}

type ProbeAddResponse

type ProbeAddResponse struct {
	Probe synthetic_monitoring.Probe `json:"probe"`
	Token []byte                     `json:"token"`
}

type ProbeDeleteResponse

type ProbeDeleteResponse struct {
	Msg     string `json:"msg"`
	ProbeID int    `json:"probeId"`
}

type SmApi

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

func NewClient

func NewClient(baseURL, accessToken string, client *http.Client) *SmApi

func (*SmApi) AddCheck

func (*SmApi) AddProbe

func (*SmApi) DeleteCheck

func (h *SmApi) DeleteCheck(ctx context.Context, id int64) error

func (*SmApi) DeleteProbe

func (h *SmApi) DeleteProbe(ctx context.Context, id int64) error

func (*SmApi) Init

func (h *SmApi) Init(ctx context.Context, adminToken string) (*InitResponse, error)

func (*SmApi) Save

func (h *SmApi) Save(ctx context.Context, adminToken string, metricInstanceID, logInstanceID int) error

type TenantDescription

type TenantDescription struct {
	ID             int64          `json:"id"`
	MetricInstance HostedInstance `json:"metricInstance"`
	LogInstance    HostedInstance `json:"logInstance"`
}

Jump to

Keyboard shortcuts

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