Skip to content

Commit

Permalink
Add save objects type for os
Browse files Browse the repository at this point in the history
Signed-off-by: Md. Ishtiaq Islam <[email protected]>
  • Loading branch information
ishtiaqhimel committed Jan 26, 2024
1 parent 3b7ea61 commit 22bd60b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion elasticsearchdashboard/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ import (
)

const (
SavedObjectsReqBody = `{"type": ["dashboard", "config", "index-pattern", "url", "query", "tag", "canvas-element", "canvas-workpad", "action", "alert", "visualization",
SavedObjectsReqBodyES = `{"type": ["dashboard", "config", "index-pattern", "url", "query", "tag", "canvas-element", "canvas-workpad", "action", "alert", "visualization",
"graph-workspace", "map", "lens", "cases", "search", "osquery-saved-query", "osquery-pack", "uptime-dynamic-settings", "infrastructure-ui-source", "metrics-explorer-view",
"inventory-view", "apm-indices"]}`
SavedObjectsReqBodyOS = `{"type": ["config", "url", "index-pattern", "query", "dashboard", "visualization", "visualization-visbuilder", "augment-vis", "map",
"observability-panel", "observability-visualization", "search"]}`
SavedObjectsExportURL = "/api/saved_objects/_export"
SavedObjectsImportURL = "/api/saved_objects/_import"
)
Expand Down
2 changes: 1 addition & 1 deletion elasticsearchdashboard/ed_client_v7.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (h *EDClientV7) ExportSavedObjects() (*Response, error) {
"Content-Type": "application/json",
"kbn-xsrf": "true",
}).
SetBody([]byte(SavedObjectsReqBody))
SetBody([]byte(SavedObjectsReqBodyES))
res, err := req.Post(SavedObjectsExportURL)
if err != nil {
klog.Error(err, "Failed to send http request")
Expand Down
2 changes: 1 addition & 1 deletion elasticsearchdashboard/ed_client_v8.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (h *EDClientV8) ExportSavedObjects() (*Response, error) {
"Content-Type": "application/json",
"kbn-xsrf": "true",
}).
SetBody([]byte(SavedObjectsReqBody))
SetBody([]byte(SavedObjectsReqBodyES))
res, err := req.Post(SavedObjectsExportURL)
if err != nil {
klog.Error(err, "Failed to send http request")
Expand Down
2 changes: 1 addition & 1 deletion elasticsearchdashboard/os_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (h *OSClient) ExportSavedObjects() (*Response, error) {
"Content-Type": "application/json",
"osd-xsrf": "true",
}).
SetBody([]byte(SavedObjectsReqBody))
SetBody([]byte(SavedObjectsReqBodyOS))
res, err := req.Post(SavedObjectsExportURL)
if err != nil {
klog.Error(err, "Failed to send http request")
Expand Down

0 comments on commit 22bd60b

Please sign in to comment.