From 6af0be7a3316377cb3df49507763e83fe413b0ab Mon Sep 17 00:00:00 2001 From: Gzx1999 Date: Sat, 8 Apr 2023 23:44:45 +0800 Subject: [PATCH] add client apply config method --- sdk/plugin/client.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sdk/plugin/client.go b/sdk/plugin/client.go index 6af43bee..e18eb0f9 100644 --- a/sdk/plugin/client.go +++ b/sdk/plugin/client.go @@ -191,3 +191,24 @@ func (c *Client) UnListenEvent(listenerID string) error { // TODO: unregister event handler here return nil } + +func (c *Client) ApplyConfig(batch []string, path, content string) error { + url := c.Server + "/api/v1/pluginapi/apply_config" + data, err := utils.Request("PUT", url) + if err != nil { + return err + } + + resp := &struct { + Status string + Error string + }{} + if err := json.Unmarshal(data, resp); err != nil { + return err + } + if resp.Status != "ok" { + return errors.New(resp.Error) + } + + return nil +} -- Gitee