Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // RxAPIKey is the regexp a valid API key should match. RxAPIKey = regexp.MustCompile("^[A-Za-z0-9]{22}$") // RxServer is the regexp a valid server name should match. RxServer = regexp.MustCompile("^[A-Za-z0-9_.-]{1,64}$") )
Functions ¶
This section is empty.
Types ¶
type ReqReport ¶ added in v1.1.0
type ReqReport struct { APIKey string `json:"apikey"` Server string `json:"server"` Data pgmetrics.Model `json:"data"` }
ReqReport is the request structure for RestV1.Report.
type RespReport ¶ added in v1.1.0
type RespReport struct { }
RespReport is the response structure for RestV1.Report.
type RestV1 ¶
type RestV1 interface {
Report(ctx context.Context, req ReqReport) (resp RespReport, code int)
}
RestV1 is the interface definition of the public REST API, v1.
type RestV1Client ¶
type RestV1Client struct {
// contains filtered or unexported fields
}
RestV1Client is a client for RestV1 servers.
func NewRestV1Client ¶
func NewRestV1Client(base string, timeout time.Duration, retries int) *RestV1Client
NewRestV1Client creates a new client to talk to the specified base URL and with the given timeout.
func (*RestV1Client) Report ¶ added in v1.1.0
func (c *RestV1Client) Report(req ReqReport) (resp RespReport, err error)
Report calls RestV1.Report
func (*RestV1Client) SetDebug ¶ added in v1.3.5
func (c *RestV1Client) SetDebug(b bool)
SetDebug enables/disables debug output.
type RestV1ClientError ¶ added in v1.1.0
type RestV1ClientError struct {
// contains filtered or unexported fields
}
RestV1ClientError represents errors because of non-2xx HTTP response code.
func (*RestV1ClientError) Code ¶ added in v1.1.0
func (e *RestV1ClientError) Code() int
Code returns the HTTP response status code.
func (*RestV1ClientError) Error ¶ added in v1.1.0
func (e *RestV1ClientError) Error() string
Error returns a human-readable error message.
Click to show internal directories.
Click to hide internal directories.