...

Package restmapper

import "k8s.io/client-go/restmapper"
Overview
Index

Overview ▾

Index ▾

func NewDiscoveryRESTMapper(groupResources []*APIGroupResources) meta.RESTMapper
func NewShortcutExpander(delegate meta.RESTMapper, client discovery.DiscoveryInterface, warningHandler func(string)) meta.RESTMapper
type APIGroupResources
    func GetAPIGroupResources(cl discovery.DiscoveryInterface) ([]*APIGroupResources, error)
type CategoryExpander
    func NewDiscoveryCategoryExpander(client discovery.DiscoveryInterface) CategoryExpander
type DeferredDiscoveryRESTMapper
    func NewDeferredDiscoveryRESTMapper(cl discovery.CachedDiscoveryInterface) *DeferredDiscoveryRESTMapper
    func (d *DeferredDiscoveryRESTMapper) KindFor(resource schema.GroupVersionResource) (gvk schema.GroupVersionKind, err error)
    func (d *DeferredDiscoveryRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvks []schema.GroupVersionKind, err error)
    func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (m *meta.RESTMapping, err error)
    func (d *DeferredDiscoveryRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) (ms []*meta.RESTMapping, err error)
    func (d *DeferredDiscoveryRESTMapper) Reset()
    func (d *DeferredDiscoveryRESTMapper) ResourceFor(input schema.GroupVersionResource) (gvr schema.GroupVersionResource, err error)
    func (d *DeferredDiscoveryRESTMapper) ResourceSingularizer(resource string) (singular string, err error)
    func (d *DeferredDiscoveryRESTMapper) ResourcesFor(input schema.GroupVersionResource) (gvrs []schema.GroupVersionResource, err error)
    func (d *DeferredDiscoveryRESTMapper) String() string
type SimpleCategoryExpander
    func (e SimpleCategoryExpander) Expand(category string) ([]schema.GroupResource, bool)
type UnionCategoryExpander
    func (u UnionCategoryExpander) Expand(category string) ([]schema.GroupResource, bool)

Package files

category_expansion.go discovery.go shortcut.go

func NewDiscoveryRESTMapper

func NewDiscoveryRESTMapper(groupResources []*APIGroupResources) meta.RESTMapper

NewDiscoveryRESTMapper returns a PriorityRESTMapper based on the discovered groups and resources passed in.

func NewShortcutExpander

func NewShortcutExpander(delegate meta.RESTMapper, client discovery.DiscoveryInterface, warningHandler func(string)) meta.RESTMapper

NewShortcutExpander wraps a restmapper in a layer that expands shortcuts found via discovery

type APIGroupResources

APIGroupResources is an API group with a mapping of versions to resources.

type APIGroupResources struct {
    Group metav1.APIGroup
    // A mapping of version string to a slice of APIResources for
    // that version.
    VersionedResources map[string][]metav1.APIResource
}

func GetAPIGroupResources

func GetAPIGroupResources(cl discovery.DiscoveryInterface) ([]*APIGroupResources, error)

GetAPIGroupResources uses the provided discovery client to gather discovery information and populate a slice of APIGroupResources.

type CategoryExpander

CategoryExpander maps category strings to GroupResources. Categories are classification or 'tag' of a group of resources.

type CategoryExpander interface {
    Expand(category string) ([]schema.GroupResource, bool)
}

func NewDiscoveryCategoryExpander

func NewDiscoveryCategoryExpander(client discovery.DiscoveryInterface) CategoryExpander

NewDiscoveryCategoryExpander returns a category expander that makes use of the "categories" fields from the API, found through the discovery client. In case of any error or no category found (which likely means we're at a cluster prior to categories support, fallback to the expander provided.

type DeferredDiscoveryRESTMapper

DeferredDiscoveryRESTMapper is a RESTMapper that will defer initialization of the RESTMapper until the first mapping is requested.

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

func NewDeferredDiscoveryRESTMapper

func NewDeferredDiscoveryRESTMapper(cl discovery.CachedDiscoveryInterface) *DeferredDiscoveryRESTMapper

NewDeferredDiscoveryRESTMapper returns a DeferredDiscoveryRESTMapper that will lazily query the provided client for discovery information to do REST mappings.

func (*DeferredDiscoveryRESTMapper) KindFor

func (d *DeferredDiscoveryRESTMapper) KindFor(resource schema.GroupVersionResource) (gvk schema.GroupVersionKind, err error)

KindFor takes a partial resource and returns back the single match. It returns an error if there are multiple matches.

func (*DeferredDiscoveryRESTMapper) KindsFor

func (d *DeferredDiscoveryRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvks []schema.GroupVersionKind, err error)

KindsFor takes a partial resource and returns back the list of potential kinds in priority order.

func (*DeferredDiscoveryRESTMapper) RESTMapping

func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (m *meta.RESTMapping, err error)

RESTMapping identifies a preferred resource mapping for the provided group kind.

func (*DeferredDiscoveryRESTMapper) RESTMappings

func (d *DeferredDiscoveryRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) (ms []*meta.RESTMapping, err error)

RESTMappings returns the RESTMappings for the provided group kind in a rough internal preferred order. If no kind is found, it will return a NoResourceMatchError.

func (*DeferredDiscoveryRESTMapper) Reset

func (d *DeferredDiscoveryRESTMapper) Reset()

Reset resets the internally cached Discovery information and will cause the next mapping request to re-discover.

func (*DeferredDiscoveryRESTMapper) ResourceFor

func (d *DeferredDiscoveryRESTMapper) ResourceFor(input schema.GroupVersionResource) (gvr schema.GroupVersionResource, err error)

ResourceFor takes a partial resource and returns back the single match. It returns an error if there are multiple matches.

func (*DeferredDiscoveryRESTMapper) ResourceSingularizer

func (d *DeferredDiscoveryRESTMapper) ResourceSingularizer(resource string) (singular string, err error)

ResourceSingularizer converts a resource name from plural to singular (e.g., from pods to pod).

func (*DeferredDiscoveryRESTMapper) ResourcesFor

func (d *DeferredDiscoveryRESTMapper) ResourcesFor(input schema.GroupVersionResource) (gvrs []schema.GroupVersionResource, err error)

ResourcesFor takes a partial resource and returns back the list of potential resource in priority order.

func (*DeferredDiscoveryRESTMapper) String

func (d *DeferredDiscoveryRESTMapper) String() string

type SimpleCategoryExpander

SimpleCategoryExpander implements CategoryExpander interface using a static mapping of categories to GroupResource mapping.

type SimpleCategoryExpander struct {
    Expansions map[string][]schema.GroupResource
}

func (SimpleCategoryExpander) Expand

func (e SimpleCategoryExpander) Expand(category string) ([]schema.GroupResource, bool)

Expand fulfills CategoryExpander

type UnionCategoryExpander

UnionCategoryExpander implements CategoryExpander interface. It maps given category string to union of expansions returned by all the CategoryExpanders in the list.

type UnionCategoryExpander []CategoryExpander

func (UnionCategoryExpander) Expand

func (u UnionCategoryExpander) Expand(category string) ([]schema.GroupResource, bool)

Expand fulfills CategoryExpander