Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #30 from tpetr/master
Browse files Browse the repository at this point in the history
add JSON support for /v1/endpoints (fixes #28)
  • Loading branch information
guenter committed Sep 17, 2013
2 parents 35cf445 + 81f31c6 commit 3f084eb
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import mesosphere.marathon.tasks.TaskTracker
*/

@Path("v1/endpoints")
@Produces(Array(MediaType.TEXT_PLAIN))
class EndpointsResource @Inject()(
schedulerService: MarathonSchedulerService,
taskTracker: TaskTracker) {

@GET
@Produces(Array(MediaType.TEXT_PLAIN))
def endpoints() = {
val sb = new StringBuilder
for (app <- schedulerService.listApps()) {
Expand All @@ -29,4 +29,12 @@ class EndpointsResource @Inject()(
}
sb.toString()
}

@GET
@Produces(Array(MediaType.APPLICATION_JSON))
def endpointsJson() = {
for (app <- schedulerService.listApps) yield {
Map("id" -> app.id, "instances" -> taskTracker.get(app.id))
}
}
}

0 comments on commit 3f084eb

Please sign in to comment.