package gentype
import "k8s.io/client-go/gentype"
Index ¶
- func FromPointerSlice[T any](src []*T) []T
- func ToPointerSlice[T any](src []T) []*T
- type Client
- func NewClient[T objectWithMeta]( resource string, client rest.Interface, parameterCodec runtime.ParameterCodec, namespace string, emptyObjectCreator func() T, options ...Option[T], ) *Client[T]
- 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, opts metav1.PatchOptions, subresources ...string) (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
- 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]
- func (a *ClientWithApply) Apply(ctx context.Context, obj C, opts metav1.ApplyOptions) (T, error)
- func (a *ClientWithApply) ApplyStatus(ctx context.Context, obj C, opts metav1.ApplyOptions) (T, error)
- type ClientWithList
- 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]
- func (l *ClientWithList) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
- func (l *ClientWithList) List(ctx context.Context, opts metav1.ListOptions) (L, error)
- type ClientWithListAndApply
- 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]
- 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 NewFakeClient[T objectWithMeta]( fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T, ) *FakeClient[T]
- 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, opts metav1.PatchOptions, subresources ...string) (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
- func NewFakeClientWithApply[T objectWithMeta, C namedObject]( fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T, ) *FakeClientWithApply[T, C]
- func (a *FakeClientWithApply) Apply(ctx context.Context, configuration C, opts metav1.ApplyOptions) (result T, err error)
- func (a *FakeClientWithApply) ApplyStatus(ctx context.Context, configuration C, opts metav1.ApplyOptions) (result T, err error)
- type FakeClientWithList
- 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]
- func (l *FakeClientWithList) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
- func (l *FakeClientWithList) List(ctx context.Context, opts metav1.ListOptions) (result L, err error)
- type FakeClientWithListAndApply
- 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]
- 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
Functions ¶
func FromPointerSlice ¶
func FromPointerSlice[T any](src []*T) []T
func ToPointerSlice ¶
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]) GetClient ¶
GetClient returns the REST interface.
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.
func (*Client[T]) Watch ¶
Watch returns a watch.Interface that watches the requested resources.
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.
func (*ClientWithList) List ¶
func (l *ClientWithList) List(ctx context.Context, opts metav1.ListOptions) (L, error)
List takes label and field selectors, and returns the list of resources that match those selectors.
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.
func (*ClientWithListAndApply) List ¶
func (l *ClientWithListAndApply) List(ctx context.Context, opts metav1.ListOptions) (L, error)
List takes label and field selectors, and returns the list of resources that match those selectors.
type FakeClient ¶
type FakeClient[T objectWithMeta] struct { *testing.Fake // contains filtered or unexported fields }
FakeClient represents a fake client
func NewFakeClient ¶
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 ¶
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 ¶
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 ¶
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 ¶
func (c *FakeClient[T]) Kind() schema.GroupVersionKind
func (*FakeClient[T]) Namespace ¶
func (c *FakeClient[T]) Namespace() string
func (*FakeClient[T]) Patch ¶
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 ¶
func (c *FakeClient[T]) Resource() schema.GroupVersionResource
func (*FakeClient[T]) Update ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func (l *FakeClientWithList) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
DeleteCollection deletes a collection of objects.
func (*FakeClientWithList) List ¶
func (l *FakeClientWithList) List(ctx context.Context, opts metav1.ListOptions) (result L, err error)
List takes label and field selectors, and returns the list of resources that match those selectors.
type FakeClientWithListAndApply ¶
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 ¶
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 ¶
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 ¶
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 ¶
func (l *FakeClientWithListAndApply) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
DeleteCollection deletes a collection of objects.
func (*FakeClientWithListAndApply) List ¶
func (l *FakeClientWithListAndApply) List(ctx context.Context, opts metav1.ListOptions) (result L, err error)
List takes label and field selectors, and returns the list of resources that match those selectors.
type Option ¶
type Option[T objectWithMeta] func(*Client[T])
func PrefersProtobuf ¶
func PrefersProtobuf[T objectWithMeta]() Option[T]
Source Files ¶
fake.go type.go
- Version
- v0.32.0-rc.0
- Published
- Nov 27, 2024
- Platform
- linux/amd64
- Imports
- 17 packages
- Last checked
- 1 hour ago –
Tools for package owners.