PLT-6474: Server: Add elasticsearch/test endpoint to API. (#6792)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
a4f363a50b
Коммит
f2898927f1
@@ -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.
|
||||
|
||||
Ссылка в новой задаче
Block a user