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 {
Quick(ctx context.Context, req ReqQuick) (resp RespQuick, code int)
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) Quick ¶
func (c *RestV1Client) Quick(req ReqQuick) (resp RespQuick, err error)
Quick calls RestV1.Quick
func (*RestV1Client) Report ¶ added in v1.1.0
func (c *RestV1Client) Report(req ReqReport) (resp RespReport, err error)
Report calls RestV1.Report
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.