Documentation ¶
Index ¶
- Constants
- Variables
- func AddCRD(ctx context.Context, crd *unstructured.Unstructured, pm *PathMatcher, ...)
- func CustomResourceDefinition(ctx context.Context, name string, o store.Store) (*apiextv1beta1.CustomResourceDefinition, error)
- func DeleteCRD(ctx context.Context, crd *unstructured.Unstructured, pm *PathMatcher, ...)
- func ListCustomResources(ctx context.Context, crd *apiextv1beta1.CustomResourceDefinition, ...) (*unstructured.UnstructuredList, bool, error)
- func LoadObject(ctx context.Context, objectStore store.Store, ...) (*unstructured.Unstructured, error)
- func LoadObjects(ctx context.Context, objectStore store.Store, ...) (*unstructured.UnstructuredList, error)
- type CRDSection
- func (csd *CRDSection) Add(name string, describer Describer)
- func (csd *CRDSection) Describe(ctx context.Context, namespace string, options Options) (component.ContentResponse, error)
- func (csd *CRDSection) PathFilters() []PathFilter
- func (csd *CRDSection) Remove(name string)
- func (csd *CRDSection) Reset(ctx context.Context) error
- type DefaultCRDWatcher
- type Describer
- type List
- type ListConfig
- type LoaderFunc
- type Object
- type ObjectConfig
- type ObjectLoaderFactory
- type Options
- type PathFilter
- type PathMatcher
- type Resource
- type ResourceOptions
- type ResourceTitle
- type Section
- func (d *Section) Component(ctx context.Context, namespace string, options Options) (*component.List, error)
- func (d *Section) Describe(ctx context.Context, namespace string, options Options) (component.ContentResponse, error)
- func (d *Section) PathFilters() []PathFilter
- func (d *Section) Reset(ctx context.Context) error
- type StubDescriber
Constants ¶
const (
ResourceNameRegex = "(?P<name>.*?)"
)
Variables ¶
var (
ErrPathNotFound = errors.New("path not found")
)
Functions ¶
func AddCRD ¶
func AddCRD(ctx context.Context, crd *unstructured.Unstructured, pm *PathMatcher, crdSection *CRDSection, m module.Module)
func CustomResourceDefinition ¶
func CustomResourceDefinition(ctx context.Context, name string, o store.Store) (*apiextv1beta1.CustomResourceDefinition, error)
func DeleteCRD ¶
func DeleteCRD(ctx context.Context, crd *unstructured.Unstructured, pm *PathMatcher, crdSection *CRDSection, m module.Module, s store.Store)
func ListCustomResources ¶
func ListCustomResources( ctx context.Context, crd *apiextv1beta1.CustomResourceDefinition, namespace string, o store.Store, selector *labels.Set) (*unstructured.UnstructuredList, bool, error)
func LoadObject ¶
func LoadObject(ctx context.Context, objectStore store.Store, errorStore internalErr.ErrorStore, namespace string, fields map[string]string, objectStoreKey store.Key) (*unstructured.Unstructured, error)
loadObject loads a single object from the object store.
func LoadObjects ¶
func LoadObjects(ctx context.Context, objectStore store.Store, errorStore internalErr.ErrorStore, namespace string, fields map[string]string, objectStoreKeys []store.Key) (*unstructured.UnstructuredList, error)
loadObjects loads objects from the object store sorted by their name.
Types ¶
type CRDSection ¶
type CRDSection struct {
// contains filtered or unexported fields
}
func NamespacedCRD ¶ added in v0.8.0
func NamespacedCRD() *CRDSection
NamespacedCRD returns a describer for namespaces CRDs.
func NewCRDSection ¶
func NewCRDSection(p, title string) *CRDSection
func (*CRDSection) Add ¶
func (csd *CRDSection) Add(name string, describer Describer)
func (*CRDSection) Describe ¶
func (csd *CRDSection) Describe(ctx context.Context, namespace string, options Options) (component.ContentResponse, error)
func (*CRDSection) PathFilters ¶
func (csd *CRDSection) PathFilters() []PathFilter
func (*CRDSection) Remove ¶
func (csd *CRDSection) Remove(name string)
type DefaultCRDWatcher ¶
type DefaultCRDWatcher struct {
// contains filtered or unexported fields
}
DefaultCRDWatcher is the default CRD watcher.
func NewDefaultCRDWatcher ¶
func NewDefaultCRDWatcher(ctx context.Context, objectStore store.Store, errorStore internalErr.ErrorStore) (*DefaultCRDWatcher, error)
NewDefaultCRDWatcher creates an instance of DefaultCRDWatcher.
func (*DefaultCRDWatcher) Watch ¶
func (cw *DefaultCRDWatcher) Watch(ctx context.Context, watchConfig *config.CRDWatchConfig) error
Watch watches for CRDs given a configuration.
type Describer ¶
type Describer interface { Describe(ctx context.Context, namespace string, options Options) (component.ContentResponse, error) PathFilters() []PathFilter Reset(ctx context.Context) error }
Describer creates content.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List describes a list of objects.
func (*List) Describe ¶
func (d *List) Describe(ctx context.Context, namespace string, options Options) (component.ContentResponse, error)
Describe creates content.
func (*List) PathFilters ¶
func (d *List) PathFilters() []PathFilter
PathFilters returns path filters for this Describer.
type ListConfig ¶
type LoaderFunc ¶
type LoaderFunc func(ctx context.Context, o store.Store, namespace string, fields map[string]string) (*unstructured.Unstructured, error)
LoaderFunc loads an object from the object store.
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object describes an object.
func (*Object) Describe ¶
func (d *Object) Describe(ctx context.Context, namespace string, options Options) (component.ContentResponse, error)
Describe describes an object.
func (*Object) PathFilters ¶
func (d *Object) PathFilters() []PathFilter
type ObjectConfig ¶
type ObjectLoaderFactory ¶
type ObjectLoaderFactory struct {
// contains filtered or unexported fields
}
func NewObjectLoaderFactory ¶
func NewObjectLoaderFactory(dashConfig config.Dash) *ObjectLoaderFactory
func (*ObjectLoaderFactory) LoadObject ¶
func (f *ObjectLoaderFactory) LoadObject(ctx context.Context, namespace string, fields map[string]string, objectStoreKey store.Key) (*unstructured.Unstructured, error)
func (*ObjectLoaderFactory) LoadObjects ¶
func (f *ObjectLoaderFactory) LoadObjects(ctx context.Context, namespace string, fields map[string]string, objectStoreKeys []store.Key) (*unstructured.UnstructuredList, error)
type Options ¶
type Options struct { config.Dash Queryer queryer.Queryer Fields map[string]string Printer printer.Printer LabelSet *kLabels.Set Link link.Interface LoadObjects func(ctx context.Context, namespace string, fields map[string]string, objectStoreKeys []store.Key) (*unstructured.UnstructuredList, error) LoadObject func(ctx context.Context, namespace string, fields map[string]string, objectStoreKey store.Key) (*unstructured.Unstructured, error) }
Options provides options to describers
type PathFilter ¶
type PathFilter struct { Describer Describer // contains filtered or unexported fields }
func NewPathFilter ¶
func NewPathFilter(filterPath string, describer Describer) *PathFilter
NewPathFilter creates a path filter.
func (*PathFilter) Fields ¶
func (pf *PathFilter) Fields(contentPath string) map[string]string
Fields extracts parameters from the request path. In practice, this finds the field "name" for an object request.
func (*PathFilter) Match ¶
func (pf *PathFilter) Match(contentPath string) bool
Match matches a contentPath against the filter.
content paths look like:
/foo/bar /namespace/default /namespace/default/foo/bar /
func (*PathFilter) String ¶
func (pf *PathFilter) String() string
type PathMatcher ¶
func NewPathMatcher ¶
func NewPathMatcher(name string) *PathMatcher
func (*PathMatcher) Deregister ¶
func (pm *PathMatcher) Deregister(ctx context.Context, paths ...string)
func (*PathMatcher) Find ¶
func (pm *PathMatcher) Find(path string) (PathFilter, error)
func (*PathMatcher) Register ¶
func (pm *PathMatcher) Register(ctx context.Context, pf PathFilter)
type Resource ¶
type Resource struct { ResourceOptions // contains filtered or unexported fields }
func NewResource ¶
func NewResource(options ResourceOptions) *Resource
func (*Resource) PathFilters ¶
func (r *Resource) PathFilters() []PathFilter
type ResourceOptions ¶
type ResourceTitle ¶
type Section ¶
type Section struct {
// contains filtered or unexported fields
}
Section is a wrapper to combine content from multiple describers.
func NamespacedOverview ¶ added in v0.8.0
func NamespacedOverview() *Section
NamespacedObjects returns a describer for a namespaced overview.
func NewSection ¶
NewSection creates a Section.
func (*Section) Describe ¶
func (d *Section) Describe(ctx context.Context, namespace string, options Options) (component.ContentResponse, error)
Describe generates content.
func (*Section) PathFilters ¶
func (d *Section) PathFilters() []PathFilter
PathFilters returns path filters for the section.
type StubDescriber ¶
type StubDescriber struct {
// contains filtered or unexported fields
}
func NewEmptyDescriber ¶
func NewEmptyDescriber(p string) *StubDescriber
func NewStubDescriber ¶
func NewStubDescriber(p string, components ...component.Component) *StubDescriber
func (*StubDescriber) Describe ¶
func (d *StubDescriber) Describe(context.Context, string, Options) (component.ContentResponse, error)
func (*StubDescriber) PathFilters ¶
func (d *StubDescriber) PathFilters() []PathFilter