service

package
v0.0.0-...-389e7ce Latest Latest
Warning

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

Go to latest
Published: Sep 28, 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 ActionRequest

type ActionRequest struct {
	DashboardClient Dashboard
	Payload         action.Payload
	// contains filtered or unexported fields
}

ActionRequest is a request for actions.

func (*ActionRequest) Context

func (r *ActionRequest) Context() context.Context

func (*ActionRequest) GeneratePath

func (r *ActionRequest) GeneratePath(pathParts ...string) string

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

func NewDashboardClient(dashboardAPIAddress string) (Dashboard, error)

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

func (p *Handler) HandleAction(ctx context.Context, payload action.Payload) error

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.

func (*Handler) Print

func (p *Handler) Print(ctx context.Context, object runtime.Object) (plugin.PrintResponse, error)

Print prints components for an object.

func (*Handler) PrintTab

func (p *Handler) PrintTab(ctx context.Context, object runtime.Object) (plugin.TabResponse, error)

PrintTab prints a tab for an object.

func (*Handler) Register

func (p *Handler) Register(ctx context.Context, dashboardAPIAddress string) (plugin.Metadata, error)

Register registers a plugin with Octant.

func (*Handler) Validate

func (p *Handler) Validate() error

Validate validates Handler.

type HandlerActionFunc

type HandlerActionFunc func(request *ActionRequest) error

type HandlerFuncs

type HandlerFuncs struct {
	Print        HandlerPrinterFunc
	PrintTab     HandlerTabPrintFunc
	ObjectStatus HandlerObjectStatusFunc
	HandleAction HandlerActionFunc
	Navigation   HandlerNavigationFunc
	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 struct {
	DashboardClient Dashboard
	// contains filtered or unexported fields
}

NavigationRequest is a request for navigation.

func (r *NavigationRequest) Context() context.Context
func (r *NavigationRequest) GeneratePath(pathParts ...string) string

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.

func (*Plugin) Serve

func (p *Plugin) Serve()

Serve serves a plugin.

func (*Plugin) Validate

func (p *Plugin) Validate() error

Validate validates this helper.

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

func (r *PrintRequest) Context() context.Context

func (*PrintRequest) GeneratePath

func (r *PrintRequest) GeneratePath(pathParts ...string) string

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

func (r *Request) Context() context.Context

func (*Request) DashboardClient

func (r *Request) DashboardClient() Dashboard

DashboardClient returns a dashboard client for the request.

func (*Request) GeneratePath

func (r *Request) GeneratePath(pathParts ...string) string

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 NewRouter

func NewRouter() *Router

NewRouter creates a Router.

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.

func (*Router) Match

func (r *Router) Match(contentPath string) (HandleFunc, bool)

Match matches a path against a exiting route. If no route is found, it will return false in the second return value.

Jump to

Keyboard shortcuts

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