kibana

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 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 Agent added in v0.3.8

type Agent struct {
	Active bool   `json:"active"`
	Status string `json:"status"`
	Agent  struct {
		ID      string `json:"id"`
		Version string `json:"version"`
	} `json:"agent"`
	LocalMetadata struct {
		Host struct {
			Hostname string `json:"hostname"`
		} `json:"host"`
	} `json:"local_metadata"`
}

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) CreateEnrollmentAPIKey added in v0.3.8

func (client *Client) CreateEnrollmentAPIKey(request CreateEnrollmentAPIKeyRequest) (*CreateEnrollmentAPIKeyResponse, error)

func (*Client) CreatePolicy added in v0.3.8

func (client *Client) CreatePolicy(request CreatePolicyRequest) (*CreatePolicyResponse, 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

func (*Client) ListAgents added in v0.3.8

func (client *Client) ListAgents(request ListAgentsRequest) (*ListAgentsResponse, error)

func (*Client) UnEnrollAgent added in v0.3.8

func (client *Client) UnEnrollAgent(request UnEnrollAgentRequest) (*UnEnrollAgentResponse, error)

func (*Client) UpgradeAgent added in v0.3.8

func (client *Client) UpgradeAgent(request UpgradeAgentRequest) (*UpgradeAgentResponse, 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 CreateEnrollmentAPIKeyRequest added in v0.3.8

type CreateEnrollmentAPIKeyRequest struct {
	Name     string `json:"name"`
	PolicyID string `json:"policy_id"`
}

type CreateEnrollmentAPIKeyResponse added in v0.3.8

type CreateEnrollmentAPIKeyResponse struct {
	Active   bool   `json:"active"`
	APIKey   string `json:"api_key"`
	APIKeyID string `json:"api_key_id"`
	ID       string `json:"id"`
	Name     string `json:"name"`
	PolicyID string `json:"policy_id"`
}

type CreatePolicyRequest added in v0.3.8

type CreatePolicyRequest struct {
	ID                string                    `json:"id"`
	Name              string                    `json:"name"`
	Namespace         string                    `json:"namespace"`
	Description       string                    `json:"description"`
	MonitoringEnabled []MonitoringEnabledOption `json:"monitoring_enabled"`
}

type CreatePolicyResponse added in v0.3.8

type CreatePolicyResponse struct {
	ID                string                    `json:"id,omitempty"`
	Name              string                    `json:"name"`
	Description       string                    `json:"description"`
	Namespace         string                    `json:"namespace"`
	IsManaged         bool                      `json:"is_managed"`
	Status            string                    `json:"status"`
	MonitoringEnabled []MonitoringEnabledOption `json:"monitoring_enabled"`
}

type ListAgentsRequest added in v0.3.8

type ListAgentsRequest struct {
}

type ListAgentsResponse added in v0.3.8

type ListAgentsResponse struct {
	Items []Agent `json:"items"`
}

type MonitoringEnabledOption added in v0.3.8

type MonitoringEnabledOption string
const (
	MonitoringEnabledLogs    MonitoringEnabledOption = "logs"
	MonitoringEnabledMetrics MonitoringEnabledOption = "metrics"
)

type ParseHint

type ParseHint func(raw string) string

func WithDefaultScheme

func WithDefaultScheme(scheme string) ParseHint

type UnEnrollAgentRequest added in v0.3.8

type UnEnrollAgentRequest struct {
	ID     string `json:"id"`
	Revoke bool   `json:"revoke"`
}

type UnEnrollAgentResponse added in v0.3.8

type UnEnrollAgentResponse struct {
}

type UpgradeAgentRequest added in v0.3.8

type UpgradeAgentRequest struct {
	ID      string `json:"id"`
	Version string `json:"version"`
}

type UpgradeAgentResponse added in v0.3.8

type UpgradeAgentResponse struct {
}

Jump to

Keyboard shortcuts

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