diff options
Diffstat (limited to 'model/client4.go')
-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. |