akips

package
v1.0.0-test.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFields = errors.New("akips: incorrect number of fields")
)

Functions

This section is empty.

Types

type AuthMethod

type AuthMethod interface {
	AuthenticateRequest(r *http.Request)
}

AuthMethod represents an authentication method

type Config

type Config struct {
	AuthMethod AuthMethod
	URL        string
	Transport  http.RoundTripper
}

Config is the client configuration

func (*Config) Client

func (c *Config) Client() *http.Client

Client creates an *http.Client

func (*Config) NewRequest

func (c *Config) NewRequest(ctx context.Context, method, endpointPath string, values url.Values) (*http.Request, error)

NewRequest returns a new Request given a method, URL, and a contents

type GenericResponse

type GenericResponse []*GenericResponseEntry

GenericResponse consists of a parent, a child, an attribute and a list of values

func (*GenericResponse) ParseResponse

func (p *GenericResponse) ParseResponse(rd io.Reader) error

type GenericResponseEntry

type GenericResponseEntry struct {
	Parent    string   `json:"parent,omitempty"`
	Child     string   `json:"child,omitempty"`
	Attribute string   `json:"attr,omitempty"`
	Values    []string `json:"val,omitempty"`
}

type MsgEntry

type MsgEntry struct {
	Timestamp time.Time `json:"ts"`
	Type      string    `json:"type"`
	IPVer     int       `json:"ipver"`
	Addr      string    `json:"addr"`
	Msg       []string  `json:"msg"`
}

type MsgResponse

type MsgResponse []*MsgEntry

func (*MsgResponse) ParseResponse

func (m *MsgResponse) ParseResponse(rd io.Reader) error

type NetflowEntry

type NetflowEntry struct {
	Source        string `json:"src,omitempty"`
	Destination   string `json:"dst,omitempty"`
	Protocol      string `json:"pro,omitempty"`
	Packets       *int64 `json:"pkt,omitempty"`
	Bytes         *int64 `json:"oct,omitempty"`
	Flows         *int64 `json:"flo,omitempty"`
	Conversations *int64 `json:"con,omitempty"`
	Filter        string `json:"tsf,omitempty"`
	URL           string `json:"url,omitempty"`
}

type NetflowResponse

type NetflowResponse []*NetflowEntry

func (*NetflowResponse) Append

func (a *NetflowResponse) Append(b NetflowResponse)

func (*NetflowResponse) ParseResponse

func (f *NetflowResponse) ParseResponse(rd io.Reader) error

type NetflowTimeSeries

type NetflowTimeSeries struct {
	Source      string    `json:"src,omitempty"`
	Destination string    `json:"dst,omitempty"`
	Protocol    string    `json:"pro,omitempty"`
	Start       time.Time `json:"start"`
	Interval    int64     `json:"int"`
	Values      []int64   `json:"val"`
}

type NetflowTimeSeriesResponse

type NetflowTimeSeriesResponse map[string]*NetflowTimeSeries

func (*NetflowTimeSeriesResponse) Append

func (*NetflowTimeSeriesResponse) ParseResponse

func (t *NetflowTimeSeriesResponse) ParseResponse(rd io.Reader) error

type PasswordAuth

type PasswordAuth string

PasswordAuth authorizes and authenticates the request with a given password

func (PasswordAuth) AuthenticateRequest

func (p PasswordAuth) AuthenticateRequest(r *http.Request)

AuthenticateRequest add a password to request's URL

type ResponseParser

type ResponseParser interface {
	ParseResponse(io.Reader) error
}

type TestResponse

type TestResponse struct{}

func (TestResponse) ParseResponse

func (t TestResponse) ParseResponse(rd io.Reader) error

type TimeSeriesResponse

type TimeSeriesResponse struct {
	Timestamp []time.Time                `json:"ts"`
	Entries   []*TimeSeriesResponseEntry `json:"entries"`
}

func (*TimeSeriesResponse) ParseResponse

func (t *TimeSeriesResponse) ParseResponse(rd io.Reader) error

type TimeSeriesResponseEntry

type TimeSeriesResponseEntry struct {
	Parent           string  `json:"parent,omitempty"`
	Child            string  `json:"child,omitempty"`
	ChildDescription string  `json:"childDesc,omitempty"`
	Attribute        string  `json:"attr,omitempty"`
	Values           []int64 `json:"val"`
}

type Transport

type Transport struct {
	// Method adds credentials to outgoing requests
	AuthMethod AuthMethod

	// Base is the base RoundTripper used to make HTTP requests.
	// If nil, http.DefaultTransport is used.
	Base http.RoundTripper
}

Transport is an http.RoundTripper that makes authenticated AKiPS API requests

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip authorizes and authenticates the request

Jump to

Keyboard shortcuts

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