gentype

package
v0.31.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 257

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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,
) *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

func (c *Client[T]) Create(ctx context.Context, obj T, opts metav1.CreateOptions) (T, 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 (*Client[T]) Delete

func (c *Client[T]) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error

Delete takes name of the resource and deletes it. Returns an error if one occurs.

func (*Client[T]) Get

func (c *Client[T]) Get(ctx context.Context, name string, options metav1.GetOptions) (T, error)

Get takes name of the resource, and returns the corresponding object, and an error if there is any.

func (*Client[T]) GetClient

func (c *Client[T]) GetClient() rest.Interface

GetClient returns the REST interface.

func (*Client[T]) GetNamespace

func (c *Client[T]) GetNamespace() string

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

func (c *Client[T]) Update(ctx context.Context, obj T, opts metav1.UpdateOptions) (T, 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 (*Client[T]) UpdateStatus

func (c *Client[T]) UpdateStatus(ctx context.Context, obj T, opts metav1.UpdateOptions) (T, error)

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

func (c *Client[T]) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)

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,
) *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,
) *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,
) *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.

Jump to

Keyboard shortcuts

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