diff options
author | George Goldberg <george@gberg.me> | 2017-06-29 22:40:14 +0100 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-06-29 17:40:14 -0400 |
commit | f2898927f1b92d3c8cd9e7c63ce27dee7e6ae88f (patch) | |
tree | f29a8058cf581d128502b2da532fc551aa1101b9 /model | |
parent | a4f363a50b7807de9ac086ee0e62442a7645f5e8 (diff) | |
download | chat-f2898927f1b92d3c8cd9e7c63ce27dee7e6ae88f.tar.gz chat-f2898927f1b92d3c8cd9e7c63ce27dee7e6ae88f.tar.bz2 chat-f2898927f1b92d3c8cd9e7c63ce27dee7e6ae88f.zip |
PLT-6474: Server: Add elasticsearch/test endpoint to API. (#6792)
Diffstat (limited to 'model')
-rw-r--r-- | model/client4.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index 89fed55ff..33a906429 100644 --- a/model/client4.go +++ b/model/client4.go @@ -230,6 +230,10 @@ func (c *Client4) GetBrandRoute() string { return fmt.Sprintf("/brand") } +func (c *Client4) GetElasticsearchRoute() string { + return fmt.Sprintf("/elasticsearch") +} + func (c *Client4) GetCommandsRoute() string { return fmt.Sprintf("/commands") } @@ -2514,6 +2518,19 @@ func (c *Client4) DeauthorizeOAuthApp(appId string) (bool, *Response) { } } +// Elasticsearch Section + +// TestElasticsearch will attempt to connect to the configured Elasticsearch server and return OK if configured +// correctly. +func (c *Client4) TestElasticsearch() (bool, *Response) { + if r, err := c.DoApiPost(c.GetElasticsearchRoute()+"/test", ""); err != nil { + return false, BuildErrorResponse(r, err) + } else { + defer closeBody(r) + return CheckStatusOK(r), BuildResponse(r) + } +} + // Commands Section // CreateCommand will create a new command if the user have the right permissions. |