Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: go/src/infra/tricium/service/workflow-listener/handlers.go

Issue 2125603002: Adds initial Tricium service GAE configs (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: go/src/infra/tricium/service/workflow-listener/handlers.go
diff --git a/go/src/infra/tricium/service/workflow-listener/handlers.go b/go/src/infra/tricium/service/workflow-listener/handlers.go
new file mode 100644
index 0000000000000000000000000000000000000000..92277da97409f3357926b27d1d885660cf1ab29c
--- /dev/null
+++ b/go/src/infra/tricium/service/workflow-listener/handlers.go
@@ -0,0 +1,43 @@
+package handlers
+
+import (
+ "fmt"
+ "net/http"
+
+ "appengine"
+ "appengine/taskqueue"
+)
+
+func init() {
+ http.HandleFunc("/workflow-listener/status", statusPageHandler)
+ http.HandleFunc("/workflow-listener/queue-handler", queueHandler)
+}
+
+func statusPageHandler(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprint(w, statusPage)
+}
+
+func queueHandler(w http.ResponseWriter, r *http.Request) {
+ ctx := appengine.NewContext(r)
+
+ // TODO(emso): Process request and listen to workflow events.
+
+ // Enqueue gerrit reporter task.
+ t := taskqueue.NewPOSTTask("/gerrit-reporter/queue-handler", map[string][]string{"name": {"Workflow Event"}})
+ if _, err := taskqueue.Add(ctx, t, "gerrit-reporter-queue"); err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+}
+
+var statusPage = `
+<html>
+<head><title>Tricium</title></head>
+<body>
+<font face="sans-serif">
+== T R I C I U M (Under Construction) ==
+<hr size="1">
+<p>Status of the Workflow Listener ...</p>
+<hr size="1">
+</body>
+</html>`

Powered by Google App Engine
This is Rietveld 408576698