From 2dc8f0d94d42678d3f8b5376b57adf77330c301f Mon Sep 17 00:00:00 2001 From: AnushreeHS <126440288+AnushreeHS@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:17:45 +0530 Subject: [PATCH] Saved search name cannot be changed once created (#81) --- rql/history/funcs.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rql/history/funcs.go b/rql/history/funcs.go index a09d668..383558b 100644 --- a/rql/history/funcs.go +++ b/rql/history/funcs.go @@ -55,20 +55,22 @@ func Get(c pc.PrismaCloudClient, id string) (Query, error) { } // Save saves an historic RQL search query to the saved searches list. -func Save(c pc.PrismaCloudClient, req SavedSearch) error { +func Save(c pc.PrismaCloudClient, req SavedSearch) (Query, error) { c.Log(pc.LogAction, "(create) saved search: %s", req.Id) + var ans Query + // Sanity check the time range. if err := req.TimeRange.SetType(); err != nil { - return err + return Query{}, err } path := make([]string, 0, len(Suffix)+1) path = append(path, Suffix...) path = append(path, req.Id) - _, err := c.Communicate("POST", path, nil, req, nil) - return err + _, err := c.Communicate("POST", path, nil, req, &ans) + return ans, err } // Delete removes an existing saved search query.