client

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFakeDiscoveryClient added in v0.4.0

func NewFakeDiscoveryClient(registeredResources []schema.GroupVersionResource) *fakeDiscoveryClient

NewFakeDiscoveryClient returns a fakediscovery client

Types

type IDiscovery added in v0.4.0

type IDiscovery interface {
	FindResource(apiVersion string, kind string) (*metav1.APIResource, schema.GroupVersionResource, error)
	GetGVRFromKind(kind string) (schema.GroupVersionResource, error)
	GetGVRFromAPIVersionKind(apiVersion string, kind string) schema.GroupVersionResource
	GetServerVersion() (*version.Info, error)
	OpenAPISchema() (*openapiv2.Document, error)
	DiscoveryCache() discovery.CachedDiscoveryInterface
	DiscoveryInterface() discovery.DiscoveryInterface
}

IDiscovery provides interface to mange Kind and GVR mapping

type Interface added in v1.7.0

type Interface interface {
	// NewDynamicSharedInformerFactory returns a new instance of DynamicSharedInformerFactory
	NewDynamicSharedInformerFactory(time.Duration) dynamicinformer.DynamicSharedInformerFactory
	// GetEventsInterface provides typed interface for events
	GetEventsInterface() (corev1.EventInterface, error)
	// GetCSRInterface provides type interface for CSR
	GetCSRInterface() (certsv1beta1.CertificateSigningRequestInterface, error)
	// GetDynamicInterface fetches underlying dynamic interface
	GetDynamicInterface() dynamic.Interface
	// Discovery return the discovery client implementation
	Discovery() IDiscovery
	// SetDiscovery sets the discovery client implementation
	SetDiscovery(discoveryClient IDiscovery)
	// GetResource returns the resource in unstructured/json format
	GetResource(apiVersion string, kind string, namespace string, name string, subresources ...string) (*unstructured.Unstructured, error)
	// PatchResource patches the resource
	PatchResource(apiVersion string, kind string, namespace string, name string, patch []byte) (*unstructured.Unstructured, error)
	// ListResource returns the list of resources in unstructured/json format
	// Access items using []Items
	ListResource(apiVersion string, kind string, namespace string, lselector *metav1.LabelSelector) (*unstructured.UnstructuredList, error)
	// DeleteResource deletes the specified resource
	DeleteResource(apiVersion string, kind string, namespace string, name string, dryRun bool) error
	// CreateResource creates object for the specified resource/namespace
	CreateResource(apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
	// UpdateResource updates object for the specified resource/namespace
	UpdateResource(apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
	// UpdateStatusResource updates the resource "status" subresource
	UpdateStatusResource(apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
}

func NewClient

func NewClient(config *rest.Config, resync time.Duration, stopCh <-chan struct{}) (Interface, error)

NewClient creates new instance of client

func NewMockClient added in v0.4.0

func NewMockClient(scheme *runtime.Scheme, gvrToListKind map[schema.GroupVersionResource]string, objects ...runtime.Object) (Interface, error)

NewMockClient ---testing utilities

Jump to

Keyboard shortcuts

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