api

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const MaxMessageSize int = 1024 * 1024 * 16

Variables

This section is empty.

Functions

func NewGRPCServer added in v0.14.0

func NewGRPCServer(service Service) *grpcServer

Types

type API

type API interface {
	// Addr is the address of the API service.
	Addr() string
	// Start starts the API. To stop the API, cancel the context.
	Start(context.Context) error
}

API controls the dashboard API service.

func New

func New(service Service) (API, error)

New creates a new API instance for DashService.

type Client

type Client struct {
	DashboardConnection DashboardConnection
}

Client is a dashboard service API client.

func NewClient

func NewClient(address string, options ...ClientOption) (*Client, error)

NewClient creates an instance of the API client. It requires the address of the API.

func (*Client) ApplyYAML added in v0.24.0

func (c *Client) ApplyYAML(ctx context.Context, namespace, yaml string) ([]string, error)

ApplyYAML creates or updates resource(s) based on input yaml string.

func (*Client) CancelPortForward

func (c *Client) CancelPortForward(ctx context.Context, id string)

CancelPortForward cancels a port forward.

func (*Client) Close

func (c *Client) Close() error

Close closes the client's connection.

func (*Client) Create added in v0.12.0

func (c *Client) Create(ctx context.Context, object *unstructured.Unstructured) error
func (c *Client) CreateLink(ctx context.Context, key store.Key) (LinkResponse, error)

func (*Client) Delete added in v0.19.0

func (c *Client) Delete(ctx context.Context, key store.Key) error

Delete deletes an object from the dashboard's objectStore.

func (*Client) ForceFrontendUpdate

func (c *Client) ForceFrontendUpdate(ctx context.Context) error

ForceFrontendUpdate forces the frontend to update itself.

func (*Client) Get

Get retrieves an object from the dashboard's objectStore.

func (*Client) List

List lists objects in the dashboard's object store.

func (*Client) ListNamespaces added in v0.11.0

func (c *Client) ListNamespaces(ctx context.Context) (NamespacesResponse, error)

ListNamespaces lists namespaces.

func (*Client) PortForward

func (c *Client) PortForward(ctx context.Context, req PortForwardRequest) (PortForwardResponse, error)

PortForward creates a port forward.

func (*Client) SendAlert added in v0.16.0

func (c *Client) SendAlert(ctx context.Context, clientID string, alert action.Alert) error

SendAlert sends an alert

func (*Client) SendEvent added in v0.23.0

func (c *Client) SendEvent(ctx context.Context, clientID string, eventName event.EventType, payload action.Payload) error

SendEvent sends an event

func (*Client) Update

func (c *Client) Update(ctx context.Context, object *unstructured.Unstructured) error

Update updates an object in the store.

type ClientOption

type ClientOption func(c *Client)

type DashboardConnection

type DashboardConnection interface {
	Close() error
	Client() proto.DashboardClient
}

type DashboardMetadataKey added in v0.18.0

type DashboardMetadataKey string

DashboardMetadataKey is a type used for metadata keys passed by plugins

type FrontendProxy

type FrontendProxy struct {
	FrontendUpdateController FrontendUpdateController
}

FrontendProxy is a proxy for messaging the frontend.

func (*FrontendProxy) ForceFrontendUpdate

func (proxy *FrontendProxy) ForceFrontendUpdate() error

ForceFrontendUpdate forces the frontend to update

type FrontendUpdateController

type FrontendUpdateController interface {
	ForceUpdate() error
}

FrontendUpdateController can control the frontend. ie. the web gui

type GRPCService

type GRPCService struct {
	ObjectStore            store.Store
	PortForwarder          portforward.PortForwarder
	FrontendProxy          FrontendProxy
	NamespaceInterface     cluster.NamespaceInterface
	WebsocketClientManager event.WSClientGetter
	LinkGenerator          octant.LinkGenerator
}

GRPCService is an implementation of the dashboard service based on GRPC.

func (*GRPCService) ApplyYAML added in v0.24.0

func (s *GRPCService) ApplyYAML(ctx context.Context, namespace, yaml string) ([]string, error)

func (*GRPCService) CancelPortForward

func (s *GRPCService) CancelPortForward(ctx context.Context, id string)

CancelPortForward cancels a port forward

func (*GRPCService) Create added in v0.12.0

func (s *GRPCService) Create(ctx context.Context, object *unstructured.Unstructured) error
func (s *GRPCService) CreateLink(_ context.Context, key store.Key) (LinkResponse, error)

func (*GRPCService) Delete added in v0.19.0

func (s *GRPCService) Delete(ctx context.Context, key store.Key) error

func (*GRPCService) ForceFrontendUpdate

func (s *GRPCService) ForceFrontendUpdate(ctx context.Context) error

func (*GRPCService) Get

Get retrieves an object.

func (*GRPCService) List

List lists objects.

func (*GRPCService) ListNamespaces added in v0.11.0

func (s *GRPCService) ListNamespaces(ctx context.Context) (NamespacesResponse, error)

ListNamespaces lists namespaces

func (*GRPCService) PortForward

PortForward creates a port forward.

func (*GRPCService) SendAlert added in v0.16.0

func (s *GRPCService) SendAlert(ctx context.Context, clientID string, alert action.Alert) error

SendAlert sends an alert. This method is deprecated and will be removed in a future release

func (*GRPCService) SendEvent added in v0.23.0

func (s *GRPCService) SendEvent(ctx context.Context, clientID string, eventName event.EventType, payload action.Payload) error

func (*GRPCService) Update

func (s *GRPCService) Update(ctx context.Context, object *unstructured.Unstructured) error

type LinkResponse added in v0.19.0

type LinkResponse struct {
	Link component.Link
}

type NamespacesResponse added in v0.11.0

type NamespacesResponse struct {
	Namespaces []string
}

NamespacesResponse is a response from listing namespaces

type PortForwardRequest

type PortForwardRequest struct {
	Namespace     string
	PodName       string
	ContainerName string
	Port          uint16
}

PortForwardRequest describes a port forward request.

type PortForwardResponse

type PortForwardResponse struct {
	ID   string
	Port uint16
}

PortForwardResponse is the response from a port forward request.

type Service

type Service interface {
	List(ctx context.Context, key store.Key) (*unstructured.UnstructuredList, error)
	Get(ctx context.Context, key store.Key) (*unstructured.Unstructured, error)
	PortForward(ctx context.Context, req PortForwardRequest) (PortForwardResponse, error)
	CancelPortForward(ctx context.Context, id string)
	ListNamespaces(ctx context.Context) (NamespacesResponse, error)
	Update(ctx context.Context, object *unstructured.Unstructured) error
	Create(ctx context.Context, object *unstructured.Unstructured) error
	ApplyYAML(ctx context.Context, namespace, yaml string) ([]string, error)
	Delete(ctx context.Context, key store.Key) error
	ForceFrontendUpdate(ctx context.Context) error
	SendAlert(ctx context.Context, clientID string, alert action.Alert) error
	CreateLink(ctx context.Context, key store.Key) (LinkResponse, error)
	SendEvent(ctx context.Context, clientID string, eventName event.EventType, payload action.Payload) error
}

Service is the dashboard service.

Directories

Path Synopsis
Package fake is a generated GoMock package.
Package fake is a generated GoMock package.

Jump to

Keyboard shortcuts

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