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.26.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 ¶
- Variables
- func NewWorkflowRuntime(g *graph.Graph, tr *traversal.GremlinTraversalParser, server *Server) (*js.Runtime, error)
- func RegisterConfigAPI(r *shttp.Server, authBackend shttp.AuthenticationBackend)
- func RegisterPcapAPI(r *shttp.Server, store storage.Storage, ...)
- func RegisterStatusAPI(s *shttp.Server, r StatusReporter, authBackend shttp.AuthenticationBackend)
- func RegisterTopologyAPI(r *shttp.Server, g *graph.Graph, parser *traversal.GremlinTraversalParser, ...)
- func RegisterWorkflowCallAPI(s *shttp.Server, authBackend shttp.AuthenticationBackend, apiServer *Server, ...) error
- type AlertAPIHandler
- type AlertResourceHandler
- type BasicAPIHandler
- func (h *BasicAPIHandler) AsyncWatch(f WatcherCallback) StoppableWatcher
- func (h *BasicAPIHandler) Create(resource types.Resource, createOpts *CreateOptions) error
- func (h *BasicAPIHandler) Decorate(resource types.Resource)
- func (h *BasicAPIHandler) Delete(id string) error
- func (h *BasicAPIHandler) Get(id string) (types.Resource, bool)
- func (h *BasicAPIHandler) Index() map[string]types.Resource
- func (h *BasicAPIHandler) Name() string
- func (h *BasicAPIHandler) New() types.Resource
- func (h *BasicAPIHandler) Unmarshal(b []byte) (resource types.Resource, err error)
- func (h *BasicAPIHandler) Update(id string, resource types.Resource) error
- type BasicStoppableWatcher
- type CaptureAPIHandler
- type CaptureResourceHandler
- type CreateOptions
- type EdgeRuleAPI
- type EdgeRuleResourceHandler
- type Handler
- type HandlerFunc
- type Info
- type NodeRuleAPI
- type NodeRuleResourceHandler
- type PacketInjectorAPI
- type PcapAPI
- type ResourceHandler
- type ResourceWatcher
- type Server
- type StatusReporter
- type StoppableWatcher
- type TopologyAPI
- type WatcherCallback
- type WorkflowAPIHandler
- type WorkflowCallAPIHandler
- type WorkflowResourceHandler
Constants ¶
This section is empty.
Variables ¶
var ErrDuplicatedResource = errors.New("Duplicated resource")
ErrDuplicatedResource is returned when a resource is duplicated
Functions ¶
func NewWorkflowRuntime ¶ added in v0.23.0
func NewWorkflowRuntime(g *graph.Graph, tr *traversal.GremlinTraversalParser, server *Server) (*js.Runtime, error)
NewWorkflowRuntime returns a new Workflow runtime
func RegisterConfigAPI ¶
func RegisterConfigAPI(r *shttp.Server, authBackend shttp.AuthenticationBackend)
RegisterConfigAPI registers a configuration endpoint (read only) in API server
func RegisterPcapAPI ¶
func RegisterPcapAPI(r *shttp.Server, store storage.Storage, authBackend shttp.AuthenticationBackend)
RegisterPcapAPI registers a new pcap injector API
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)
RegisterTopologyAPI registers a new topology query API
func RegisterWorkflowCallAPI ¶ added in v0.23.0
func RegisterWorkflowCallAPI(s *shttp.Server, authBackend shttp.AuthenticationBackend, apiServer *Server, g *graph.Graph, tr *traversal.GremlinTraversalParser) error
RegisterWorkflowCallAPI registers a new workflow call api handler
Types ¶
type AlertAPIHandler ¶
type AlertAPIHandler struct {
BasicAPIHandler
}
AlertAPIHandler aims to exposes the Alert API.
func RegisterAlertAPI ¶
func RegisterAlertAPI(apiServer *Server, authBackend shttp.AuthenticationBackend) (*AlertAPIHandler, error)
RegisterAlertAPI registers an Alert's API to a designated API Server
type AlertResourceHandler ¶
type AlertResourceHandler struct {
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 ¶
func (a *AlertResourceHandler) New() types.Resource
New creates a new alert
type BasicAPIHandler ¶
type BasicAPIHandler struct { ResourceHandler ResourceHandler EtcdKeyAPI etcd.KeysAPI }
BasicAPIHandler basic implementation of an Handler, should be used as embedded struct for the most part of the resource
func (*BasicAPIHandler) AsyncWatch ¶
func (h *BasicAPIHandler) AsyncWatch(f WatcherCallback) StoppableWatcher
AsyncWatch registers a new resource watcher
func (*BasicAPIHandler) Create ¶
func (h *BasicAPIHandler) Create(resource types.Resource, createOpts *CreateOptions) error
Create a new resource in Etcd
func (*BasicAPIHandler) Decorate ¶
func (h *BasicAPIHandler) Decorate(resource types.Resource)
Decorate the resource
func (*BasicAPIHandler) Delete ¶
func (h *BasicAPIHandler) Delete(id string) error
Delete a resource
func (*BasicAPIHandler) Get ¶
func (h *BasicAPIHandler) Get(id string) (types.Resource, bool)
Get a specific resource
func (*BasicAPIHandler) Index ¶
func (h *BasicAPIHandler) Index() map[string]types.Resource
Index returns the list of resource available in Etcd
func (*BasicAPIHandler) Name ¶
func (h *BasicAPIHandler) Name() string
Name returns the resource name
func (*BasicAPIHandler) New ¶
func (h *BasicAPIHandler) New() types.Resource
New creates a new resource
type BasicStoppableWatcher ¶
type BasicStoppableWatcher struct { StoppableWatcher // contains filtered or unexported fields }
BasicStoppableWatcher basic implementation of a resource watcher
func (*BasicStoppableWatcher) Stop ¶
func (s *BasicStoppableWatcher) Stop()
Stop the resource watcher
type CaptureAPIHandler ¶
type CaptureAPIHandler struct { BasicAPIHandler Graph *graph.Graph }
CaptureAPIHandler based on BasicAPIHandler
func RegisterCaptureAPI ¶
func RegisterCaptureAPI(apiServer *Server, g *graph.Graph, authBackend shttp.AuthenticationBackend) (*CaptureAPIHandler, error)
RegisterCaptureAPI registers an new resource, capture
func (*CaptureAPIHandler) Create ¶
func (c *CaptureAPIHandler) Create(r types.Resource, opts *CreateOptions) error
Create tests that resource GremlinQuery does not exists already
func (*CaptureAPIHandler) Decorate ¶
func (c *CaptureAPIHandler) Decorate(resource types.Resource)
Decorate populates the capture resource
type CaptureResourceHandler ¶
type CaptureResourceHandler struct {
ResourceHandler
}
CaptureResourceHandler describes a capture ressouce handler
func (*CaptureResourceHandler) Name ¶
func (c *CaptureResourceHandler) Name() string
Name returns "capture"
func (*CaptureResourceHandler) New ¶
func (c *CaptureResourceHandler) New() types.Resource
New creates a new capture resource
type CreateOptions ¶ added in v0.24.0
CreateOptions describes the available options when creating a resource
type EdgeRuleAPI ¶ added in v0.19.1
type EdgeRuleAPI struct { BasicAPIHandler Graph *graph.Graph }
EdgeRuleAPI based on BasicAPIHandler
func RegisterEdgeRuleAPI ¶ added in v0.19.1
func RegisterEdgeRuleAPI(apiServer *Server, g *graph.Graph, authBackend shttp.AuthenticationBackend) (*EdgeRuleAPI, error)
RegisterEdgeRuleAPI registers an EdgeRule's API to a designated API Server
type EdgeRuleResourceHandler ¶ added in v0.19.1
type EdgeRuleResourceHandler struct {
ResourceHandler
}
EdgeRuleResourceHandler describes a edge rule resource handler
func (*EdgeRuleResourceHandler) Name ¶ added in v0.19.1
func (erh *EdgeRuleResourceHandler) Name() string
Name returns resource name "edgerule"
func (*EdgeRuleResourceHandler) New ¶ added in v0.19.1
func (erh *EdgeRuleResourceHandler) New() types.Resource
New creates a new EdgeRule
type Handler ¶
type Handler interface { Name() string New() types.Resource Index() map[string]types.Resource Get(id string) (types.Resource, bool) Decorate(resource types.Resource) Create(resource types.Resource, createOpts *CreateOptions) error Delete(id string) error AsyncWatch(f WatcherCallback) StoppableWatcher }
Handler describes resources for each API
type HandlerFunc ¶
type HandlerFunc func(w http.ResponseWriter, r *http.Request)
HandlerFunc describes an http(s) router handler callback function
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 (agent or analyzer) swagger:model
type NodeRuleAPI ¶ added in v0.19.1
type NodeRuleAPI struct { BasicAPIHandler Graph *graph.Graph }
NodeRuleAPI based on BasicAPIHandler
func RegisterNodeRuleAPI ¶ added in v0.19.1
func RegisterNodeRuleAPI(apiServer *Server, g *graph.Graph, authBackend shttp.AuthenticationBackend) (*NodeRuleAPI, error)
RegisterNodeRuleAPI register a new node rule api handler
type NodeRuleResourceHandler ¶ added in v0.19.1
type NodeRuleResourceHandler struct {
ResourceHandler
}
NodeRuleResourceHandler describes a node resource handler
func (*NodeRuleResourceHandler) Name ¶ added in v0.19.1
func (nrh *NodeRuleResourceHandler) Name() string
Name returns resource name "noderule"
func (*NodeRuleResourceHandler) New ¶ added in v0.19.1
func (nrh *NodeRuleResourceHandler) New() types.Resource
New creates a new node rule
type PacketInjectorAPI ¶
type PacketInjectorAPI struct { BasicAPIHandler Graph *graph.Graph }
PacketInjectorAPI exposes the packet injector API
func RegisterPacketInjectorAPI ¶
func RegisterPacketInjectorAPI(g *graph.Graph, apiServer *Server, authBackend shttp.AuthenticationBackend) (*PacketInjectorAPI, error)
RegisterPacketInjectorAPI registers a new packet injector resource in the API
func (*PacketInjectorAPI) Create ¶
func (pi *PacketInjectorAPI) Create(r types.Resource, opts *CreateOptions) error
Create allocates a new packet injection
type PcapAPI ¶
PcapAPI exposes the pcap injector API
type ResourceHandler ¶
ResourceHandler aims to creates new resource of an API
type ResourceWatcher ¶
type ResourceWatcher interface {
AsyncWatch(f WatcherCallback) StoppableWatcher
}
ResourceWatcher asynchronous interface
type Server ¶
type Server struct { HTTPServer *shttp.Server EtcdKeyAPI etcd.KeysAPI // contains filtered or unexported fields }
Server object are created once for each ServiceType (agent or analyzer)
func NewAPI ¶
func NewAPI(server *shttp.Server, kapi etcd.KeysAPI, service common.Service, authBackend shttp.AuthenticationBackend) (*Server, error)
NewAPI creates a new API server based on http
func (*Server) GetHandler ¶
GetHandler returns the hander named hname
func (*Server) RegisterAPIHandler ¶
func (a *Server) RegisterAPIHandler(handler Handler, authBackend shttp.AuthenticationBackend) error
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 WatcherCallback ¶
WatcherCallback callback called by the resource watcher
type WorkflowAPIHandler ¶ added in v0.19.0
type WorkflowAPIHandler struct {
BasicAPIHandler
}
WorkflowAPIHandler based on BasicAPIHandler
func RegisterWorkflowAPI ¶ added in v0.19.0
func RegisterWorkflowAPI(apiServer *Server, authBackend shttp.AuthenticationBackend) (*WorkflowAPIHandler, error)
RegisterWorkflowAPI registers a new workflow api handler
func (*WorkflowAPIHandler) Create ¶ added in v0.19.0
func (w *WorkflowAPIHandler) Create(r types.Resource, opts *CreateOptions) error
Create tests whether the resource is a duplicate or is unique
type WorkflowCallAPIHandler ¶ added in v0.23.0
type WorkflowCallAPIHandler struct {
// contains filtered or unexported fields
}
WorkflowCallAPIHandler based on BasicAPIHandler
type WorkflowResourceHandler ¶ added in v0.19.0
type WorkflowResourceHandler struct { }
WorkflowResourceHandler describes a workflow resource handler
func (*WorkflowResourceHandler) Name ¶ added in v0.19.0
func (w *WorkflowResourceHandler) Name() string
Name return "workflow"
func (*WorkflowResourceHandler) New ¶ added in v0.19.0
func (w *WorkflowResourceHandler) New() types.Resource
New creates a new workflow resource