restmapper

package
v1.14.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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) meta.RESTMapper

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

Types

type APIGroupResources

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

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

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

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

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

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

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

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

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

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

func (*DeferredDiscoveryRESTMapper) KindsFor

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

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

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

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

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

func (SimpleCategoryExpander) Expand

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

Expand fulfills CategoryExpander

type UnionCategoryExpander

type UnionCategoryExpander []CategoryExpander

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

func (UnionCategoryExpander) Expand

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

Expand fulfills CategoryExpander

Jump to

Keyboard shortcuts

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