kibana_objects

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 6 Imported by: 1

README

Kibana Objects

Compatible with Logz.io's Kibana objects API.

To import a new Kibana Object:

client, _ := kibana_objects.New(apiToken, apiServerAddress)
source := `{
        "search": {
          "columns": [
            "message"
          ],
          "sort": [
            "@timestamp",
            "desc"
          ],
          "id": "tf-client-test",
          "title": "tf-client-test",
          "version": 1,
          "kibanaSavedObjectMeta": {
            "searchSourceJSON": "{\"highlight\":{\"pre_tags\":[\"@kibana-highlighted-field@\"],\"post_tags\":[\"@/kibana-highlighted-field@\"],\"fields\":{\"*\":{}},\"fragment_size\":2147483647},\"filter\":[],\"query\":{\"query\":\"type: tf-client-test\",\"language\":\"lucene\"},\"source\":{\"excludes\":[]},\"highlightAll\":true,\"version\":true,\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"
          }
        },
        "type": "search",
        "id": "tf-client-test"
      }`
var sourceObj map[string]interface{}
err := json.Unmarshal([]byte(source), &sourceObj)
importReq := kibana_objects.KibanaObjectImportRequest{
                KibanaVersion: "7.2.1",
                Hits:          []map[string]interface{}{map[string]interface{}{
                    "_index":  "logzioCustomerKibanaIndex7",
                    "_type":   "_doc",
                    "_id":     "search:tf-client-test",
                    "_source": sourceObj,
                }},
            }
importRes, err := client.ImportKibanaObject(importReq)

To export a Kibana Object:

client, _ := kibana_objects.New(apiToken, apiServerAddress)
exportRes, _ := client.ExportKibanaObject(kibana_objects.KibanaObjectExportRequest{
	                Type: kibana_objects.ExportTypeSearch})
function func name
export kibana object func (c *KibanaObjectsClient) ExportKibanaObject(exportRequest KibanaObjectExportRequest) (*KibanaObjectExportResponse, error)
import kibana object func (c *KibanaObjectsClient) ImportKibanaObject(importRequest KibanaObjectImportRequest) (*KibanaObjectImportResponse, error)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExportType added in v1.11.0

type ExportType string
const (
	ExportTypeSearch        ExportType = "search"
	ExportTypeVisualization ExportType = "visualization"
	ExportTypeDashboard     ExportType = "dashboard"
)

Enums for exportType

func (ExportType) String added in v1.11.0

func (s ExportType) String() string

type KibanaObjectExportRequest added in v1.11.0

type KibanaObjectExportRequest struct {
	Type ExportType `json:"type"` // Required
}

type KibanaObjectExportResponse added in v1.11.0

type KibanaObjectExportResponse struct {
	KibanaVersion string        `json:"kibanaVersion"`
	Hits          []interface{} `json:"hits"`
}

type KibanaObjectImportRequest added in v1.11.0

type KibanaObjectImportRequest struct {
	KibanaVersion string                   `json:"kibanaVersion"`
	Override      *bool                    `json:"override,omitempty"`
	Hits          []map[string]interface{} `json:"hits"`
}

type KibanaObjectImportResponse added in v1.11.0

type KibanaObjectImportResponse struct {
	Created []string `json:"created"`
	Updated []string `json:"updated,omitempty"`
	Ignored []string `json:"ignored,omitempty"`
	Failed  []string `json:"failed,omitempty"`
}

type KibanaObjectsClient

type KibanaObjectsClient struct {
	*client.Client
	// contains filtered or unexported fields
}

func New

func New(apiToken, baseUrl string) (*KibanaObjectsClient, error)

func (*KibanaObjectsClient) ExportKibanaObject added in v1.11.0

func (c *KibanaObjectsClient) ExportKibanaObject(exportRequest KibanaObjectExportRequest) (*KibanaObjectExportResponse, error)

ExportKibanaObject allows export of the Kibana objects configuration. https://docs.logz.io/api/#operation/exportSavedObjects

func (*KibanaObjectsClient) ImportKibanaObject added in v1.11.0

func (c *KibanaObjectsClient) ImportKibanaObject(importRequest KibanaObjectImportRequest) (*KibanaObjectImportResponse, error)

ImportKibanaObject allows import of the Kibana objects configuration. https://docs.logz.io/api/#operation/exportSavedObjects

Jump to

Keyboard shortcuts

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