about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-11-04 17:16:09 +0100
committerEmile <hanemile@protonmail.com>2019-11-04 17:16:09 +0100
commitf28d65362189e8ca15ba41b238080643c66c88ae (patch)
tree9db51ed4b73289bbc82719fa815259ddd174f1f9
parent42b3c461d07f6faf2fb47c2c83e73d3695d4f1f7 (diff)
companion api endpoints template
-rw-r--r--src/companion.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/companion.go b/src/companion.go
new file mode 100644
index 0000000..521df80
--- /dev/null
+++ b/src/companion.go
@@ -0,0 +1,50 @@
+/*
+companion.go contains the definitions of api endpoints mainly used by the
+companion containers for getting a list of all challenges, getting a list of all
+running containers and starting and stopping challenge containers.
+*/
+
+package main
+
+import "net/http"
+
+// getChallenges returns some json containing a list of all challenges
+//
+// .../api/companion/getChallenges
+func getChallenges(w http.ResponseWriter, r *http.Request) {
+
+}
+
+// getRunningContainers returns a list of all running containers in the network
+// with the given uuid
+//
+// .../api/companion/getRunningContainers?uuid=ASDASD
+//
+// returns a list of all running containers within the uuid context
+func getRunningContainers(w http.ResponseWriter, r *http.Request) {
+
+}
+
+// startContainer starts a challenge container
+//
+// .../api/companion/startContainer?uuid=ASDASD&challenge=DEFDEFDEF
+//
+// ASDASDASD is the uuid of the companion container in whose network the
+// challenge shoud be inserted into
+//
+// DEFDEFDEF is the uuid of the challenge
+func startContainer(w http.ResponseWriter, r *http.Request) {
+
+}
+
+// stopContainer stops one of the challenge containers
+//
+// .../api/companion/stopContainer?uuid=ASDASD&challenge=DEFDEFDEF
+//
+// ASDASDASD is the uuid of the companion container in whose network is the
+// challenge is located
+//
+// DEFDEFDEF is the uuid of the challenge
+func stopContainer(w http.ResponseWriter, r *http.Request) {
+
+}