client

package
v0.0.0-...-bdb06d8 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UDPPayloadSize is a reasonable default payload size for UDP packets that
	// could be travelling over the internet.
	UDPPayloadSize = 512
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Query(command string) error
	WriteStream(b io.Reader) error
	Close() error
}

func NewHTTP

func NewHTTP(config HTTPConfig, defaultWP WriteParams) (Client, error)

func NewUDP

func NewUDP(config UDPConfig) (Client, error)

NewUDP will return an instance of the telegraf UDP output plugin for influxdb

type HTTPConfig

type HTTPConfig struct {
	// URL should be of the form "http://host:port" (REQUIRED)
	URL string

	// UserAgent sets the User-Agent header.
	UserAgent string

	// Timeout specifies a time limit for requests made by this
	// Client. The timeout includes connection time, any
	// redirects, and reading the response body. The timer remains
	// running after Get, Head, Post, or Do return and will
	// interrupt reading of the Response.Body.
	//
	// A Timeout of zero means no timeout.
	Timeout time.Duration

	// Username is the basic auth username for the server.
	Username string
	// Password is the basic auth password for the server.
	Password string

	// TLSConfig is the tls auth settings to use for each request.
	TLSConfig *tls.Config

	// Proxy URL should be of the form "http://host:port"
	HTTPProxy string

	// HTTP headers to append to HTTP requests.
	HTTPHeaders HTTPHeaders

	// The content encoding mechanism to use for each request.
	ContentEncoding string
}

type HTTPHeaders

type HTTPHeaders map[string]string

type Response

type Response struct {
	// ignore Results:
	Results []interface{} `json:"-"`
	Err     string        `json:"error,omitempty"`
}

Response represents a list of statement results.

func (*Response) Error

func (r *Response) Error() error

Error returns the first error from any statement. Returns nil if no errors occurred on any statements.

type UDPConfig

type UDPConfig struct {
	// URL should be of the form "udp://host:port"
	// or "udp://[ipv6-host%zone]:port".
	URL string

	// PayloadSize is the maximum size of a UDP client message, optional
	// Tune this based on your network. Defaults to UDPPayloadSize.
	PayloadSize int
}

UDPConfig is the config data needed to create a UDP Client

type WriteParams

type WriteParams struct {
	Database        string
	RetentionPolicy string
	Precision       string
	Consistency     string
}

Jump to

Keyboard shortcuts

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