client

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package client provides the Runtime SDK client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtensionNameFromHandlerName added in v1.5.2

func ExtensionNameFromHandlerName(registeredHandlerName string) (string, error)

ExtensionNameFromHandlerName extracts the extension name from the canonical name of a registered runtime extension handler.

func NameForHandler added in v1.5.2

func NameForHandler(handler runtimehooksv1.ExtensionHandler, extensionConfig *runtimev1.ExtensionConfig) (string, error)

NameForHandler constructs a canonical name for a registered runtime extension handler.

Types

type Client

type Client interface {
	// WarmUp can be used to initialize a "cold" RuntimeClient with all
	// known runtimev1.ExtensionConfigs at a given time.
	// After WarmUp completes the RuntimeClient is considered ready.
	WarmUp(extensionConfigList *runtimev1.ExtensionConfigList) error

	// IsReady return true after the RuntimeClient finishes warmup.
	IsReady() bool

	// Discover makes the discovery call on the extension and returns an updated ExtensionConfig
	// with extension handlers information in the ExtensionConfig status.
	Discover(context.Context, *runtimev1.ExtensionConfig) (*runtimev1.ExtensionConfig, error)

	// Register registers the ExtensionConfig.
	Register(extensionConfig *runtimev1.ExtensionConfig) error

	// Unregister unregisters the ExtensionConfig.
	Unregister(extensionConfig *runtimev1.ExtensionConfig) error

	// CallAllExtensions calls all the ExtensionHandler registered for the hook.
	CallAllExtensions(ctx context.Context, hook runtimecatalog.Hook, forObject metav1.Object, request runtimehooksv1.RequestObject, response runtimehooksv1.ResponseObject) error

	// CallExtension calls the ExtensionHandler with the given name.
	CallExtension(ctx context.Context, hook runtimecatalog.Hook, forObject metav1.Object, name string, request runtimehooksv1.RequestObject, response runtimehooksv1.ResponseObject) error
}

Client is the runtime client to interact with extensions.

func New

func New(options Options) Client

New returns a new Client.

type Options

type Options struct {
	Catalog  *runtimecatalog.Catalog
	Registry runtimeregistry.ExtensionRegistry
	Client   ctrlclient.Client
}

Options are creation options for a Client.

Directories

Path Synopsis
Package fake is used to help with testing functions that need a fake RuntimeClient.
Package fake is used to help with testing functions that need a fake RuntimeClient.

Jump to

Keyboard shortcuts

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