module

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionReceiver

type ActionReceiver interface {
	ActionPaths() map[string]action.DispatcherFunc
}

type ActionRegistrar

type ActionRegistrar interface {
	Register(actionPath string, actionFunc action.DispatcherFunc) error
}

type ContentOptions

type ContentOptions struct {
	LabelSet *labels.Set
}

ContentOptions are additional options for content generation

type Manager

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

Manager manages module lifecycle.

func NewManager

func NewManager(clusterClient cluster.ClientInterface, namespace string, actionRegistrar ActionRegistrar, logger log.Logger) (*Manager, error)

NewManager creates an instance of Manager.

func (*Manager) DeregisterObjectPath

func (m *Manager) DeregisterObjectPath(gvk schema.GroupVersionKind)

func (*Manager) GetNamespace

func (m *Manager) GetNamespace() string

GetNamespace gets the current namespace.

func (*Manager) Modules

func (m *Manager) Modules() []Module

Modules returns a list of modules.

func (*Manager) ObjectPath

func (m *Manager) ObjectPath(namespace, apiVersion, kind, name string) (string, error)

func (*Manager) Register

func (m *Manager) Register(mod Module) error

Register register a module with the manager.

func (*Manager) RegisterObjectPath

func (m *Manager) RegisterObjectPath(mod Module, gvk schema.GroupVersionKind)

func (*Manager) SetNamespace

func (m *Manager) SetNamespace(namespace string)

SetNamespace sets the current namespace.

func (*Manager) Unload

func (m *Manager) Unload()

Unload unloads modules.

func (*Manager) UpdateContext

func (m *Manager) UpdateContext(ctx context.Context, contextName string) error

type ManagerInterface

type ManagerInterface interface {
	Modules() []Module
	Register(mod Module) error
	SetNamespace(namespace string)
	GetNamespace() string
	UpdateContext(ctx context.Context, contextName string) error

	ObjectPath(namespace, apiVersion, kind, name string) (string, error)
	RegisterObjectPath(Module, schema.GroupVersionKind)
	DeregisterObjectPath(schema.GroupVersionKind)
}

ManagerInterface is an interface for managing module lifecycle.

type Module

type Module interface {
	// Name is the name of the module.
	Name() string
	// Handlers are additional handlers for the module
	Handlers(ctx context.Context) map[string]http.Handler
	// Content generates content for a path.
	Content(ctx context.Context, contentPath, prefix, namespace string, opts ContentOptions) (component.ContentResponse, error)
	// ContentPath will be used to construct content paths.
	ContentPath() string
	// Navigation returns navigation entries for this module.
	Navigation(ctx context.Context, namespace, root string) ([]navigation.Navigation, error)
	// SetNamespace is called when the current namespace changes.
	SetNamespace(namespace string) error
	// Start starts the module.
	Start() error
	// Stop stops the module.
	Stop()

	// SetContext sets the current context name.
	SetContext(ctx context.Context, contextName string) error

	// Generators allow modules to send events to the frontend.
	Generators() []octant.Generator

	// SupportedGroupVersionKind returns a slice of supported GVKs it owns.
	SupportedGroupVersionKind() []schema.GroupVersionKind

	// GroupVersionKindPath returns the path for an object . It will
	// return an error if it is unable to generate a path
	GroupVersionKindPath(namespace, apiVersion, kind, name string) (string, error)

	// AddCRD adds a CRD this module is responsible for.
	AddCRD(ctx context.Context, crd *unstructured.Unstructured) error

	// RemoveCRD removes a CRD this module was responsible for.
	RemoveCRD(ctx context.Context, crd *unstructured.Unstructured) error
}

Module is an octant plugin.

type MuxRoute

type MuxRoute struct {
	*mux.Route
}

func (MuxRoute) Handler

func (m MuxRoute) Handler(handler http.Handler) Route

func (MuxRoute) HandlerFunc

func (m MuxRoute) HandlerFunc(f func(http.ResponseWriter, *http.Request)) Route

func (MuxRoute) Methods

func (m MuxRoute) Methods(methods ...string) Route

func (MuxRoute) Subrouter

func (m MuxRoute) Subrouter() Router

type MuxRouter

type MuxRouter struct {
	*mux.Router
}

func (MuxRouter) Handle

func (m MuxRouter) Handle(path string, handler http.Handler) Route

func (MuxRouter) HandleFunc

func (m MuxRouter) HandleFunc(path string, f func(http.ResponseWriter, *http.Request)) Route

func (MuxRouter) PathPrefix

func (m MuxRouter) PathPrefix(path string) Route

type Route

type Route interface {
	Handler(handler http.Handler) Route
	HandlerFunc(f func(http.ResponseWriter, *http.Request)) Route
	Methods(methods ...string) Route
	Subrouter() Router
}

Route allows further tuning the matching of a route. Route is a subset of mux.Route.

type Router

type Router interface {
	Handle(path string, handler http.Handler) Route
	HandleFunc(path string, f func(http.ResponseWriter, *http.Request)) Route
	PathPrefix(path string) Route
}

Router allows registering handlers for a path pattern. Routes form a tree and subroutes can be registered. Route is a subset of mux.Router.

Jump to

Keyboard shortcuts

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