Documentation
¶
Index ¶
- Variables
- func CreateAlertUpdate(alert action.Alert) event.Event
- func CreateFiltersUpdate(filters []octant.Filter) event.Event
- type WebsocketClient
- func (c *WebsocketClient) Handlers() map[string][]octant.ClientRequestHandler
- func (c *WebsocketClient) ID() string
- func (c *WebsocketClient) Receive() (api.StreamRequest, error)
- func (c *WebsocketClient) RegisterHandler(handler octant.ClientRequestHandler)
- func (c *WebsocketClient) Send(ev event.Event)
- func (c *WebsocketClient) State() octant.State
- func (c *WebsocketClient) StopCh() <-chan struct{}
- type WebsocketConnectionFactory
- func (wcf *WebsocketConnectionFactory) NewConnection(w http.ResponseWriter, r *http.Request, m api.ClientManager, ...) (api.StreamingClient, context.CancelFunc, error)
- func (wcf *WebsocketConnectionFactory) NewTemporaryConnection(w http.ResponseWriter, r *http.Request, m api.ClientManager) (api.StreamingClient, context.CancelFunc, error)
- type WebsocketState
- func (c *WebsocketState) AddFilter(filter octant.Filter)
- func (c *WebsocketState) Dispatch(ctx context.Context, actionName string, payload action.Payload) error
- func (c *WebsocketState) GetClientID() string
- func (c *WebsocketState) GetContentPath() string
- func (c *WebsocketState) GetFilters() []octant.Filter
- func (c *WebsocketState) GetNamespace() string
- func (c *WebsocketState) GetQueryParams() map[string][]string
- func (c *WebsocketState) Handlers() []octant.ClientRequestHandler
- func (c *WebsocketState) OnContentPathUpdate(fn octant.ContentPathUpdateFunc) octant.UpdateCancelFunc
- func (c *WebsocketState) OnNamespaceUpdate(fn octant.NamespaceUpdateFunc) octant.UpdateCancelFunc
- func (c *WebsocketState) RemoveFilter(filter octant.Filter)
- func (c *WebsocketState) SendAlert(alert action.Alert)
- func (c *WebsocketState) SetContentPath(contentPath string)
- func (c *WebsocketState) SetContext(requestedContext string)
- func (c *WebsocketState) SetFilters(filters []octant.Filter)
- func (c *WebsocketState) SetNamespace(namespace string)
- func (c *WebsocketState) Start(ctx context.Context)
- type WebsocketStateOption
Constants ¶
This section is empty.
Variables ¶
var DefaultWebsocketUpgrader = websocket.Upgrader{ ReadBufferSize: 1024, WriteBufferSize: 1024, CheckOrigin: func(r *http.Request) bool { host, _, err := net.SplitHostPort(r.RemoteAddr) if err != nil { return false } return internalAPI.ShouldAllowHost(host, internalAPI.AcceptedHosts()) }, }
Functions ¶
func CreateAlertUpdate ¶
CreateAlertUpdate creates an alert update event.
Types ¶
type WebsocketClient ¶
type WebsocketClient struct {
// contains filtered or unexported fields
}
WebsocketClient manages websocket clients.
func NewTemporaryWebsocketClient ¶
func NewTemporaryWebsocketClient(ctx context.Context, conn *websocket.Conn, manager api.ClientManager, actionDispatcher api.ActionDispatcher, id uuid.UUID) *WebsocketClient
NewTemporaryWebsocketClient creates an instance of WebsocketClient
func NewWebsocketClient ¶
func NewWebsocketClient(ctx context.Context, conn *websocket.Conn, manager api.ClientManager, dashConfig config.Dash, actionDispatcher api.ActionDispatcher, id uuid.UUID) *WebsocketClient
NewWebsocketClient creates an instance of WebsocketClient.
func (*WebsocketClient) Handlers ¶
func (c *WebsocketClient) Handlers() map[string][]octant.ClientRequestHandler
func (*WebsocketClient) ID ¶
func (c *WebsocketClient) ID() string
ID returns the ID of the websocket client.
func (*WebsocketClient) Receive ¶
func (c *WebsocketClient) Receive() (api.StreamRequest, error)
func (*WebsocketClient) RegisterHandler ¶
func (c *WebsocketClient) RegisterHandler(handler octant.ClientRequestHandler)
func (*WebsocketClient) Send ¶
func (c *WebsocketClient) Send(ev event.Event)
func (*WebsocketClient) State ¶
func (c *WebsocketClient) State() octant.State
func (*WebsocketClient) StopCh ¶
func (c *WebsocketClient) StopCh() <-chan struct{}
StopCh returns the client's stop channel. It will be closed when the WebsocketClient is closed.
type WebsocketConnectionFactory ¶
type WebsocketConnectionFactory struct {
// contains filtered or unexported fields
}
func NewWebsocketConnectionFactory ¶
func NewWebsocketConnectionFactory() *WebsocketConnectionFactory
func (*WebsocketConnectionFactory) NewConnection ¶
func (wcf *WebsocketConnectionFactory) NewConnection( w http.ResponseWriter, r *http.Request, m api.ClientManager, dashConfig config.Dash, ) (api.StreamingClient, context.CancelFunc, error)
func (*WebsocketConnectionFactory) NewTemporaryConnection ¶
func (wcf *WebsocketConnectionFactory) NewTemporaryConnection( w http.ResponseWriter, r *http.Request, m api.ClientManager, ) (api.StreamingClient, context.CancelFunc, error)
type WebsocketState ¶
type WebsocketState struct {
// contains filtered or unexported fields
}
WebsocketState manages state for a websocket client.
func NewTemporaryWebsocketState ¶
func NewTemporaryWebsocketState(actionDispatcher api.ActionDispatcher, wsClient api.OctantClient, options ...WebsocketStateOption) *WebsocketState
func NewWebsocketState ¶
func NewWebsocketState(dashConfig config.Dash, actionDispatcher api.ActionDispatcher, wsClient api.OctantClient, options ...WebsocketStateOption) *WebsocketState
NewWebsocketState creates an instance of WebsocketState.
func (*WebsocketState) AddFilter ¶
func (c *WebsocketState) AddFilter(filter octant.Filter)
AddFilter adds a content filter.
func (*WebsocketState) Dispatch ¶
func (c *WebsocketState) Dispatch(ctx context.Context, actionName string, payload action.Payload) error
Dispatch dispatches a message.
func (*WebsocketState) GetClientID ¶
func (c *WebsocketState) GetClientID() string
func (*WebsocketState) GetContentPath ¶
func (c *WebsocketState) GetContentPath() string
GetContentPath returns the content path.
func (*WebsocketState) GetFilters ¶
func (c *WebsocketState) GetFilters() []octant.Filter
GetFilters returns all filters.
func (*WebsocketState) GetNamespace ¶
func (c *WebsocketState) GetNamespace() string
GetNamespace gets the namespace.
func (*WebsocketState) GetQueryParams ¶
func (c *WebsocketState) GetQueryParams() map[string][]string
func (*WebsocketState) Handlers ¶
func (c *WebsocketState) Handlers() []octant.ClientRequestHandler
Handlers returns all the handlers for WebsocketState.
func (*WebsocketState) OnContentPathUpdate ¶
func (c *WebsocketState) OnContentPathUpdate(fn octant.ContentPathUpdateFunc) octant.UpdateCancelFunc
OnContentPathUpdate registers a function that will be called when the content path changes.
func (*WebsocketState) OnNamespaceUpdate ¶
func (c *WebsocketState) OnNamespaceUpdate(fn octant.NamespaceUpdateFunc) octant.UpdateCancelFunc
OnNamespaceUpdate registers a function that will be run when the namespace changes.
func (*WebsocketState) RemoveFilter ¶
func (c *WebsocketState) RemoveFilter(filter octant.Filter)
RemoveFilter removes a content filter.
func (*WebsocketState) SendAlert ¶
func (c *WebsocketState) SendAlert(alert action.Alert)
SendAlert sends an alert to the websocket client.
func (*WebsocketState) SetContentPath ¶
func (c *WebsocketState) SetContentPath(contentPath string)
SetContentPath sets the content path.
func (*WebsocketState) SetContext ¶
func (c *WebsocketState) SetContext(requestedContext string)
SetContext sets the Kubernetes context.
func (*WebsocketState) SetFilters ¶
func (c *WebsocketState) SetFilters(filters []octant.Filter)
func (*WebsocketState) SetNamespace ¶
func (c *WebsocketState) SetNamespace(namespace string)
SetNamespace sets the namespace.
func (*WebsocketState) Start ¶
func (c *WebsocketState) Start(ctx context.Context)
Start starts WebsocketState by starting all associated StateManagers.
type WebsocketStateOption ¶
type WebsocketStateOption func(w *WebsocketState)
WebsocketStateOption is an option for configuring WebsocketState.
func WebsocketStateManagers ¶
func WebsocketStateManagers(managers []api.StateManager) WebsocketStateOption
WebsocketStateManagers configures WebsocketState's state managers.