connector

package
v3.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Authenticator authenticator.Authenticator
	Endpoints     []config.Endpoint
	Timeout       time.Duration
}

type ConnParams

type ConnParams struct {
	URL    url.URL
	Client client.HTTPDoer
}

ConnParams contains the authenticated parameters to scrape an endpoint.

type Connector

type Connector interface {
	// Connect probes the connector endpoints and returns connParams to scrape a valid endpoint.
	Connect() (*ConnParams, error)
}

Connector provides an interface to retrieve connParams to connect to a Control Plane instance.

type DefaultConnector

type DefaultConnector struct {
	Config
	// contains filtered or unexported fields
}

DefaultConnector implements Connector interface for the Control Plane components.

func New

func New(config Config, opts ...OptionFunc) (*DefaultConnector, error)

New returns a DefaultConnector.

func (*DefaultConnector) Connect

func (dp *DefaultConnector) Connect() (*ConnParams, error)

Connect iterates over the endpoints list probing each endpoint with a HEAD request and returns the connection parameters of the first endpoint that respond Status OK.

type OptionFunc

type OptionFunc func(dc *DefaultConnector) error

func WithLogger

func WithLogger(logger *log.Logger) OptionFunc

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

Jump to

Keyboard shortcuts

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