kibana

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 23 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeURLParams

func EncodeURLParams(url string, params url.Values) string

func MakeURL

func MakeURL(defaultScheme string, defaultPath string, rawURL string, defaultPort int) (string, error)

MakeURL creates the url based on the url configuration. Adds missing parts with defaults (scheme, host, port)

func ParseURL

func ParseURL(raw string, hints ...ParseHint) (*url.URL, error)

ParseURL tries to parse a URL and return the parsed result.

Types

type Client

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

func NewClientWithConfig

func NewClientWithConfig(config *ClientConfig, binaryName, version, commit, buildtime string) (*Client, error)

NewClientWithConfig creates and returns a kibana client using the given config

func NewClientWithConfigDefault

func NewClientWithConfigDefault(config *ClientConfig, defaultPort int, binaryName, version, commit, buildtime string) (*Client, error)

NewClientWithConfig creates and returns a kibana client using the given config

func NewKibanaClient

func NewKibanaClient(cfg *config.C, binaryName, version, commit, buildtime string) (*Client, error)

NewKibanaClient builds and returns a new Kibana client

func (*Client) Close

func (client *Client) Close() error

func (*Client) GetVersion

func (client *Client) GetVersion() version.V

GetVersion returns the version read from kibana. The version is not set if IgnoreVersion was set when creating the client.

func (*Client) ImportMultiPartFormFile

func (client *Client) ImportMultiPartFormFile(url string, params url.Values, filename string, contents string) error

type ClientConfig

type ClientConfig struct {
	Protocol     string `config:"protocol" yaml:"protocol,omitempty"`
	Host         string `config:"host" yaml:"host,omitempty"`
	Path         string `config:"path" yaml:"path,omitempty"`
	SpaceID      string `config:"space.id" yaml:"space.id,omitempty"`
	Username     string `config:"username" yaml:"username,omitempty"`
	Password     string `config:"password" yaml:"password,omitempty"`
	APIKey       string `config:"api_key" yaml:"api_key,omitempty"`
	ServiceToken string `config:"service_token" yaml:"service_token,omitempty"`

	// Headers holds headers to include in every request sent to Kibana.
	Headers map[string]string `config:"headers" yaml:"headers,omitempty"`

	IgnoreVersion bool

	Transport httpcommon.HTTPTransportSettings `config:",inline" yaml:",inline"`
}

ClientConfig to connect to Kibana

func DefaultClientConfig

func DefaultClientConfig() ClientConfig

DefaultClientConfig connects to a locally running kibana over HTTP

func (*ClientConfig) Validate

func (c *ClientConfig) Validate() error

type Connection

type Connection struct {
	URL          string
	Username     string
	Password     string
	APIKey       string
	ServiceToken string
	Headers      http.Header

	HTTP    *http.Client
	Version version.V
}

func (*Connection) Request

func (conn *Connection) Request(method, extraPath string,
	params url.Values, headers http.Header, body io.Reader) (int, []byte, error)

func (*Connection) RoundTrip

func (conn *Connection) RoundTrip(r *http.Request) (*http.Response, error)

Implements RoundTrip interface

func (*Connection) Send

func (conn *Connection) Send(method, extraPath string,
	params url.Values, headers http.Header, body io.Reader) (*http.Response, error)

Sends an application/json request to Kibana with appropriate kbn headers

func (*Connection) SendWithContext

func (conn *Connection) SendWithContext(ctx context.Context, method, extraPath string,
	params url.Values, headers http.Header, body io.Reader) (*http.Response, error)

SendWithContext sends an application/json request to Kibana with appropriate kbn headers and the given context.

type ParseHint

type ParseHint func(raw string) string

func WithDefaultScheme

func WithDefaultScheme(scheme string) ParseHint

Jump to

Keyboard shortcuts

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