client-gok8s.io/client-go/metadata Index | Files | Directories

package metadata

import "k8s.io/client-go/metadata"

Index

Functions

func ConfigFor

func ConfigFor(inConfig *rest.Config) *rest.Config

ConfigFor returns a copy of the provided config with the appropriate metadata client defaults set.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client allows callers to retrieve the object metadata for any Kubernetes-compatible API endpoint. The client uses the meta.k8s.io/v1 PartialObjectMetadata resource to more efficiently retrieve just the necessary metadata, but on older servers (Kubernetes 1.14 and before) will retrieve the object and then convert the metadata.

func (*Client) Resource

func (c *Client) Resource(resource schema.GroupVersionResource) Getter

Resource returns an interface that can access cluster or namespace scoped instances of resource.

type Getter

type Getter interface {
	Namespace(string) ResourceInterface
	ResourceInterface
}

Getter handles both namespaced and non-namespaced resource types consistently.

type Interface

type Interface interface {
	Resource(resource schema.GroupVersionResource) Getter
}

Interface allows a caller to get the metadata (in the form of PartialObjectMetadata objects) from any Kubernetes compatible resource API.

func NewForConfig

func NewForConfig(inConfig *rest.Config) (Interface, error)

NewForConfig creates a new metadata client that can retrieve object metadata details about any Kubernetes object (core, aggregated, or custom resource based) in the form of PartialObjectMetadata objects, or returns an error. NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), where httpClient was generated with rest.HTTPClientFor(c).

func NewForConfigAndClient

func NewForConfigAndClient(inConfig *rest.Config, h *http.Client) (Interface, error)

NewForConfigAndClient creates a new metadata client for the given config and http client. Note the http client provided takes precedence over the configured transport values.

func NewForConfigOrDie

func NewForConfigOrDie(c *rest.Config) Interface

NewForConfigOrDie creates a new metadata client for the given config and panics if there is an error in the config.

type ResourceInterface

type ResourceInterface interface {
	Delete(ctx context.Context, name string, options metav1.DeleteOptions, subresources ...string) error
	DeleteCollection(ctx context.Context, options metav1.DeleteOptions, listOptions metav1.ListOptions) error
	Get(ctx context.Context, name string, options metav1.GetOptions, subresources ...string) (*metav1.PartialObjectMetadata, error)
	List(ctx context.Context, opts metav1.ListOptions) (*metav1.PartialObjectMetadataList, error)
	Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
	Patch(ctx context.Context, name string, pt types.PatchType, data []byte, options metav1.PatchOptions, subresources ...string) (*metav1.PartialObjectMetadata, error)
}

ResourceInterface contains the set of methods that may be invoked on objects by their metadata. Update is not supported by the server, but Patch can be used for the actions Update would handle.

Source Files

interface.go metadata.go

Directories

PathSynopsis
metadata/fake
metadata/metadatainformer
metadata/metadatalister
Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
16 packages
Last checked
56 minutes ago

Tools for package owners.