controller-runtimesigs.k8s.io/controller-runtime/pkg/client/interceptor Index | Files

package interceptor

import "sigs.k8s.io/controller-runtime/pkg/client/interceptor"

Index

Functions

func NewClient

func NewClient(interceptedClient client.WithWatch, funcs Funcs) client.WithWatch

NewClient returns a new interceptor client that calls the functions in funcs instead of the underlying client's methods, if they are not nil.

Types

type Funcs

type Funcs struct {
	Get               func(ctx context.Context, client client.WithWatch, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
	List              func(ctx context.Context, client client.WithWatch, list client.ObjectList, opts ...client.ListOption) error
	Create            func(ctx context.Context, client client.WithWatch, obj client.Object, opts ...client.CreateOption) error
	Delete            func(ctx context.Context, client client.WithWatch, obj client.Object, opts ...client.DeleteOption) error
	DeleteAllOf       func(ctx context.Context, client client.WithWatch, obj client.Object, opts ...client.DeleteAllOfOption) error
	Update            func(ctx context.Context, client client.WithWatch, obj client.Object, opts ...client.UpdateOption) error
	Patch             func(ctx context.Context, client client.WithWatch, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
	Watch             func(ctx context.Context, client client.WithWatch, obj client.ObjectList, opts ...client.ListOption) (watch.Interface, error)
	SubResource       func(client client.WithWatch, subResource string) client.SubResourceClient
	SubResourceGet    func(ctx context.Context, client client.Client, subResourceName string, obj client.Object, subResource client.Object, opts ...client.SubResourceGetOption) error
	SubResourceCreate func(ctx context.Context, client client.Client, subResourceName string, obj client.Object, subResource client.Object, opts ...client.SubResourceCreateOption) error
	SubResourceUpdate func(ctx context.Context, client client.Client, subResourceName string, obj client.Object, opts ...client.SubResourceUpdateOption) error
	SubResourcePatch  func(ctx context.Context, client client.Client, subResourceName string, obj client.Object, patch client.Patch, opts ...client.SubResourcePatchOption) error
}

Funcs contains functions that are called instead of the underlying client's methods.

Source Files

intercept.go

Version
v0.21.0 (latest)
Published
May 20, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
24 minutes ago

Tools for package owners.