http

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConnector = errors.New("connector should not be nil")
)
View Source
var (
	ErrUnexpectedStatusCode = errors.New("the status code obtained was not expected")
)

Functions

This section is empty.

Types

type Client added in v1.4.1

type Client struct {
	// contains filtered or unexported fields
}

Client implements a client for Kubelet, capable of retrieving prometheus metrics from a given endpoint.

func NewClient

func NewClient(connector Connector, opts ...OptionFunc) (*Client, error)

NewClient builds a Client using the given options.

func (*Client) Get added in v1.4.1

func (c *Client) Get(urlPath string) (*http.Response, error)

Get implements Getter interface by sending GET request using configured client.

type Connector added in v1.5.0

type Connector interface {
	Connect() (*connParams, error)
}

Connector provides an interface to retrieve connParams to connect to a Kubelet instance.

func DefaultConnector added in v1.5.0

func DefaultConnector(kc kubernetes.Interface, config *config.Config, inClusterConfig *rest.Config, logger *logrus.Logger) Connector

DefaultConnector returns a defaultConnector that checks connection against local kubelet and api proxy.

func StaticConnector added in v1.5.0

func StaticConnector(client Doer, u url.URL) Connector

StaticConnector returns a fixed connector that does not check the connection when calling .Connect().

type Doer added in v1.5.0

type Doer interface {
	Do(*http.Request) (*http.Response, error)
}

type Getter added in v1.5.0

type Getter interface {
	Get(path string) (*http.Response, error)
}

Getter is an interface for HTTP client with, which should provide scheme, port and hostname for the HTTP call.

type OptionFunc added in v1.5.0

type OptionFunc func(kc *Client) error

func WithLogger added in v1.5.0

func WithLogger(logger *log.Logger) OptionFunc

WithLogger returns an OptionFunc to change the logger from the default noop logger.

func WithMaxRetries added in v1.5.0

func WithMaxRetries(retries int) OptionFunc

WithMaxRetries returns an OptionFunc to change the number of retries used int Pester Client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL