From c1489ce9677f50f42e97c3923ad93ac67c290f6a Mon Sep 17 00:00:00 2001 From: Ian Roddis Date: Sat, 14 Aug 2021 08:36:49 -0300 Subject: [PATCH] - Checkpointing work so I can switch computers. --- daggy/include/daggy/Server.hpp | 12 +++--------- daggy/src/Server.cpp | 29 +++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/daggy/include/daggy/Server.hpp b/daggy/include/daggy/Server.hpp index 4e212dd..5f50a1d 100644 --- a/daggy/include/daggy/Server.hpp +++ b/daggy/include/daggy/Server.hpp @@ -19,17 +19,11 @@ namespace daggy { private: void createDescription(); - // - // DAG Runs - // + void handleRunDAG(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - void runDAG(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void handleGetDAGRuns(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - // List - void getDAGRuns(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - - // Get status of specific run - void getDAGRun(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void handleGetDAGRun(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void handleReady(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); diff --git a/daggy/src/Server.cpp b/daggy/src/Server.cpp index 8756606..2b4a313 100644 --- a/daggy/src/Server.cpp +++ b/daggy/src/Server.cpp @@ -38,18 +38,31 @@ namespace daggy { .response(Http::Code::Ok, "Response to the /ready call") .hide(); + auto versionPath = desc_.path("/v1"); - auto accountsPath = versionPath.path("/accounts"); + auto dagPath = versionPath.path("/dag"); - /* - accountsPath - .route(desc_.get("/all")) - .bind(&BankerService::retrieveAllAccounts, this) - .produces(MIME(Application, Json), MIME(Application, Xml)) - .response(Http::Code::Ok, "The list of all account"); - */ + // Run a DAG + dagPath + .route(desc_.post("/")) + .bind(&Server::handleRunDAG, this) + .produces(MIME(Application, Json), MIME(Application, Xml)) + .response(Http::Code::Ok, "Run a DAG"); + // List all DAG runs + dagPath + .route(desc_.get("/")) + .bind(&Server::handleGetDAGRuns, this) + .produces(MIME(Application, Json), MIME(Application, Xml)) + .response(Http::Code::Ok, "The list of all known DAG Runs"); + + // List detailed DAG run + dagPath + .route(desc_.get("/{id}")) + .bind(&Server::handleGetDAGRun, this) + .produces(MIME(Application, Json), MIME(Application, Xml)) + .response(Http::Code::Ok, "Details of a specific DAG run"); } void Server::handleReady(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {