http

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNotConnected indicates failure due to client having no valid connection
	ErrNotConnected = errors.New("not connected")
	// ErrJSONEncodeFailed indicates encoding failures
	ErrJSONEncodeFailed = errors.New("json encode failed")
)

Functions

func MakeHTTP

func MakeHTTP(
	_ outputs.IndexManager,
	beat beat.Info,
	observer outputs.Observer,
	cfg *common.Config,
) (outputs.Group, error)

Types

type Client

type Client struct {
	Connection
	// contains filtered or unexported fields
}

Client struct

func NewClient

func NewClient(s ClientSettings) (*Client, error)

NewClient instantiate a client.

func (*Client) BatchPublishEvent

func (client *Client) BatchPublishEvent(data []publisher.Event) error

BatchPublishEvent publish a single event to output.

func (*Client) Clone

func (client *Client) Clone() *Client

Clone clones a client.

func (*Client) Publish

func (client *Client) Publish(_ context.Context, batch publisher.Batch) error

Publish sends events to the clients sink.

func (*Client) PublishEvent

func (client *Client) PublishEvent(data publisher.Event) error

PublishEvent publish a single event to output.

func (*Client) String

func (client *Client) String() string

type ClientSettings

type ClientSettings struct {
	URL                string
	Proxy              *url.URL
	TLS                *tlscommon.TLSConfig
	Username, Password string
	Parameters         map[string]string
	Index              outil.Selector
	Pipeline           *outil.Selector
	Timeout            time.Duration
	CompressionLevel   int
	Observer           outputs.Observer
	BatchPublish       bool
	Headers            map[string]string
	ContentType        string
	Format             string
}

ClientSettings struct

type Connection

type Connection struct {
	URL      string
	Username string
	Password string

	ContentType string
	// contains filtered or unexported fields
}

Connection struct

func (*Connection) Close

func (conn *Connection) Close() error

Close closes a connection.

func (*Connection) Connect

func (conn *Connection) Connect() error

Connect establishes a connection to the clients sink.

Jump to

Keyboard shortcuts

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