categories

package
v0.0.0-...-4f90778 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDiscoveryCategoryExpander

func NewDiscoveryCategoryExpander(fallbackExpander CategoryExpander, client discovery.DiscoveryInterface) (discoveryCategoryExpander, error)

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.

func NewDiscoveryFilteredExpander

func NewDiscoveryFilteredExpander(delegate CategoryExpander, client discovery.DiscoveryInterface) (discoveryFilteredExpander, error)

NewDiscoveryFilteredExpander returns a category expander that filters the returned groupresources by what the server has available

Types

type CategoryExpander

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

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

var LegacyCategoryExpander CategoryExpander = SimpleCategoryExpander{
	Expansions: map[string][]schema.GroupResource{
		"all": legacyUserResources,
	},
}

LegacyCategoryExpander is the old hardcoded expansion

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)

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)

Jump to

Keyboard shortcuts

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