Documentation
¶
Index ¶
- type ActionReceiver
- type ActionRegistrar
- type ContentOptions
- type Manager
- func (m *Manager) ClientRequestHandlers() []octant.ClientRequestHandler
- func (m *Manager) GetNamespace() string
- func (m *Manager) ModuleForContentPath(contentPath string) (Module, bool)
- func (m *Manager) Modules() []Module
- func (m *Manager) ObjectPath(namespace, apiVersion, kind, name string) (string, error)
- func (m *Manager) Register(mod Module) error
- func (m *Manager) SetNamespace(namespace string)
- func (m *Manager) Unload()
- func (m *Manager) UpdateContext(ctx context.Context, contextName string) error
- type ManagerInterface
- type Module
- type MuxRoute
- type MuxRouter
- type Route
- type Router
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 ¶
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) ClientRequestHandlers ¶ added in v0.7.0
func (m *Manager) ClientRequestHandlers() []octant.ClientRequestHandler
ClientRequestHandlers returns client request handlers for all modules.
func (*Manager) GetNamespace ¶
GetNamespace gets the current namespace.
func (*Manager) ModuleForContentPath ¶ added in v0.7.0
func (*Manager) ObjectPath ¶
func (*Manager) SetNamespace ¶
SetNamespace sets the current namespace.
type ManagerInterface ¶
type ManagerInterface interface {
Modules() []Module
Register(mod Module) error
SetNamespace(namespace string)
GetNamespace() string
UpdateContext(ctx context.Context, contextName string) error
ModuleForContentPath(contentPath string) (Module, bool)
ClientRequestHandlers() []octant.ClientRequestHandler
ObjectPath(namespace, apiVersion, kind, name string) (string, error)
}
ManagerInterface is an interface for managing module lifecycle.
type Module ¶
type Module interface {
// Name is the name of the module.
Name() string
// ClientRequestHandlers are handlers for handling client requests.
ClientRequestHandlers() []octant.ClientRequestHandler
// Content generates content for a path.
Content(ctx context.Context, contentPath string, opts ContentOptions) (component.ContentResponse, error)
// ContentPath will be used to construct content paths.
ContentPath() string
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
// ResetCRDs removes all CRDs this module is responsible for.
ResetCRDs(ctx context.Context) error
}
Module is an octant plugin.
type MuxRoute ¶
func (MuxRoute) HandlerFunc ¶
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.
Click to show internal directories.
Click to hide internal directories.