Documentation
¶
Index ¶
- func NewClient(c Config) (backend.Client, error)
- func WithAuditID(delegate backend.Client) backend.Client
- func WithGotConnTrace(delegate backend.Client) backend.Client
- func WithResponseBodyReader(delegate backend.Client) backend.Client
- func WithRoundTripLatencyTracking(delegate backend.Client) backend.Client
- func WithShutdownResponseHeaderExtractor(delegate backend.Client, decoder backend.HostNameDecoder) backend.Client
- func WithSource(delegate backend.Client, source string) backend.Client
- func WithTimeout(delegate backend.Client, timeout time.Duration) backend.Client
- func WithUserAgent(delegate backend.Client, agent string) backend.Client
- func WrapClient(client *http.Client, timeout time.Duration, userAgent string, ...) backend.Client
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
NewClient returns a new Client instance constructed from the user specified configuration.
func WithAuditID ¶
WithAuditID generates an audit ID and attaches it to the appropriate request header.
func WithGotConnTrace ¶
WithGotConnTrace attaches a 'GotConn' and 'DNSDone' client trace to the given request.
GotConn: this client trace is called after a successful connection is obtained, using this trace we can infer whether this connection has been previously used for another HTTP request. DNSDone: this client trace is called when a DNS lookup ends, and we can obtain the error that occurred during the DNS lookup, if any.
This function will attach the data obtained from the client trace to the request context so it can be retrieved later.
func WithResponseBodyReader ¶
WithResponseBodyReader makes an attempt to read the body of the response from the server, any error that occurs while reading the body, or while closing the underlying stream will be saved for later access.
func WithRoundTripLatencyTracking ¶
WithRoundTripLatencyTracking will measure the round trip latency incurred and save it to the context so it can be accessed later.
func WithShutdownResponseHeaderExtractor ¶
func WithShutdownResponseHeaderExtractor(delegate backend.Client, decoder backend.HostNameDecoder) backend.Client
WithShutdownResponseHeaderExtractor adds the 'X-Openshift-If-Disruption' request header to the given request in order to opt in to receive the shutdown response header; upon receiving a response from the server it parses the 'X-OpenShift-Disruption' response header and attaches the parsed data to the request context.
format: shutdown=%t shutdown-delay-duration=%s elapsed=%s host=%s
func WithSource ¶
WithSource sets pod name for incluster monitor.
func WithTimeout ¶
WithTimeout will create a context with deadline that is proportional to the given timeout and assign it to the request.
func WithUserAgent ¶
WithUserAgent sets the given 'agent' as the User Agent for this request if the 'User-Agent' request header is not already set.
Types ¶
type Config ¶
type Config struct {
RT http.RoundTripper
ClientTimeout time.Duration
UserAgent string
// EnableShutdownResponseHeader indicates whether to include the shutdown
// response header extractor, this should be true only when the
// request(s) are being sent to the kube-apiserver.
EnableShutdownResponseHeader bool
// HostNameDecoder, if specified, is used to decode the APIServerIdentity
// inside the shutdown response header into the actual human readable hostname.
HostNameDecoder backend.HostNameDecoder
// Source contains pod name if incluster monitor is used
Source string
}
Config holds the user specified parameters to make a new client