module

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: Apache-2.0 Imports: 14 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) ClientRequestHandlers added in v0.7.0

func (m *Manager) ClientRequestHandlers() []octant.ClientRequestHandler

ClientRequestHandlers returns client request handlers for all modules.

func (*Manager) GetNamespace

func (m *Manager) GetNamespace() string

GetNamespace gets the current namespace.

func (*Manager) ModuleForContentPath added in v0.7.0

func (m *Manager) ModuleForContentPath(contentPath string) (Module, bool)

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) 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

	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 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

	// ResetCRDs removes all CRDs this module is responsible for.
	ResetCRDs(ctx context.Context) 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