apiutil

package
v0.25.6 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: Apache-2.0 Imports: 8 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cachable

type Cachable interface {
	GVK(gvk schema.GroupVersionKind) (bool, error)
	GVR(gvr schema.GroupVersionResource) (bool, error)
}

func NewCachable

func NewCachable(cl discovery.DiscoveryInterface) (Cachable, error)

func NewDynamicCachable

func NewDynamicCachable(cfg *rest.Config, opts ...DynamicCachableOption) (Cachable, error)

NewDynamicCachable returns a dynamic Cachable for cfg. The dynamic Cachable dynamically discovers resource types at runtime. opts configure the Cachable.

type DynamicCachableOption

type DynamicCachableOption func(*dynamicCachable) error

DynamicCachableOption is a functional option on the dynamicCachable

var WithLazyDiscovery DynamicCachableOption = func(drm *dynamicCachable) error {
	drm.lazy = true
	return nil
}

WithLazyDiscovery prevents the Cachable from discovering REST mappings until an API call is made.

func WithCustomCachable

func WithCustomCachable(newCachable func() (Cachable, error)) DynamicCachableOption

WithCustomCachable supports setting a custom Cachable refresher instead of the default method, which uses a discovery client.

This exists mainly for testing, but can be useful if you need tighter control over how discovery is performed, which discovery endpoints are queried, etc.

func WithLimiter

func WithLimiter(lim *rate.Limiter) DynamicCachableOption

WithLimiter sets the Cachable's underlying limiter to lim.

Jump to

Keyboard shortcuts

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