apiclient

package
v0.0.0-...-da4181b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClientFactory = func(config *tls.Config) *http.Client {
	transport := http.DefaultTransport.(*http.Transport).Clone()
	transport.TLSClientConfig = config

	return &http.Client{
		Transport: transport,
	}
}

This is the default Client factory it returns a zero-value client.

Functions

func GeneratorFactory

func GeneratorFactory(factory HTTPClientFactory) generators.GeneratorFactory

GeneratorFactory is a function for creating per-reconciliation generators for the APIClientGenerator.

Types

type APIClientGenerator

type APIClientGenerator struct {
	ClientFactory HTTPClientFactory
	Client        client.Reader
	logr.Logger
}

APIClientGenerator generates from an API endpoint.

func NewGenerator

func NewGenerator(l logr.Logger, c client.Reader, clientFactory HTTPClientFactory) *APIClientGenerator

NewGenerator creates and returns a new API client generator.

func (*APIClientGenerator) Generate

Generate makes an HTTP request using the APIClient definition and returns the result converted to a slice of maps.

func (*APIClientGenerator) Interval

Interval is an implementation of the Generator interface.

The APIClientGenerator requires to poll regularly as there's nothing to drive watches.

type HTTPClientFactory

type HTTPClientFactory func(*tls.Config) *http.Client

This is used to create per API request http.Clients.

Jump to

Keyboard shortcuts

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