Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cerebro
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
cerebro
Commits
7875836d
Commit
7875836d
authored
7 years ago
by
Leonardo Menezes
Browse files
Options
Downloads
Patches
Plain Diff
created connect api to check connectivity with a cluster
parent
37907772
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/ConnectController.scala
+12
-2
12 additions, 2 deletions
app/controllers/ConnectController.scala
conf/routes
+1
-0
1 addition, 0 deletions
conf/routes
with
13 additions
and
2 deletions
app/controllers/ConnectController.scala
+
12
−
2
View file @
7875836d
...
@@ -3,16 +3,26 @@ package controllers
...
@@ -3,16 +3,26 @@ package controllers
import
javax.inject.Inject
import
javax.inject.Inject
import
controllers.auth.AuthenticationModule
import
controllers.auth.AuthenticationModule
import
models.
{
CerebroResponse
,
Hosts
}
import
elastic.ElasticClient
import
models.
{
CerebroRequest
,
CerebroResponse
,
Hosts
}
import
play.api.libs.json.
{
JsArray
,
JsString
}
import
play.api.libs.json.
{
JsArray
,
JsString
}
import
play.api.mvc.Controller
import
play.api.mvc.Controller
import
scala.concurrent.ExecutionContext.Implicits.global
class
ConnectController
@Inject
()(
val
authentication
:
AuthenticationModule
,
class
ConnectController
@Inject
()(
val
authentication
:
AuthenticationModule
,
elastic
:
ElasticClient
,
hosts
:
Hosts
)
extends
Controller
with
AuthSupport
{
hosts
:
Hosts
)
extends
Controller
with
AuthSupport
{
def
index
=
AuthAction
(
authentication
)
{
request
=>
def
index
=
AuthAction
(
authentication
)
{
_
=>
CerebroResponse
(
200
,
JsArray
(
hosts
.
getHostNames
().
map
(
JsString
(
_
))))
CerebroResponse
(
200
,
JsArray
(
hosts
.
getHostNames
().
map
(
JsString
(
_
))))
}
}
def
connect
=
AuthAction
(
authentication
).
async
(
parse
.
json
)
{
request
=>
val
req
=
CerebroRequest
(
request
,
hosts
)
elastic
.
executeRequest
(
"GET"
,
"_cluster/health"
,
None
,
req
.
target
).
map
{
response
=>
CerebroResponse
(
response
.
status
,
response
.
body
)
}
}
}
}
This diff is collapsed.
Click to expand it.
conf/routes
+
1
−
0
View file @
7875836d
...
@@ -67,6 +67,7 @@ POST /index_settings/update controllers.IndexSettingsC
...
@@ -67,6 +67,7 @@ POST /index_settings/update controllers.IndexSettingsC
# Connect module
# Connect module
GET /connect/hosts controllers.ConnectController.index
GET /connect/hosts controllers.ConnectController.index
POST /connect controllers.ConnectController.connect
# Repositories module
# Repositories module
POST /repositories controllers.RepositoriesController.get
POST /repositories controllers.RepositoriesController.get
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment