client-go: k8s.io/client-go/dynamic Index | Files | Directories

package dynamic

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

Package dynamic provides a client interface to arbitrary Kubernetes APIs that exposes common high level operations and exposes common metadata.

Index

Package Files

client.go client_pool.go dynamic_util.go

Variables

var VersionedParameterEncoderWithV1Fallback runtime.ParameterCodec = versionedParameterEncoderWithV1Fallback{}

VersionedParameterEncoderWithV1Fallback is useful for encoding query parameters for custom resources. It tries to convert object to the specified version before converting it to query parameters, and falls back to converting to v1 if the object is not registered in the specified version. For the record, currently API server always treats query parameters sent to a custom resource endpoint as v1.

func ContentConfig Uses

func ContentConfig() restclient.ContentConfig

ContentConfig returns a restclient.ContentConfig for dynamic types.

func LegacyAPIPathResolverFunc Uses

func LegacyAPIPathResolverFunc(kind schema.GroupVersionKind) string

LegacyAPIPathResolverFunc can resolve paths properly with the legacy API.

func NewDiscoveryRESTMapper Uses

func NewDiscoveryRESTMapper(resources []*metav1.APIResourceList, versionFunc meta.VersionInterfacesFunc) (*meta.DefaultRESTMapper, error)

NewDiscoveryRESTMapper returns a RESTMapper based on discovery information.

func NewObjectTyper Uses

func NewObjectTyper(resources []*metav1.APIResourceList) (runtime.ObjectTyper, error)

NewObjectTyper constructs an ObjectTyper from discovery information.

func VersionInterfaces Uses

func VersionInterfaces(schema.GroupVersion) (*meta.VersionInterfaces, error)

VersionInterfaces provides an object converter and metadata accessor appropriate for use with unstructured objects.

type APIPathResolverFunc Uses

type APIPathResolverFunc func(kind schema.GroupVersionKind) string

APIPathResolverFunc knows how to convert a groupVersion to its API path. The Kind field is optional.

type Client Uses

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

Client is a Kubernetes client that allows you to access metadata and manipulate metadata of a Kubernetes API group, and implements Interface.

func NewClient Uses

func NewClient(conf *restclient.Config) (*Client, error)

NewClient returns a new client based on the passed in config. The codec is ignored, as the dynamic client uses it's own codec.

func (*Client) GetRateLimiter Uses

func (c *Client) GetRateLimiter() flowcontrol.RateLimiter

GetRateLimiter returns rate limier.

func (*Client) ParameterCodec Uses

func (c *Client) ParameterCodec(parameterCodec runtime.ParameterCodec) Interface

ParameterCodec returns a client with the provided parameter codec.

func (*Client) Resource Uses

func (c *Client) Resource(resource *metav1.APIResource, namespace string) ResourceInterface

Resource returns an API interface to the specified resource for this client's group and version. If resource is not a namespaced resource, then namespace is ignored. The ResourceInterface inherits the parameter codec of c.

type ClientPool Uses

type ClientPool interface {
    // ClientForGroupVersionResource returns a client configured for the specified groupVersionResource.
    // Resource may be empty.
    ClientForGroupVersionResource(resource schema.GroupVersionResource) (Interface, error)
    // ClientForGroupVersionKind returns a client configured for the specified groupVersionKind.
    // Kind may be empty.
    ClientForGroupVersionKind(kind schema.GroupVersionKind) (Interface, error)
}

ClientPool manages a pool of dynamic clients.

func NewClientPool Uses

func NewClientPool(config *restclient.Config, mapper meta.RESTMapper, apiPathResolverFunc APIPathResolverFunc) ClientPool

NewClientPool returns a ClientPool from the specified config. It reuses clients for the same group version. It is expected this type may be wrapped by specific logic that special cases certain resources or groups.

func NewDynamicClientPool Uses

func NewDynamicClientPool(cfg *restclient.Config) ClientPool

Instantiates a new dynamic client pool with the given config.

type Interface Uses

type Interface interface {
    // GetRateLimiter returns the rate limiter for this client.
    GetRateLimiter() flowcontrol.RateLimiter
    // Resource returns an API interface to the specified resource for this client's
    // group and version.  If resource is not a namespaced resource, then namespace
    // is ignored.  The ResourceInterface inherits the parameter codec of this client.
    Resource(resource *metav1.APIResource, namespace string) ResourceInterface
    // ParameterCodec returns a client with the provided parameter codec.
    ParameterCodec(parameterCodec runtime.ParameterCodec) Interface
}

Interface is a Kubernetes client that allows you to access metadata and manipulate metadata of a Kubernetes API group.

type ObjectTyper Uses

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

ObjectTyper provides an ObjectTyper implementation for unstructured.Unstructured object based on discovery information.

func (*ObjectTyper) ObjectKinds Uses

func (ot *ObjectTyper) ObjectKinds(obj runtime.Object) ([]schema.GroupVersionKind, bool, error)

ObjectKinds returns a slice of one element with the group,version,kind of the provided object, or an error if the object is not *unstructured.Unstructured or has no group,version,kind information.

func (*ObjectTyper) Recognizes Uses

func (ot *ObjectTyper) Recognizes(gvk schema.GroupVersionKind) bool

Recognizes returns true if the provided group,version,kind was in the discovery information.

type ResourceClient Uses

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

ResourceClient is an API interface to a specific resource under a dynamic client, and implements ResourceInterface.

func (*ResourceClient) Create Uses

func (rc *ResourceClient) Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)

Create creates the provided resource.

func (*ResourceClient) Delete Uses

func (rc *ResourceClient) Delete(name string, opts *metav1.DeleteOptions) error

Delete deletes the resource with the specified name.

func (*ResourceClient) DeleteCollection Uses

func (rc *ResourceClient) DeleteCollection(deleteOptions *metav1.DeleteOptions, listOptions metav1.ListOptions) error

DeleteCollection deletes a collection of objects.

func (*ResourceClient) Get Uses

func (rc *ResourceClient) Get(name string, opts metav1.GetOptions) (*unstructured.Unstructured, error)

Get gets the resource with the specified name.

func (*ResourceClient) List Uses

func (rc *ResourceClient) List(opts metav1.ListOptions) (runtime.Object, error)

List returns a list of objects for this resource.

func (*ResourceClient) Patch Uses

func (rc *ResourceClient) Patch(name string, pt types.PatchType, data []byte) (*unstructured.Unstructured, error)

func (*ResourceClient) Update Uses

func (rc *ResourceClient) Update(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)

Update updates the provided resource.

func (*ResourceClient) Watch Uses

func (rc *ResourceClient) Watch(opts metav1.ListOptions) (watch.Interface, error)

Watch returns a watch.Interface that watches the resource.

type ResourceInterface Uses

type ResourceInterface interface {
    // List returns a list of objects for this resource.
    List(opts metav1.ListOptions) (runtime.Object, error)
    // Get gets the resource with the specified name.
    Get(name string, opts metav1.GetOptions) (*unstructured.Unstructured, error)
    // Delete deletes the resource with the specified name.
    Delete(name string, opts *metav1.DeleteOptions) error
    // DeleteCollection deletes a collection of objects.
    DeleteCollection(deleteOptions *metav1.DeleteOptions, listOptions metav1.ListOptions) error
    // Create creates the provided resource.
    Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
    // Update updates the provided resource.
    Update(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
    // Watch returns a watch.Interface that watches the resource.
    Watch(opts metav1.ListOptions) (watch.Interface, error)
    // Patch patches the provided resource.
    Patch(name string, pt types.PatchType, data []byte) (*unstructured.Unstructured, error)
}

ResourceInterface is an API interface to a specific resource under a dynamic client.

Directories

PathSynopsis
fakePackage fake provides a fake client interface to arbitrary Kubernetes APIs that exposes common high level operations and exposes common metadata.

Package dynamic imports 20 packages (graph) and is imported by 143 packages. Updated 2018-02-15. Refresh now. Tools for package owners.