Documentation ¶
Index ¶
- func FromPointerSlice[T any](src []*T) []T
- func ToPointerSlice[T any](src []T) []*T
- type Client
- func (c *Client[T]) Create(ctx context.Context, obj T, opts metav1.CreateOptions) (T, error)
- func (c *Client[T]) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
- func (c *Client[T]) Get(ctx context.Context, name string, options metav1.GetOptions) (T, error)
- func (c *Client[T]) GetClient() rest.Interface
- func (c *Client[T]) GetNamespace() string
- func (c *Client[T]) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, ...) (T, error)
- func (c *Client[T]) Update(ctx context.Context, obj T, opts metav1.UpdateOptions) (T, error)
- func (c *Client[T]) UpdateStatus(ctx context.Context, obj T, opts metav1.UpdateOptions) (T, error)
- func (c *Client[T]) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
- type ClientWithApply
- type ClientWithList
- type ClientWithListAndApply
- func (a *ClientWithListAndApply) Apply(ctx context.Context, obj C, opts metav1.ApplyOptions) (T, error)
- func (a *ClientWithListAndApply) ApplyStatus(ctx context.Context, obj C, opts metav1.ApplyOptions) (T, error)
- func (l *ClientWithListAndApply) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
- func (l *ClientWithListAndApply) List(ctx context.Context, opts metav1.ListOptions) (L, error)
- type FakeClient
- func (c *FakeClient[T]) Create(ctx context.Context, resource T, opts metav1.CreateOptions) (result T, err error)
- func (c *FakeClient[T]) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
- func (c *FakeClient[T]) Get(ctx context.Context, name string, options metav1.GetOptions) (T, error)
- func (c *FakeClient[T]) Kind() schema.GroupVersionKind
- func (c *FakeClient[T]) Namespace() string
- func (c *FakeClient[T]) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, ...) (result T, err error)
- func (c *FakeClient[T]) Resource() schema.GroupVersionResource
- func (c *FakeClient[T]) Update(ctx context.Context, resource T, opts metav1.UpdateOptions) (result T, err error)
- func (c *FakeClient[T]) UpdateStatus(ctx context.Context, resource T, opts metav1.UpdateOptions) (result T, err error)
- func (c *FakeClient[T]) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
- type FakeClientWithApply
- type FakeClientWithList
- type FakeClientWithListAndApply
- func (a *FakeClientWithListAndApply) Apply(ctx context.Context, configuration C, opts metav1.ApplyOptions) (result T, err error)
- func (a *FakeClientWithListAndApply) ApplyStatus(ctx context.Context, configuration C, opts metav1.ApplyOptions) (result T, err error)
- func (l *FakeClientWithListAndApply) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
- func (l *FakeClientWithListAndApply) List(ctx context.Context, opts metav1.ListOptions) (result L, err error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromPointerSlice ¶ added in v0.32.0
func FromPointerSlice[T any](src []*T) []T
func ToPointerSlice ¶ added in v0.32.0
func ToPointerSlice[T any](src []T) []*T
Types ¶
type Client ¶
type Client[T objectWithMeta] struct {
// contains filtered or unexported fields
}
Client represents a client, optionally namespaced, with no support for lists or apply declarative configurations.
func NewClient ¶
func NewClient[T objectWithMeta]( resource string, client rest.Interface, parameterCodec runtime.ParameterCodec, namespace string, emptyObjectCreator func() T, options ...Option[T], ) *Client[T]
NewClient constructs a client, namespaced or not, with no support for lists or apply. Non-namespaced clients are constructed by passing an empty namespace ("").
func (*Client[T]) Create ¶
Create takes the representation of a resource and creates it. Returns the server's representation of the resource, and an error, if there is any.
func (*Client[T]) Delete ¶
Delete takes name of the resource and deletes it. Returns an error if one occurs.
func (*Client[T]) Get ¶
Get takes name of the resource, and returns the corresponding object, and an error if there is any.
func (*Client[T]) GetNamespace ¶
GetNamespace returns the client's namespace, if any.
func (*Client[T]) Patch ¶
func (c *Client[T]) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (T, error)
Patch applies the patch and returns the patched resource.
func (*Client[T]) Update ¶
Update takes the representation of a resource and updates it. Returns the server's representation of the resource, and an error, if there is any.
func (*Client[T]) UpdateStatus ¶
UpdateStatus updates the status subresource of a resource. Returns the server's representation of the resource, and an error, if there is any.
type ClientWithApply ¶
type ClientWithApply[T objectWithMeta, C namedObject] struct { *Client[T] // contains filtered or unexported fields }
ClientWithApply represents a client with support for apply declarative configurations.
func NewClientWithApply ¶
func NewClientWithApply[T objectWithMeta, C namedObject]( resource string, client rest.Interface, parameterCodec runtime.ParameterCodec, namespace string, emptyObjectCreator func() T, options ...Option[T], ) *ClientWithApply[T, C]
NewClientWithApply constructs a namespaced client with support for apply declarative configurations.
func (*ClientWithApply) Apply ¶
func (a *ClientWithApply) Apply(ctx context.Context, obj C, opts metav1.ApplyOptions) (T, error)
Apply takes the given apply declarative configuration, applies it and returns the applied resource.
func (*ClientWithApply) ApplyStatus ¶
func (a *ClientWithApply) ApplyStatus(ctx context.Context, obj C, opts metav1.ApplyOptions) (T, error)
Apply takes the given apply declarative configuration, applies it to the status subresource and returns the applied resource.
type ClientWithList ¶
type ClientWithList[T objectWithMeta, L runtime.Object] struct { *Client[T] // contains filtered or unexported fields }
ClientWithList represents a client with support for lists.
func NewClientWithList ¶
func NewClientWithList[T objectWithMeta, L runtime.Object]( resource string, client rest.Interface, parameterCodec runtime.ParameterCodec, namespace string, emptyObjectCreator func() T, emptyListCreator func() L, options ...Option[T], ) *ClientWithList[T, L]
NewClientWithList constructs a namespaced client with support for lists.
func (*ClientWithList) DeleteCollection ¶
func (l *ClientWithList) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
DeleteCollection deletes a collection of objects.
type ClientWithListAndApply ¶
type ClientWithListAndApply[T objectWithMeta, L runtime.Object, C namedObject] struct { *Client[T] // contains filtered or unexported fields }
ClientWithListAndApply represents a client with support for lists and apply declarative configurations.
func NewClientWithListAndApply ¶
func NewClientWithListAndApply[T objectWithMeta, L runtime.Object, C namedObject]( resource string, client rest.Interface, parameterCodec runtime.ParameterCodec, namespace string, emptyObjectCreator func() T, emptyListCreator func() L, options ...Option[T], ) *ClientWithListAndApply[T, L, C]
NewClientWithListAndApply constructs a client with support for lists and applying declarative configurations.
func (*ClientWithListAndApply) Apply ¶
func (a *ClientWithListAndApply) Apply(ctx context.Context, obj C, opts metav1.ApplyOptions) (T, error)
Apply takes the given apply declarative configuration, applies it and returns the applied resource.
func (*ClientWithListAndApply) ApplyStatus ¶
func (a *ClientWithListAndApply) ApplyStatus(ctx context.Context, obj C, opts metav1.ApplyOptions) (T, error)
Apply takes the given apply declarative configuration, applies it to the status subresource and returns the applied resource.
func (*ClientWithListAndApply) DeleteCollection ¶
func (l *ClientWithListAndApply) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
DeleteCollection deletes a collection of objects.
type FakeClient ¶ added in v0.32.0
type FakeClient[T objectWithMeta] struct { *testing.Fake // contains filtered or unexported fields }
FakeClient represents a fake client
func NewFakeClient ¶ added in v0.32.0
func NewFakeClient[T objectWithMeta]( fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T, ) *FakeClient[T]
NewFakeClient constructs a fake client, namespaced or not, with no support for lists or apply. Non-namespaced clients are constructed by passing an empty namespace ("").
func (*FakeClient[T]) Create ¶ added in v0.32.0
func (c *FakeClient[T]) Create(ctx context.Context, resource T, opts metav1.CreateOptions) (result T, err error)
Create takes the representation of a resource and creates it. Returns the server's representation of the resource, and an error, if there is any.
func (*FakeClient[T]) Delete ¶ added in v0.32.0
func (c *FakeClient[T]) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
Delete deletes the resource matching the given name. Returns an error if one occurs.
func (*FakeClient[T]) Get ¶ added in v0.32.0
func (c *FakeClient[T]) Get(ctx context.Context, name string, options metav1.GetOptions) (T, error)
Get takes name of a resource, and returns the corresponding object, and an error if there is any.
func (*FakeClient[T]) Kind ¶ added in v0.32.0
func (c *FakeClient[T]) Kind() schema.GroupVersionKind
func (*FakeClient[T]) Namespace ¶ added in v0.32.0
func (c *FakeClient[T]) Namespace() string
func (*FakeClient[T]) Patch ¶ added in v0.32.0
func (c *FakeClient[T]) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result T, err error)
Patch applies the patch and returns the patched resource.
func (*FakeClient[T]) Resource ¶ added in v0.32.0
func (c *FakeClient[T]) Resource() schema.GroupVersionResource
func (*FakeClient[T]) Update ¶ added in v0.32.0
func (c *FakeClient[T]) Update(ctx context.Context, resource T, opts metav1.UpdateOptions) (result T, err error)
Update takes the representation of a resource and updates it. Returns the server's representation of the resource, and an error, if there is any.
func (*FakeClient[T]) UpdateStatus ¶ added in v0.32.0
func (c *FakeClient[T]) UpdateStatus(ctx context.Context, resource T, opts metav1.UpdateOptions) (result T, err error)
UpdateStatus updates the resource's status and returns the updated resource.
func (*FakeClient[T]) Watch ¶ added in v0.32.0
func (c *FakeClient[T]) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
Watch returns a watch.Interface that watches the requested resources.
type FakeClientWithApply ¶ added in v0.32.0
type FakeClientWithApply[T objectWithMeta, C namedObject] struct { *FakeClient[T] // contains filtered or unexported fields }
FakeClientWithApply represents a fake client with support for apply declarative configurations.
func NewFakeClientWithApply ¶ added in v0.32.0
func NewFakeClientWithApply[T objectWithMeta, C namedObject]( fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T, ) *FakeClientWithApply[T, C]
NewFakeClientWithApply constructs a namespaced client with support for apply declarative configurations.
func (*FakeClientWithApply) Apply ¶ added in v0.32.0
func (a *FakeClientWithApply) Apply(ctx context.Context, configuration C, opts metav1.ApplyOptions) (result T, err error)
Apply takes the given apply declarative configuration, applies it and returns the applied resource.
func (*FakeClientWithApply) ApplyStatus ¶ added in v0.32.0
func (a *FakeClientWithApply) ApplyStatus(ctx context.Context, configuration C, opts metav1.ApplyOptions) (result T, err error)
ApplyStatus applies the given apply declarative configuration to the resource's status and returns the updated resource.
type FakeClientWithList ¶ added in v0.32.0
type FakeClientWithList[T objectWithMeta, L runtime.Object] struct { *FakeClient[T] // contains filtered or unexported fields }
FakeClientWithList represents a fake client with support for lists.
func NewFakeClientWithList ¶ added in v0.32.0
func NewFakeClientWithList[T objectWithMeta, L runtime.Object]( fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T, emptyListCreator func() L, listMetaCopier func(L, L), itemGetter func(L) []T, itemSetter func(L, []T), ) *FakeClientWithList[T, L]
NewFakeClientWithList constructs a namespaced client with support for lists.
func (*FakeClientWithList) DeleteCollection ¶ added in v0.32.0
func (l *FakeClientWithList) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
DeleteCollection deletes a collection of objects.
type FakeClientWithListAndApply ¶ added in v0.32.0
type FakeClientWithListAndApply[T objectWithMeta, L runtime.Object, C namedObject] struct { *FakeClient[T] // contains filtered or unexported fields }
FakeClientWithListAndApply represents a fake client with support for lists and apply declarative configurations.
func NewFakeClientWithListAndApply ¶ added in v0.32.0
func NewFakeClientWithListAndApply[T objectWithMeta, L runtime.Object, C namedObject]( fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T, emptyListCreator func() L, listMetaCopier func(L, L), itemGetter func(L) []T, itemSetter func(L, []T), ) *FakeClientWithListAndApply[T, L, C]
NewFakeClientWithListAndApply constructs a client with support for lists and applying declarative configurations.
func (*FakeClientWithListAndApply) Apply ¶ added in v0.32.0
func (a *FakeClientWithListAndApply) Apply(ctx context.Context, configuration C, opts metav1.ApplyOptions) (result T, err error)
Apply takes the given apply declarative configuration, applies it and returns the applied resource.
func (*FakeClientWithListAndApply) ApplyStatus ¶ added in v0.32.0
func (a *FakeClientWithListAndApply) ApplyStatus(ctx context.Context, configuration C, opts metav1.ApplyOptions) (result T, err error)
ApplyStatus applies the given apply declarative configuration to the resource's status and returns the updated resource.
func (*FakeClientWithListAndApply) DeleteCollection ¶ added in v0.32.0
func (l *FakeClientWithListAndApply) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
DeleteCollection deletes a collection of objects.