api

package
v0.5.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, message string, logger log.Logger)

RespondWithError responds with an error message.

Types

type API

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

API is the API for the dashboard client

func New

func New(ctx context.Context, prefix string, clusterClient ClusterClient, moduleManager module.ManagerInterface, actionDispatcher ActionDispatcher, logger log.Logger) *API

New creates an instance of API.

func (*API) ForceUpdate

func (a *API) ForceUpdate() error

func (*API) Handler

func (a *API) Handler(ctx context.Context) (*mux.Router, error)

Handler returns a HTTP handler for the service.

func (*API) RegisterModule

func (a *API) RegisterModule(m module.Module) error

RegisterModule registers a module with the API service.

type ActionDispatcher

type ActionDispatcher interface {
	Dispatch(ctx context.Context, actionName string, payload action.Payload) error
}

type ClusterClient

type ClusterClient interface {
	NamespaceClient() (cluster.NamespaceInterface, error)
	InfoClient() (cluster.InfoInterface, error)
}

type NotFoundError

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

NotFoundError is a not found error.

func NewNotFoundError

func NewNotFoundError(path string) *NotFoundError

NewNotFoundError creates an instance of NotFoundError

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error returns the error string.

func (*NotFoundError) NotFound

func (e *NotFoundError) NotFound() bool

NotFound returns true to signify this is a not found error.

func (*NotFoundError) Path

func (e *NotFoundError) Path() string

Path is the path of the error.

type Service

type Service interface {
	RegisterModule(module.Module) error
	Handler(ctx context.Context) (*mux.Router, error)
	ForceUpdate() error
}

Service is an API service.

Jump to

Keyboard shortcuts

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