Add --type option for services across all 42 implementations
Support service_type for SRV records (minecraft, mumble, teamspeak, source, tcp, udp). Each implementation now parses --type and sends service_type in the JSON payload.
This commit is contained in:
parent
564e9e7075
commit
eb5d4ca8bf
42 changed files with 783 additions and 104 deletions
36
un.lisp
36
un.lisp
|
|
@ -153,7 +153,7 @@
|
|||
(format t "~aSession created (WebSocket required)~a~%" *yellow* *reset*)
|
||||
(format t "~a~%" response))))))
|
||||
|
||||
(defun service-cmd (action id name ports bootstrap)
|
||||
(defun service-cmd (action id name ports bootstrap service-type)
|
||||
(let ((api-key (get-api-key)))
|
||||
(cond
|
||||
((string= action "list")
|
||||
|
|
@ -174,7 +174,8 @@
|
|||
((and (string= action "create") name)
|
||||
(let* ((ports-json (if ports (format nil ",\"ports\":[~a]" ports) ""))
|
||||
(bootstrap-json (if bootstrap (format nil ",\"bootstrap\":\"~a\"" (escape-json bootstrap)) ""))
|
||||
(json (format nil "{\"name\":\"~a\"~a~a}" name ports-json bootstrap-json))
|
||||
(type-json (if service-type (format nil ",\"service_type\":\"~a\"" service-type) ""))
|
||||
(json (format nil "{\"name\":\"~a\"~a~a~a}" name ports-json bootstrap-json type-json))
|
||||
(response (curl-post api-key "/services" json)))
|
||||
(format t "~aService created~a~%" *green* *reset*)
|
||||
(format t "~a~%" response)))
|
||||
|
|
@ -202,24 +203,31 @@
|
|||
((string= (first args) "service")
|
||||
(cond
|
||||
((and (> (length args) 1) (string= (second args) "--list"))
|
||||
(service-cmd "list" nil nil nil nil))
|
||||
(service-cmd "list" nil nil nil nil nil))
|
||||
((and (> (length args) 2) (string= (second args) "--info"))
|
||||
(service-cmd "info" (third args) nil nil nil))
|
||||
(service-cmd "info" (third args) nil nil nil nil))
|
||||
((and (> (length args) 2) (string= (second args) "--logs"))
|
||||
(service-cmd "logs" (third args) nil nil nil))
|
||||
(service-cmd "logs" (third args) nil nil nil nil))
|
||||
((and (> (length args) 2) (string= (second args) "--sleep"))
|
||||
(service-cmd "sleep" (third args) nil nil nil))
|
||||
(service-cmd "sleep" (third args) nil nil nil nil))
|
||||
((and (> (length args) 2) (string= (second args) "--wake"))
|
||||
(service-cmd "wake" (third args) nil nil nil))
|
||||
(service-cmd "wake" (third args) nil nil nil nil))
|
||||
((and (> (length args) 2) (string= (second args) "--destroy"))
|
||||
(service-cmd "destroy" (third args) nil nil nil))
|
||||
(service-cmd "destroy" (third args) nil nil nil nil))
|
||||
((and (> (length args) 2) (string= (second args) "--name"))
|
||||
(let ((name (third args))
|
||||
(ports (when (and (> (length args) 4) (string= (fourth args) "--ports"))
|
||||
(fifth args)))
|
||||
(bootstrap (when (and (> (length args) 6) (string= (sixth args) "--bootstrap"))
|
||||
(seventh args))))
|
||||
(service-cmd "create" nil name ports bootstrap)))
|
||||
(let* ((name (third args))
|
||||
(rest-args (nthcdr 3 args))
|
||||
(ports nil)
|
||||
(bootstrap nil)
|
||||
(service-type nil))
|
||||
(loop for i from 0 below (length rest-args) by 2
|
||||
do (let ((opt (nth i rest-args))
|
||||
(val (nth (1+ i) rest-args)))
|
||||
(cond
|
||||
((string= opt "--ports") (setf ports val))
|
||||
((string= opt "--bootstrap") (setf bootstrap val))
|
||||
((string= opt "--type") (setf service-type val)))))
|
||||
(service-cmd "create" nil name ports bootstrap service-type)))
|
||||
(t
|
||||
(format t "Error: Invalid service command~%")
|
||||
(uiop:quit 1))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue