api

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2017 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCrudClientFromConfig

func NewCrudClientFromConfig(authOptions *shttp.AuthenticationOpts) (*shttp.CrudClient, error)

func NewRestClientFromConfig added in v0.4.0

func NewRestClientFromConfig(authOptions *shttp.AuthenticationOpts) (*shttp.RestClient, error)

func RegisterConfigAPI added in v0.10.0

func RegisterConfigAPI(r *shttp.Server)

func RegisterPacketInjectorAPI added in v0.10.0

func RegisterPacketInjectorAPI(pic *packet_injector.PacketInjectorClient, g *graph.Graph, r *shttp.Server)

func RegisterPcapAPI added in v0.10.0

func RegisterPcapAPI(r *shttp.Server, store storage.Storage)

func RegisterTopologyAPI added in v0.10.0

func RegisterTopologyAPI(r *shttp.Server, parser *traversal.GremlinTraversalParser)

Types

type APIHandler added in v0.10.0

type APIHandler interface {
	Name() string
	New() APIResource
	Index() map[string]APIResource
	Get(id string) (APIResource, bool)
	Decorate(resource APIResource)
	Create(resource APIResource) error
	Delete(id string) error
	AsyncWatch(f APIWatcherCallback) StoppableWatcher
}

type APIInfo added in v0.10.0

type APIInfo struct {
	Host    string
	Version string
	Service string
}

type APIResource added in v0.10.0

type APIResource interface {
	ID() string
	SetID(string)
}

type APIResourceWatcher added in v0.10.0

type APIResourceWatcher interface {
	AsyncWatch(f APIWatcherCallback) StoppableWatcher
}

type APIServer added in v0.10.0

type APIServer struct {
	HTTPServer  *shttp.Server
	EtcdKeyAPI  etcd.KeysAPI
	ServiceType common.ServiceType
	// contains filtered or unexported fields
}

func NewAPI added in v0.10.0

func NewAPI(server *shttp.Server, kapi etcd.KeysAPI, serviceType common.ServiceType) (*APIServer, error)

func (*APIServer) GetHandler added in v0.10.0

func (a *APIServer) GetHandler(s string) APIHandler

func (*APIServer) RegisterAPIHandler added in v0.10.0

func (a *APIServer) RegisterAPIHandler(handler APIHandler) error

type APIWatcherCallback added in v0.10.0

type APIWatcherCallback func(action string, id string, resource APIResource)

type Alert

type Alert struct {
	UUID        string
	Name        string `json:",omitempty"`
	Description string `json:",omitempty"`
	Expression  string `json:",omitempty" valid:"nonzero"`
	Action      string `json:",omitempty" valid:"regexp=^(|http://|https://|file://).*$"`
	Trigger     string `json:",omitempty" valid:"regexp=^(graph|duration:.+|)$"`
	CreateTime  time.Time
}

func NewAlert

func NewAlert() *Alert

func (*Alert) ID

func (a *Alert) ID() string

func (*Alert) SetID added in v0.4.0

func (a *Alert) SetID(i string)

type AlertAPIHandler added in v0.10.0

type AlertAPIHandler struct {
	BasicAPIHandler
}

func RegisterAlertAPI added in v0.10.0

func RegisterAlertAPI(apiServer *APIServer) (*AlertAPIHandler, error)

type AlertResourceHandler added in v0.5.0

type AlertResourceHandler struct {
}

func (*AlertResourceHandler) Name added in v0.5.0

func (a *AlertResourceHandler) Name() string

func (*AlertResourceHandler) New added in v0.5.0

type BasicAPIHandler added in v0.10.0

type BasicAPIHandler struct {
	ResourceHandler ResourceHandler
	EtcdKeyAPI      etcd.KeysAPI
}

basic implementation of an APIHandler, should be used as embedded struct for the most part of the resources

func (*BasicAPIHandler) AsyncWatch added in v0.10.0

func (*BasicAPIHandler) Create added in v0.10.0

func (h *BasicAPIHandler) Create(resource APIResource) error

func (*BasicAPIHandler) Decorate added in v0.10.0

func (h *BasicAPIHandler) Decorate(resource APIResource)

func (*BasicAPIHandler) Delete added in v0.10.0

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

func (*BasicAPIHandler) Get added in v0.10.0

func (h *BasicAPIHandler) Get(id string) (APIResource, bool)

func (*BasicAPIHandler) Index added in v0.10.0

func (h *BasicAPIHandler) Index() map[string]APIResource

func (*BasicAPIHandler) Name added in v0.10.0

func (h *BasicAPIHandler) Name() string

func (*BasicAPIHandler) New added in v0.10.0

func (h *BasicAPIHandler) New() APIResource

func (*BasicAPIHandler) Unmarshal added in v0.10.0

func (h *BasicAPIHandler) Unmarshal(b []byte) (resource APIResource, err error)

type BasicStoppableWatcher

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

func (*BasicStoppableWatcher) Stop

func (s *BasicStoppableWatcher) Stop()

type Capture

type Capture struct {
	UUID         string
	GremlinQuery string `json:"GremlinQuery,omitempty" valid:"isGremlinExpr"`
	BPFFilter    string `json:"BPFFilter,omitempty" valid:"isBPFFilter"`
	Name         string `json:"Name,omitempty"`
	Description  string `json:"Description,omitempty"`
	Type         string `json:"Type,omitempty"`
	Count        int    `json:"Count,omitempty"`
	PCAPSocket   string `json:"PCAPSocket,omitempty"`
}

func NewCapture

func NewCapture(query string, bpfFilter string) *Capture

func (*Capture) ID

func (c *Capture) ID() string

func (*Capture) SetID added in v0.4.0

func (c *Capture) SetID(i string)

type CaptureAPIHandler added in v0.10.0

type CaptureAPIHandler struct {
	BasicAPIHandler
	Graph *graph.Graph
}

func RegisterCaptureAPI added in v0.10.0

func RegisterCaptureAPI(apiServer *APIServer, g *graph.Graph) (*CaptureAPIHandler, error)

func (*CaptureAPIHandler) Create added in v0.10.0

func (c *CaptureAPIHandler) Create(r APIResource) error

Create tests that resource GremlinQuery does not exists already

func (*CaptureAPIHandler) Decorate added in v0.10.0

func (c *CaptureAPIHandler) Decorate(resource APIResource)

type CaptureResourceHandler added in v0.5.0

type CaptureResourceHandler struct {
}

func (*CaptureResourceHandler) Name added in v0.5.0

func (c *CaptureResourceHandler) Name() string

func (*CaptureResourceHandler) New added in v0.5.0

type ConfigAPI added in v0.10.0

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

type HandlerFunc

type HandlerFunc func(w http.ResponseWriter, r *http.Request)

type PacketInjectorAPI added in v0.10.0

type PacketInjectorAPI struct {
	PIClient *packet_injector.PacketInjectorClient
	Graph    *graph.Graph
}

type PacketParamsReq added in v0.8.0

type PacketParamsReq struct {
	Src     string
	Dst     string
	SrcIP   string
	DstIP   string
	SrcMAC  string
	DstMAC  string
	Type    string
	Payload string
	Count   int
}

type PcapAPI added in v0.10.0

type PcapAPI struct {
	Storage storage.Storage
}

type ResourceHandler

type ResourceHandler interface {
	Name() string
	New() APIResource
}

type StoppableWatcher

type StoppableWatcher interface {
	Stop()
}

type Topology added in v0.4.0

type Topology struct {
	GremlinQuery string `json:"GremlinQuery,omitempty" valid:"isGremlinExpr"`
}

type TopologyAPI added in v0.10.0

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

Source Files

  • alert.go
  • api.go
  • capture.go
  • config.go
  • handler.go
  • packet_injector.go
  • pcap.go
  • topology.go

Jump to

Keyboard shortcuts

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