aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/client-communication.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix-build-coordinator/client-communication.scm')
-rw-r--r--guix-build-coordinator/client-communication.scm25
1 files changed, 25 insertions, 0 deletions
diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm
index bf27f93..fec53e3 100644
--- a/guix-build-coordinator/client-communication.scm
+++ b/guix-build-coordinator/client-communication.scm
@@ -52,6 +52,7 @@
request-agents-list
request-failed-builds-with-blocking-count-list
send-create-agent-request
+ send-agent-set-active-request
send-create-agent-password-request
send-create-dynamic-auth-token-request
send-replace-agent-tags-request))
@@ -272,6 +273,24 @@
(render-json
`((error . 404))
#:code 404))))
+ (('POST "agent" agent-id "active")
+ (let ((agent-details (datastore-find-agent datastore agent-id)))
+ (if agent-details
+ (let ((active? (match (assoc "active" body)
+ (("active" . active?) active?))))
+ (if (boolean? active?)
+ (begin
+ (set-agent-active build-coordinator
+ agent-id
+ active?)
+ (render-json
+ `((result . success))))
+ (render-json
+ `((error . "active must be a boolean"))
+ #:code 400)))
+ (render-json
+ `((error . 404))
+ #:code 404))))
(('GET "builds")
(let ((query-parameters (request-query-parameters request)))
(render-json
@@ -649,6 +668,12 @@
`((description . ,description))
'()))))
+(define* (send-agent-set-active-request coordinator-uri agent-uuid active?)
+ (send-request coordinator-uri
+ 'POST
+ (simple-format #f "/agent/~A/active" agent-uuid)
+ `((active . ,active?))))
+
(define (send-create-agent-password-request coordinator-uri
agent-id)
(send-request coordinator-uri