Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ReqReportPgBouncer ¶ added in v1.7.0
type ReqReportPgBouncer struct { APIKey string `json:"apikey"` Server string `json:"server"` PgBouncer string `json:"pgbouncer"` Data pgmetrics.Model `json:"data"` }
ReqReportPgBouncer is the request structure for RestV1.ReportPgBouncer.
type ReqReportPgpool ¶ added in v1.10.3
type ReqReportPgpool struct { APIKey string `json:"apikey"` Pgpool string `json:"pgpool"` Data pgmetrics.Model `json:"data"` }
ReqReportPgpool is the request structure for RestV1.ReportPgpool.
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) ReportPgBouncer ¶ added in v1.7.0
func (c *RestV1Client) ReportPgBouncer(req ReqReportPgBouncer) (resp RespReport, err error)
ReportPgBouncer calls RestV1.ReportPgBouncer
func (*RestV1Client) ReportPgpool ¶ added in v1.10.3
func (c *RestV1Client) ReportPgpool(req ReqReportPgpool) (resp RespReport, err error)
Reportpgpool calls RestV1.ReportPgpool
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.