Documentation ¶
Index ¶
- type ActionRequest
- type Dashboard
- type HandleFunc
- type Handler
- func (p *Handler) Content(ctx context.Context, contentPath string) (component.ContentResponse, error)
- func (p *Handler) HandleAction(ctx context.Context, payload action.Payload) error
- func (p *Handler) Navigation(ctx context.Context) (navigation.Navigation, error)
- func (p *Handler) ObjectStatus(ctx context.Context, object runtime.Object) (plugin.ObjectStatusResponse, error)
- func (p *Handler) Print(ctx context.Context, object runtime.Object) (plugin.PrintResponse, error)
- func (p *Handler) PrintTab(ctx context.Context, object runtime.Object) (plugin.TabResponse, error)
- func (p *Handler) Register(ctx context.Context, dashboardAPIAddress string) (plugin.Metadata, error)
- func (p *Handler) Validate() error
- type HandlerActionFunc
- type HandlerFuncs
- type HandlerInitRoutesFunc
- type HandlerNavigationFunc
- type HandlerObjectStatusFunc
- type HandlerPrinterFunc
- type HandlerTabPrintFunc
- type NavigationRequest
- type Plugin
- type PluginOption
- func WithActionHandler(fn HandlerActionFunc) PluginOption
- func WithNavigation(fn HandlerNavigationFunc, routerInit HandlerInitRoutesFunc) PluginOption
- func WithObjectStatus(fn HandlerObjectStatusFunc) PluginOption
- func WithPrinter(fn HandlerPrinterFunc) PluginOption
- func WithTabPrinter(fn HandlerTabPrintFunc) PluginOption
- type PrintRequest
- type Request
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionRequest ¶
type ActionRequest struct { DashboardClient Dashboard Payload action.Payload // contains filtered or unexported fields }
ActionRequest is a request for actions.
func (*ActionRequest) GeneratePath ¶
type Dashboard ¶
type Dashboard interface { Close() error List(ctx context.Context, key store.Key) (*unstructured.UnstructuredList, error) Get(ctx context.Context, key store.Key) (*unstructured.Unstructured, bool, error) Update(ctx context.Context, object *unstructured.Unstructured) error PortForward(ctx context.Context, req api.PortForwardRequest) (api.PortForwardResponse, error) CancelPortForward(ctx context.Context, id string) ForceFrontendUpdate(ctx context.Context) error }
Dashboard is the client a plugin can use to interact with Octant.
func NewDashboardClient ¶
NewDashboardClient creates a dashboard client.
type HandleFunc ¶
type HandleFunc func(request *Request) (component.ContentResponse, error)
HandleFunc is a function that generates a content response.
type Handler ¶
type Handler struct { HandlerFuncs // contains filtered or unexported fields }
Handler is the plugin service helper handler. Functions on this struct are called from Octant.
func (*Handler) Content ¶
func (p *Handler) Content(ctx context.Context, contentPath string) (component.ContentResponse, error)
Content creates content for a given content path.
func (*Handler) HandleAction ¶
HandleAction handles actions given a payload.
func (*Handler) Navigation ¶
func (p *Handler) Navigation(ctx context.Context) (navigation.Navigation, error)
Navigation creates navigation.
func (*Handler) ObjectStatus ¶
func (p *Handler) ObjectStatus(ctx context.Context, object runtime.Object) (plugin.ObjectStatusResponse, error)
ObjectStatus creates status for an object.
type HandlerActionFunc ¶
type HandlerActionFunc func(request *ActionRequest) error
type HandlerFuncs ¶
type HandlerFuncs struct { Print HandlerPrinterFunc PrintTab HandlerTabPrintFunc ObjectStatus HandlerObjectStatusFunc HandleAction HandlerActionFunc InitRoutes HandlerInitRoutesFunc }
HandlerFuncs are functions for configuring a plugin.
type HandlerInitRoutesFunc ¶
type HandlerInitRoutesFunc func(router *Router)
type HandlerNavigationFunc ¶
type HandlerNavigationFunc func(request *NavigationRequest) (navigation.Navigation, error)
type HandlerObjectStatusFunc ¶
type HandlerObjectStatusFunc func(request *PrintRequest) (plugin.ObjectStatusResponse, error)
type HandlerPrinterFunc ¶
type HandlerPrinterFunc func(request *PrintRequest) (plugin.PrintResponse, error)
type HandlerTabPrintFunc ¶
type HandlerTabPrintFunc func(request *PrintRequest) (plugin.TabResponse, error)
type NavigationRequest ¶
type NavigationRequest struct { // contains filtered or unexported fields }
NavigationRequest is a request for navigation.
func (*NavigationRequest) GeneratePath ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is a plugin service helper.
func Register ¶
func Register(name, description string, capabilities *plugin.Capabilities, options ...PluginOption) (*Plugin, error)
Register registers a plugin with Octant.
type PluginOption ¶
type PluginOption func(p *Plugin)
PluginOption is an option for configuring Plugin.
func WithActionHandler ¶
func WithActionHandler(fn HandlerActionFunc) PluginOption
WithActionHandler configures the plugin to handle actions.
func WithNavigation ¶
func WithNavigation(fn HandlerNavigationFunc, routerInit HandlerInitRoutesFunc) PluginOption
WithNavigation configures the plugin to handle navigation and routes.
func WithObjectStatus ¶
func WithObjectStatus(fn HandlerObjectStatusFunc) PluginOption
WithObjectStatus configures the plugin to supply object status.
func WithPrinter ¶
func WithPrinter(fn HandlerPrinterFunc) PluginOption
WithPrinter configures the plugin to have a printer.
func WithTabPrinter ¶
func WithTabPrinter(fn HandlerTabPrintFunc) PluginOption
WithTabPrinter configures the plugin to have a tab printer.
type PrintRequest ¶
type PrintRequest struct { DashboardClient Dashboard Object runtime.Object // contains filtered or unexported fields }
PrintRequest is a request for printing.
func (*PrintRequest) GeneratePath ¶
type Request ¶
type Request struct { // Path is path that Octant is requesting. It is scoped to the plugin. // i.e. If Octant wants to render /content/plugin/foo, Path will be // `/foo`. Path string // contains filtered or unexported fields }
Request represents a path request from Octant. It will always be a GET style request with a path.
func (*Request) DashboardClient ¶
DashboardClient returns a dashboard client for the request.
func (*Request) GeneratePath ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a router for the plugin. A plugin can register a HandleFuncs to a path.
func (*Router) HandleFunc ¶
func (r *Router) HandleFunc(routePath string, handleFunc HandleFunc)
HandleFunc registers a HandleFunc to a path. Paths can contain globs. e.g `/*` will match `/foo` if an explicit `/foo` path (or glob) has not already been registered. Routes are evaluated in the order they were added.