Documentation
¶
Index ¶
- Constants
- func GetInterfaceUpdates(nif *net.Interface) (map[string]InterfaceUpdate, error)
- func IsErrorWithStatusCode(err error, code int) bool
- func NormalizeName(name string) string
- type Addr
- type AllDeviceWrapper
- type Client
- func (c *Client) CreateDevice(create *DeviceCreate) (*Device, error)
- func (c *Client) CreateDeviceAndSite(siteDevCreate *SiteAndDeviceCreate) (*Device, error)
- func (c *Client) GetAllDevices() ([]*Device, error)
- func (c *Client) GetDeviceByID(did int) (*Device, error)
- func (c *Client) GetDeviceByIF(name string) (*Device, error)
- func (c *Client) GetDeviceByIP(ip net.IP) (*Device, error)
- func (c *Client) GetDeviceByName(name string) (*Device, error)
- func (c *Client) GetDevices(filter *DevicesFilter) ([]*Device, error)
- func (c *Client) GetInterfaces(did int) ([]Interface, error)
- func (c *Client) SendDNS(url string, buf *bytes.Buffer) error
- func (c *Client) SendFlow(url string, buf *bytes.Buffer) error
- func (c *Client) UpdateExportStatus(status *ExportStatus) error
- func (c *Client) UpdateInterfaces(dev *Device, nif *net.Interface) error
- func (c *Client) UpdateInterfacesDirectly(dev *Device, updates map[string]InterfaceUpdate) error
- type ClientConfig
- type Column
- type DNSQuestion
- type DNSResourceRecord
- func (z *DNSResourceRecord) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *DNSResourceRecord) EncodeMsg(en *msgp.Writer) (err error)
- func (z *DNSResourceRecord) MarshalMsg(b []byte) (o []byte, err error)
- func (z *DNSResourceRecord) Msgsize() (s int)
- func (z *DNSResourceRecord) UnmarshalMsg(bts []byte) (o []byte, err error)
- type DNSResponse
- type Device
- type DeviceCreate
- type DeviceWrapper
- type DevicesFilter
- type Error
- type ExportStatus
- type Interface
- type InterfaceUpdate
- type Plan
- type SiteAndDeviceCreate
- type SiteCreate
Constants ¶
const ( EXPORT_STATUS_OK = "OK" EXPORT_STATUS_ERROR = "ERROR" EXPORT_STATUS_START = "START" EXPORT_STATUS_HALT = "HALT" )
Variables ¶
This section is empty.
Functions ¶
func GetInterfaceUpdates ¶
func GetInterfaceUpdates(nif *net.Interface) (map[string]InterfaceUpdate, error)
func IsErrorWithStatusCode ¶
func NormalizeName ¶
NormalizeName is a helper for normalization of the devices name into an acceptable format for the Kentik API device endpoints.
Types ¶
type AllDeviceWrapper ¶
type AllDeviceWrapper struct {
Devices []*Device `json:"devices"`
}
AllDeviceWrapper is a wrapper around a list of Device instances, for endpoints that return a one or more Devices nested in a JSON structure.
type Client ¶
type Client struct {
ClientConfig
*http.Client
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config ClientConfig) *Client
func (*Client) CreateDevice ¶
func (c *Client) CreateDevice(create *DeviceCreate) (*Device, error)
func (*Client) CreateDeviceAndSite ¶
func (c *Client) CreateDeviceAndSite(siteDevCreate *SiteAndDeviceCreate) (*Device, error)
func (*Client) GetAllDevices ¶
func (*Client) GetDevices ¶
func (c *Client) GetDevices(filter *DevicesFilter) ([]*Device, error)
func (*Client) SendFlow ¶
SendFlow sends the provided buffer containing a gzipped, cap'n proto packed, representation of flows to the provided url.
func (*Client) UpdateExportStatus ¶
func (c *Client) UpdateExportStatus(status *ExportStatus) error
/internal/cloudExport/status/:id body expects `{status: string, message: string}`
func (*Client) UpdateInterfaces ¶
func (*Client) UpdateInterfacesDirectly ¶
func (c *Client) UpdateInterfacesDirectly(dev *Device, updates map[string]InterfaceUpdate) error
type ClientConfig ¶
type Column ¶
type Column struct {
ID uint64 `json:"field_id,string"`
Name string `json:"col_name"`
Type string `json:"col_type"`
}
Column is the JSON representation of a custom column from the Kentik API device endpoints.
func (Column) MarshalFlag ¶
func (*Column) UnmarshalFlag ¶
type DNSQuestion ¶
func (*DNSQuestion) DecodeMsg ¶
func (z *DNSQuestion) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*DNSQuestion) EncodeMsg ¶
func (z *DNSQuestion) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*DNSQuestion) MarshalMsg ¶
func (z *DNSQuestion) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*DNSQuestion) Msgsize ¶
func (z *DNSQuestion) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*DNSQuestion) UnmarshalMsg ¶
func (z *DNSQuestion) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type DNSResourceRecord ¶
func (*DNSResourceRecord) DecodeMsg ¶
func (z *DNSResourceRecord) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*DNSResourceRecord) EncodeMsg ¶
func (z *DNSResourceRecord) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*DNSResourceRecord) MarshalMsg ¶
func (z *DNSResourceRecord) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*DNSResourceRecord) Msgsize ¶
func (z *DNSResourceRecord) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*DNSResourceRecord) UnmarshalMsg ¶
func (z *DNSResourceRecord) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type DNSResponse ¶
type DNSResponse struct {
Question DNSQuestion
Answers []DNSResourceRecord
}
func (*DNSResponse) DecodeMsg ¶
func (z *DNSResponse) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*DNSResponse) EncodeMsg ¶
func (z *DNSResponse) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*DNSResponse) MarshalMsg ¶
func (z *DNSResponse) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*DNSResponse) Msgsize ¶
func (z *DNSResponse) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*DNSResponse) UnmarshalMsg ¶
func (z *DNSResponse) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Device ¶
type Device struct {
ID int `json:"id,string"`
Name string `json:"device_name"`
Type string `json:"device_type"`
Subtype string `json:"device_subtype"`
Description string `json:"device_description"`
IP net.IP `json:"ip"`
SampleRate int `json:"device_sample_rate,string"`
BgpType string `json:"device_bgp_type"`
Plan Plan `json:"plan"`
CdnAttr string `json:"cdn_attr"`
MaxFlowRate int `json:"max_flow_rate"`
CompanyID int `json:"company_id,string"`
Customs []Column `json:"custom_column_data,omitempty"`
}
Device is the JSON representation of a device from the Kentik API device endpoints.
type DeviceCreate ¶
type DeviceCreate struct {
Name string `json:"device_name"`
Type string `json:"device_type"`
Subtype string `json:"device_subtype"`
Description string `json:"device_description"`
SampleRate int `json:"device_sample_rate,string"`
BgpType string `json:"device_bgp_type"`
PlanID int `json:"plan_id,omitempty"`
SiteID int `json:"site_id,omitempty"`
CdnAttr string `json:"cdn_attr"`
// IPs is the associated sending IP Address(es) for the device. For devices that do not have a set of permanent IP
// addresses (i.e. cloud devices), this should not be set and AllowNoIP should be set to true.
IPs []net.IP `json:"sending_ips"`
// AllowNoIP is a flag to bypass the requirement of at least one IP address for creation of a device. This is only
// applicable for devices that do not have a set of permanent IP addresses, such as cloud devices.
AllowNoIP bool `json:"-"`
// ExportId the optionally associated Cloud Exporter which first received flow and is creating the device.
ExportId int `json:"cloud_export_id,omitempty"`
// Region is the optionally associated cloud region for this device
Region string `json:"cloud_region,omitempty"`
// Zone is the optionally associated cloud zone for this device
Zone string `json:"cloud_zone,omitempty"`
}
DeviceCreate is the payload JSON representation wrapper for creating a Device.
func (*DeviceCreate) NormalizeName ¶
func (c *DeviceCreate) NormalizeName()
type DeviceWrapper ¶
type DeviceWrapper struct {
Device *Device `json:"device"`
}
DeviceWrapper is a wrapper around the Device, for endpoints that return a single Device nested away next to other information.
type DevicesFilter ¶
type DevicesFilter struct {
// FilterCloud restricts the results to devices that were NOT created by cloud exporters.
FilterCloud bool `schema:"filterCloud"`
// CloudOnly restricts the results to ONLY devices created by cloud exporters.
CloudOnly bool `schema:"cloudOnly"`
// Subtypes restricts the results to only specific device subtypes. An empty or nil instance indicates no filtering
// of results.
Subtypes []string `schema:"subtypes"`
// AugmentWith specifies which additional, potentially large, payload fields should be hydrated. Some supported
// options are:
// - customColumns -
// - plan - The associated Plan for the device
AugmentWith []string `schema:"augmentWith"`
// Columns specifies additional, metadata fields i.e. table columns, to retrieve as part of the query. Examples
// include id, device_name, etc.
Columns []string `schema:"columns"`
}
DevicesFilter is a set of arguments that can be used to filter the devices queried along with the hydration of the resulting JSON.
type ExportStatus ¶
type ExportStatus struct {
ID int `json:"export_id"`
Status string `json:"status"`
Message string `json:"message"`
}
func (*ExportStatus) Set ¶
func (e *ExportStatus) Set(s string, m string) *ExportStatus
type InterfaceUpdate ¶
type Plan ¶
Plan is the JSON representation of a Kentik License Plan that describes the services provided by Kentik (i.e. permitted data, maximum number of devices, maximum number of FPS, etc.).
type SiteAndDeviceCreate ¶
type SiteAndDeviceCreate struct {
Site *SiteCreate `json:"site"`
Device *DeviceCreate `json:"device"`
}
SiteAndDeviceCreate is the payload JSON representation wrapper for creating a Site and Device.