server

package
v0.0.0-...-b4bb62b Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package server Skydive API

The Skydive REST API allows to communicate with a Skydive analyzer.

Schemes: http, https
Host: localhost:8082
BasePath: /api
Version: 0.28.0
License: Apache http://opensource.org/licenses/Apache-2.0
Contact: Skydive mailing list <skydive-dev@redhat.com>

Consumes:
- application/json

Produces:
- application/json
- text/plain

swagger:meta

Index

Constants

This section is empty.

Variables

View Source
var StaticWorkflows []*types.Workflow

StaticWorkflows holds a list of hardcoded workflows

Functions

func NewRuntime

func NewRuntime(g *graph.Graph, tr *traversal.GremlinTraversalParser, server *Server, assets assets.Assets) (*js.Runtime, error)

NewRuntime returns a new JavaScript runtime where accesses to resources are done directly using the handlers, not through HTTP requests.

func RegisterStatusAPI

func RegisterStatusAPI(s *shttp.Server, r StatusReporter, authBackend shttp.AuthenticationBackend)

RegisterStatusAPI registers the status API endpoint

func RegisterTopologyAPI

func RegisterTopologyAPI(r *shttp.Server, g *graph.Graph, parser *traversal.GremlinTraversalParser, authBackend shttp.AuthenticationBackend, extraMarshallers map[string]TopologyMarshaller)

RegisterTopologyAPI registers a new topology query API

Types

type AlertAPIHandler

type AlertAPIHandler struct {
	rest.BasicAPIHandler
}

AlertAPIHandler aims to exposes the Alert API.

func RegisterAlertAPI

func RegisterAlertAPI(apiServer *Server, authBackend shttp.AuthenticationBackend) *AlertAPIHandler

RegisterAlertAPI registers an Alert's API to a designated API Server

type AlertResourceHandler

type AlertResourceHandler struct {
	rest.ResourceHandler
}

AlertResourceHandler aims to creates and manage a new Alert.

func (*AlertResourceHandler) Name

func (a *AlertResourceHandler) Name() string

Name returns resource name "alert"

func (*AlertResourceHandler) New

New creates a new alert

type EdgeAPIHandler

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

EdgeAPIHandler aims to exposes the Alert API.

func RegisterEdgeAPI

func RegisterEdgeAPI(apiServer *Server, g *graph.Graph, authBackend shttp.AuthenticationBackend) *EdgeAPIHandler

RegisterEdgeAPI registers the edge API

func (*EdgeAPIHandler) Create

func (h *EdgeAPIHandler) Create(resource rest.Resource, createOpts *rest.CreateOptions) error

Create adds the specified edge to the graph

func (*EdgeAPIHandler) Decorate

func (h *EdgeAPIHandler) Decorate(resource rest.Resource)

Decorate the specified edge

func (*EdgeAPIHandler) Delete

func (h *EdgeAPIHandler) Delete(id string) error

Delete the edge with the specified id from the graph

func (*EdgeAPIHandler) Get

func (h *EdgeAPIHandler) Get(id string) (rest.Resource, bool)

Get returns a edge with the specified id

func (*EdgeAPIHandler) Index

func (h *EdgeAPIHandler) Index() map[string]rest.Resource

Index returns the list of existing edges

func (*EdgeAPIHandler) Name

func (h *EdgeAPIHandler) Name() string

Name returns resource name "edge"

func (*EdgeAPIHandler) New

func (h *EdgeAPIHandler) New() rest.Resource

New creates a new edge

func (*EdgeAPIHandler) Update

func (h *EdgeAPIHandler) Update(id string, resource rest.Resource) (rest.Resource, bool, error)

Update a edge metadata

type EdgeResourceHandler

type EdgeResourceHandler struct {
	rest.ResourceHandler
}

EdgeResourceHandler aims to creates and manage a new Alert.

type Info

type Info struct {
	// Server host ID
	Host string
	// API version
	Version string
	// Service type
	Service string
}

Info for each host describes his API version and service swagger:model

type NodeAPIHandler

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

NodeAPIHandler aims to exposes the Alert API.

func RegisterNodeAPI

func RegisterNodeAPI(apiServer *Server, g *graph.Graph, authBackend shttp.AuthenticationBackend) *NodeAPIHandler

RegisterNodeAPI registers the node API

func (*NodeAPIHandler) Create

func (h *NodeAPIHandler) Create(resource rest.Resource, createOpts *rest.CreateOptions) error

Create adds the specified node to the graph

func (*NodeAPIHandler) Decorate

func (h *NodeAPIHandler) Decorate(resource rest.Resource)

Decorate the specified node

func (*NodeAPIHandler) Delete

func (h *NodeAPIHandler) Delete(id string) error

Delete the node with the specified id from the graph

func (*NodeAPIHandler) Get

func (h *NodeAPIHandler) Get(id string) (rest.Resource, bool)

Get returns a node with the specified id

func (*NodeAPIHandler) Index

func (h *NodeAPIHandler) Index() map[string]rest.Resource

Index returns the list of existing nodes

func (*NodeAPIHandler) Name

func (h *NodeAPIHandler) Name() string

Name returns resource name "node"

func (*NodeAPIHandler) New

func (h *NodeAPIHandler) New() rest.Resource

New creates a new node

func (*NodeAPIHandler) Update

func (h *NodeAPIHandler) Update(id string, resource rest.Resource) (rest.Resource, bool, error)

Update a node metadata

type NodeResourceHandler

type NodeResourceHandler struct {
	rest.ResourceHandler
}

NodeResourceHandler aims to creates and manage a new Alert.

type ResourceNotFound

type ResourceNotFound struct {
	ID   string
	Type string
}

ResourceNotFound error generated when a resource does not exists

func (ResourceNotFound) Error

func (r ResourceNotFound) Error() string

type Server

type Server struct {
	HTTPServer *shttp.Server
	EtcdClient *etcdclient.Client
	// contains filtered or unexported fields
}

Server defines an API server

func NewAPI

func NewAPI(server *shttp.Server, etcdClient *etcdclient.Client, version, hostID string, kind service.Type, authBackend shttp.AuthenticationBackend, validator Validator) (*Server, error)

NewAPI creates a new API server based on http

func (*Server) GetHandler

func (a *Server) GetHandler(hname string) rest.Handler

GetHandler returns the hander named hname

func (*Server) RegisterAPIHandler

func (a *Server) RegisterAPIHandler(handler rest.Handler, authBackend shttp.AuthenticationBackend)

RegisterAPIHandler registers a new handler for an API

type StatusReporter

type StatusReporter interface {
	GetStatus() interface{}
}

StatusReporter is the interface to report the status of a service

type TopologyAPI

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

TopologyAPI exposes the topology query API

type TopologyMarshaller

type TopologyMarshaller func(traversal.GraphTraversalStep, io.Writer) error

TopologyMarshaller is used to output a gremlin step into a specific format

type TopologyMarshallers

type TopologyMarshallers map[string]TopologyMarshaller

TopologyMarshallers maps Accept headers to topology marshallers

type Validator

type Validator interface {
	Validate(string, interface{}) error
}

Validator is the interface to implement to validate REST resources

type WorkflowAPIHandler

type WorkflowAPIHandler struct {
	rest.BasicAPIHandler
	// contains filtered or unexported fields
}

WorkflowAPIHandler based on BasicAPIHandler

func RegisterWorkflowAPI

func RegisterWorkflowAPI(apiServer *Server, g *graph.Graph, parser *traversal.GremlinTraversalParser, authBackend shttp.AuthenticationBackend, runtime *js.Runtime) (*WorkflowAPIHandler, error)

RegisterWorkflowAPI registers a new workflow api handler

func (*WorkflowAPIHandler) Create

Create tests whether the resource is a duplicate or is unique

func (*WorkflowAPIHandler) Get

func (w *WorkflowAPIHandler) Get(id string) (rest.Resource, bool)

Get retrieves a workflow based on its id

func (*WorkflowAPIHandler) Index

func (w *WorkflowAPIHandler) Index() map[string]rest.Resource

Index returns a map of workflows indexed by id

type WorkflowResourceHandler

type WorkflowResourceHandler struct {
}

WorkflowResourceHandler describes a workflow resource handler

func (*WorkflowResourceHandler) Name

func (w *WorkflowResourceHandler) Name() string

Name return "workflow"

func (*WorkflowResourceHandler) New

New creates a new workflow resource

Jump to

Keyboard shortcuts

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