Documentation ¶
Index ¶
- Variables
- func EncodeURLParams(url string, params url.Values) string
- func MakeURL(defaultScheme string, defaultPath string, rawURL string, defaultPort int) (string, error)
- func ParseURL(raw string, hints ...ParseHint) (*url.URL, error)
- type AgentCommon
- type AgentExisting
- type AgentPolicy
- type AgentPolicyUpdateRequest
- type AgentUpgradeDetails
- type Client
- func NewClientWithConfig(config *ClientConfig, binaryName, version, commit, buildtime string) (*Client, error)
- func NewClientWithConfigDefault(config *ClientConfig, defaultPort int, ...) (*Client, error)
- func NewKibanaClient(cfg *config.C, binaryName, version, commit, buildtime string) (*Client, error)
- func (client *Client) Close() error
- func (client *Client) CreateDownloadSource(ctx context.Context, source DownloadSource) (DownloadSourceResponse, error)
- func (client *Client) CreateEnrollmentAPIKey(ctx context.Context, request CreateEnrollmentAPIKeyRequest) (r CreateEnrollmentAPIKeyResponse, err error)
- func (client *Client) CreateFleetProxy(ctx context.Context, req ProxiesRequest) (ProxiesResponse, error)
- func (client *Client) CreateFleetServerHosts(ctx context.Context, req ListFleetServerHostsRequest) (FleetServerHostsResponse, error)
- func (client *Client) CreatePolicy(ctx context.Context, request AgentPolicy) (r PolicyResponse, err error)
- func (client *Client) DeleteFleetPackage(ctx context.Context, packagePolicyID string) (r DeletePackagePolicyResponse, err error)
- func (client *Client) DeletePolicy(ctx context.Context, id string) error
- func (client *Client) GetAgent(ctx context.Context, request GetAgentRequest) (r GetAgentResponse, err error)
- func (client *Client) GetFleetServerHost(ctx context.Context, request GetFleetServerHostRequest) (r GetFleetServerHostResponse, err error)
- func (client *Client) GetPolicy(ctx context.Context, id string) (r PolicyResponse, err error)
- func (client *Client) GetPolicyUninstallTokens(ctx context.Context, policyID string) (r UninstallTokenResponse, err error)
- func (client *Client) GetUninstallToken(ctx context.Context, tokenID string) (r UninstallTokenItem, err error)
- func (client *Client) GetVersion() version.V
- func (client *Client) ImportMultiPartFormFile(url string, params url.Values, filename string, contents string) error
- func (client *Client) InstallFleetPackage(ctx context.Context, req PackagePolicyRequest) (r PackagePolicyResponse, err error)
- func (client *Client) KibanaIsServerless() (bool, error)
- func (client *Client) ListAgents(ctx context.Context, _ ListAgentsRequest) (r ListAgentsResponse, err error)
- func (client *Client) ListFleetServerHosts(ctx context.Context, _ ListFleetServerHostsRequest) (r ListFleetServerHostsResponse, err error)
- func (client *Client) UnEnrollAgent(ctx context.Context, request UnEnrollAgentRequest) (r UnEnrollAgentResponse, err error)
- func (client *Client) UpdatePolicy(ctx context.Context, id string, request AgentPolicyUpdateRequest) (r PolicyResponse, err error)
- func (client *Client) UpgradeAgent(ctx context.Context, request UpgradeAgentRequest) (r UpgradeAgentResponse, err error)
- type ClientConfig
- type Connection
- func (conn *Connection) Request(method, extraPath string, params url.Values, headers http.Header, ...) (int, []byte, error)
- func (conn *Connection) RoundTrip(r *http.Request) (*http.Response, error)
- func (conn *Connection) Send(method, extraPath string, params url.Values, headers http.Header, ...) (*http.Response, error)
- func (conn *Connection) SendWithContext(ctx context.Context, method, extraPath string, params url.Values, ...) (*http.Response, error)
- type CreateEnrollmentAPIKeyRequest
- type CreateEnrollmentAPIKeyResponse
- type DeletePackagePolicyResponse
- type DownloadSource
- type DownloadSourceResponse
- type FleetServerHost
- type FleetServerHostsResponse
- type GetAgentRequest
- type GetAgentResponse
- type GetFleetServerHostRequest
- type GetFleetServerHostResponse
- type ListAgentsRequest
- type ListAgentsResponse
- type ListFleetServerHostsRequest
- type ListFleetServerHostsResponse
- type MonitoringEnabledOption
- type PackagePolicy
- type PackagePolicyRequest
- type PackagePolicyRequestPackage
- type PackagePolicyResponse
- type ParseHint
- type PolicyResponse
- type ProxiesRequest
- type ProxiesResponse
- type UnEnrollAgentRequest
- type UnEnrollAgentResponse
- type UninstallTokenItem
- type UninstallTokenResponse
- type UpgradeAgentRequest
- type UpgradeAgentResponse
Constants ¶
This section is empty.
Variables ¶
var ( TRUE *bool = &bt FALSE *bool = &bf )
Constant booleans for convenience for dealing with *bool
Functions ¶
Types ¶
type AgentCommon ¶ added in v0.3.9
type AgentCommon 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"` PolicyID string `json:"policy_id"` PolicyRevision int `json:"policy_revision"` UpgradeDetails *AgentUpgradeDetails `json:"upgrade_details"` }
AgentCommon represents common agent data used across Agent APIs
type AgentExisting ¶ added in v0.3.9
type AgentExisting struct { ID string `json:"id"` AgentCommon `json:",inline"` }
type AgentPolicy ¶ added in v0.3.9
type AgentPolicy struct { ID string `json:"id,omitempty"` // Name of the policy. Required to create a policy. Name string `json:"name"` // Namespace of the policy. Required to create a policy. Namespace string `json:"namespace"` Description string `json:"description,omitempty"` MonitoringEnabled []MonitoringEnabledOption `json:"monitoring_enabled,omitempty"` DataOutputID string `json:"data_output_id,omitempty"` MonitoringOutputID string `json:"monitoring_output_id,omitempty"` FleetServerHostID string `json:"fleet_server_host_id,omitempty"` DownloadSourceID string `json:"download_source_id,omitempty"` UnenrollTimeout int `json:"unenroll_timeout,omitempty"` InactivityTImeout int `json:"inactivity_timeout,omitempty"` AgentFeatures []map[string]interface{} `json:"agent_features,omitempty"` Overrides map[string]interface{} `json:"overrides,omitempty"` IsProtected bool `json:"is_protected"` }
type AgentPolicyUpdateRequest ¶ added in v0.3.9
type AgentPolicyUpdateRequest struct { // Name of the policy. Required in an update request. Name string `json:"name"` // Namespace of the policy. Required in an update request. Namespace string `json:"namespace"` Description string `json:"description,omitempty"` MonitoringEnabled []MonitoringEnabledOption `json:"monitoring_enabled,omitempty"` DataOutputID string `json:"data_output_id,omitempty"` MonitoringOutputID string `json:"monitoring_output_id,omitempty"` FleetServerHostID string `json:"fleet_server_host_id,omitempty"` DownloadSourceID string `json:"download_source_id,omitempty"` UnenrollTimeout int `json:"unenroll_timeout,omitempty"` InactivityTImeout int `json:"inactivity_timeout,omitempty"` AgentFeatures []map[string]interface{} `json:"agent_features,omitempty"` Overrides map[string]interface{} `json:"overrides,omitempty"` IsProtected *bool `json:"is_protected,omitempty"` // Optional bool for compatibility with the older pre 8.9.0 stack }
AgentPolicyUpdateRequest is the JSON object for requesting an updated policy Unlike the Agent create and response structures, the update request does not contain an ID field.
type AgentUpgradeDetails ¶ added in v0.6.3
type AgentUpgradeDetails struct { TargetVersion string `json:"target_version"` State string `json:"state"` ActionID string `json:"action_id"` Metadata struct { ScheduledAt *time.Time `json:"scheduled_at"` DownloadPercent float64 `json:"download_percent"` DownloadRate details.DownloadRate `json:"download_rate"` FailedState string `json:"failed_state"` ErrorMsg string `json:"error_msg"` } `json:"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)
NewClientWithConfigDefault creates and returns a kibana client using the given config
func NewKibanaClient ¶
NewKibanaClient builds and returns a new Kibana client
func (*Client) CreateDownloadSource ¶ added in v0.6.3
func (client *Client) CreateDownloadSource(ctx context.Context, source DownloadSource) (DownloadSourceResponse, error)
func (*Client) CreateEnrollmentAPIKey ¶ added in v0.3.8
func (client *Client) CreateEnrollmentAPIKey(ctx context.Context, request CreateEnrollmentAPIKeyRequest) (r CreateEnrollmentAPIKeyResponse, err error)
CreateEnrollmentAPIKey creates an enrollment API key
func (*Client) CreateFleetProxy ¶ added in v0.17.0
func (client *Client) CreateFleetProxy(ctx context.Context, req ProxiesRequest) (ProxiesResponse, error)
CreateFleetProxy creates a new proxy
func (*Client) CreateFleetServerHosts ¶ added in v0.17.0
func (client *Client) CreateFleetServerHosts(ctx context.Context, req ListFleetServerHostsRequest) (FleetServerHostsResponse, error)
CreateFleetServerHosts creates a new Fleet Server host
func (*Client) CreatePolicy ¶ added in v0.3.8
func (client *Client) CreatePolicy(ctx context.Context, request AgentPolicy) (r PolicyResponse, err error)
CreatePolicy creates a new agent policy with the given config
func (*Client) DeleteFleetPackage ¶ added in v0.3.10
func (client *Client) DeleteFleetPackage(ctx context.Context, packagePolicyID string) (r DeletePackagePolicyResponse, err error)
DeleteFleetPackage deletes integration with packagePolicyID from the policy ID
func (*Client) DeletePolicy ¶ added in v0.3.9
DeletePolicy deletes the policy with the given ID
func (*Client) GetAgent ¶ added in v0.3.9
func (client *Client) GetAgent(ctx context.Context, request GetAgentRequest) (r GetAgentResponse, err error)
GetAgent fetches data for an agent
func (*Client) GetFleetServerHost ¶ added in v0.3.9
func (client *Client) GetFleetServerHost(ctx context.Context, request GetFleetServerHostRequest) (r GetFleetServerHostResponse, err error)
func (*Client) GetPolicyUninstallTokens ¶ added in v0.3.10
func (client *Client) GetPolicyUninstallTokens(ctx context.Context, policyID string) (r UninstallTokenResponse, err error)
GetPolicyUninstallTokens Retrieves the policy uninstall tokens
func (*Client) GetUninstallToken ¶ added in v0.3.10
func (client *Client) GetUninstallToken(ctx context.Context, tokenID string) (r UninstallTokenItem, err error)
GetUninstallToken return uninstall token value for the given token ID
func (*Client) GetVersion ¶
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) InstallFleetPackage ¶ added in v0.3.10
func (client *Client) InstallFleetPackage(ctx context.Context, req PackagePolicyRequest) (r PackagePolicyResponse, err error)
InstallFleetPackage uses the Fleet package policies API install an integration package as specified in the request. Note that the package policy ID and Name must be globally unique across all installed packages.
func (*Client) KibanaIsServerless ¶ added in v0.4.0
KibanaIsServerless returns true if we're talking to a serverless instance.
func (*Client) ListAgents ¶ added in v0.3.8
func (client *Client) ListAgents(ctx context.Context, _ ListAgentsRequest) (r ListAgentsResponse, err error)
ListAgents returns a list of agents known to Kibana
func (*Client) ListFleetServerHosts ¶ added in v0.3.9
func (client *Client) ListFleetServerHosts(ctx context.Context, _ ListFleetServerHostsRequest) (r ListFleetServerHostsResponse, err error)
ListFleetServerHosts returns a list of fleet server hosts
func (*Client) UnEnrollAgent ¶ added in v0.3.8
func (client *Client) UnEnrollAgent(ctx context.Context, request UnEnrollAgentRequest) (r UnEnrollAgentResponse, err error)
UnEnrollAgent removes the agent from fleet
func (*Client) UpdatePolicy ¶ added in v0.3.9
func (client *Client) UpdatePolicy(ctx context.Context, id string, request AgentPolicyUpdateRequest) (r PolicyResponse, err error)
UpdatePolicy updates an existing agent policy.
func (*Client) UpgradeAgent ¶ added in v0.3.8
func (client *Client) UpgradeAgent(ctx context.Context, request UpgradeAgentRequest) (r UpgradeAgentResponse, err error)
UpgradeAgent upgrades the requested agent
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) Send ¶
func (conn *Connection) Send(method, extraPath string, params url.Values, headers http.Header, body io.Reader) (*http.Response, error)
Send 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 CreateEnrollmentAPIKeyResponse ¶ added in v0.3.8
type DeletePackagePolicyResponse ¶ added in v0.3.10
type DeletePackagePolicyResponse struct {
ID string `json:"id"`
}
type DownloadSource ¶ added in v0.6.3
type DownloadSourceResponse ¶ added in v0.7.1
type FleetServerHost ¶ added in v0.3.9
type FleetServerHostsResponse ¶ added in v0.17.0
type FleetServerHostsResponse struct { Item struct { ID string `json:"id"` HostUrls []string `json:"host_urls"` IsDefault bool `json:"is_default"` IsInternal bool `json:"is_internal"` IsPreconfigured bool `json:"is_preconfigured"` Name string `json:"name"` ProxyID string `json:"proxy_id"` } `json:"item"` }
type GetAgentRequest ¶ added in v0.3.9
type GetAgentRequest struct {
ID string
}
type GetAgentResponse ¶ added in v0.3.9
type GetAgentResponse AgentExisting
type GetFleetServerHostRequest ¶ added in v0.3.9
type GetFleetServerHostRequest struct {
ID string
}
type GetFleetServerHostResponse ¶ added in v0.3.9
type GetFleetServerHostResponse FleetServerHost
type ListAgentsRequest ¶ added in v0.3.8
type ListAgentsRequest struct { }
type ListAgentsResponse ¶ added in v0.3.8
type ListAgentsResponse struct {
Items []AgentExisting `json:"items"`
}
type ListFleetServerHostsRequest ¶ added in v0.3.9
type ListFleetServerHostsResponse ¶ added in v0.3.9
type ListFleetServerHostsResponse struct {
Items []FleetServerHost `json:"items"`
}
type MonitoringEnabledOption ¶ added in v0.3.8
type MonitoringEnabledOption string
MonitoringEnabledOption is a Kibana JSON value that specifies the various monitoring option types
const ( // MonitoringEnabledLogs specifies log monitoring MonitoringEnabledLogs MonitoringEnabledOption = "logs" // MonitoringEnabledMetrics specifies metrics monitoring MonitoringEnabledMetrics MonitoringEnabledOption = "metrics" )
type PackagePolicy ¶ added in v0.3.10
type PackagePolicy struct { ID string `json:"id,omitempty"` Revision int `json:"revision"` Enabled bool `json:"enabled"` Inputs []map[string]interface{} `json:"inputs"` Package PackagePolicyRequestPackage `json:"package"` Namespace string `json:"namespace"` OutputID string `json:"output_id"` PolicyID string `json:"policy_id"` Name string `json:"name"` Description string `json:"description"` }
type PackagePolicyRequest ¶ added in v0.3.10
type PackagePolicyRequest struct { ID string `json:"id,omitempty"` Name string `json:"name"` Namespace string `json:"namespace"` PolicyID string `json:"policy_id"` Package PackagePolicyRequestPackage `json:"package"` Vars map[string]interface{} `json:"vars"` Inputs []map[string]interface{} `json:"inputs"` Force bool `json:"force"` }
type PackagePolicyRequestPackage ¶ added in v0.3.10
type PackagePolicyResponse ¶ added in v0.3.10
type PackagePolicyResponse struct {
Item PackagePolicy `json:"item"`
}
type ParseHint ¶
func WithDefaultScheme ¶
type PolicyResponse ¶ added in v0.3.9
type ProxiesRequest ¶ added in v0.17.0
type ProxiesRequest struct { Certificate string `json:"certificate"` CertificateAuthorities string `json:"certificate_authorities"` CertificateKey string `json:"certificate_key"` ID string `json:"id"` IsPreconfigured bool `json:"is_preconfigured"` Name string `json:"name"` ProxyHeaders map[string]string `json:"proxy_headers"` URL string `json:"url"` }
type ProxiesResponse ¶ added in v0.17.0
type ProxiesResponse struct { Item struct { Certificate string `json:"certificate"` CertificateAuthorities string `json:"certificate_authorities"` CertificateKey string `json:"certificate_key"` ID string `json:"id"` IsPreconfigured bool `json:"is_preconfigured"` Name string `json:"name"` ProxyHeaders map[string]string `json:"proxy_headers"` URL string `json:"url"` } `json:"item"` }
type UnEnrollAgentRequest ¶ added in v0.3.8
type UnEnrollAgentResponse ¶ added in v0.3.8
type UnEnrollAgentResponse struct { }
type UninstallTokenItem ¶ added in v0.3.10
type UninstallTokenResponse ¶ added in v0.3.10
type UninstallTokenResponse struct { Items []UninstallTokenItem `json:"items"` Total int `json:"total"` Page int `json:"page"` PerPage int `json:"perPage"` }
type UpgradeAgentRequest ¶ added in v0.3.8
type UpgradeAgentResponse ¶ added in v0.3.8
type UpgradeAgentResponse struct { }