Documentation
¶
Overview ¶
Package api provides clients for the HTTP APIs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultRoundTripper http.RoundTripper = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, }).DialContext, TLSHandshakeTimeout: 10 * time.Second, }
DefaultRoundTripper is used if no RoundTripper is set in Config.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
URL(ep string, args map[string]string) *url.URL
Do(context.Context, *http.Request) (*http.Response, []byte, error)
}
Client is the interface for an API client.
type CloseIdler ¶ added in v1.21.0
type CloseIdler interface {
CloseIdleConnections()
}
type Config ¶
type Config struct {
// The address of the Prometheus to connect to.
Address string
// Client is used by the Client to drive HTTP requests. If not provided,
// a new one based on the provided RoundTripper (or DefaultRoundTripper) will be used.
Client *http.Client
// RoundTripper is used by the Client to drive HTTP requests. If not
// provided, DefaultRoundTripper will be used.
RoundTripper http.RoundTripper
}
Config defines configuration parameters for a new client.
Click to show internal directories.
Click to hide internal directories.