Coverage report: /home/ellis/comp/core/lib/pod/api.lisp

KindCoveredAll%
expression038 0.0
branch00nil
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; lib/pod/api.lisp --- Libpod API model
2
 
3
 ;;
4
 #|
5
 'podman info'
6
 
7
 curl --unix-socket /run/podman/podman.sock http://d/v4.0.0/libpod/info
8
 
9
 'podman pull quay.io/containers/podman'
10
 
11
 curl -XPOST --unix-socket /run/podman/podman.sock -v 'http://d/v4.0.0/images/create?fromImage=quay.io%2Fcontainers%2Fpodman'
12
 
13
 'podman list images'
14
 
15
 curl --unix-socket /run/podman/podman.sock -v 'http://d/v4.0.0/libpod/images/json' | jq
16
 |#
17
 ;;; Code:
18
 (in-package :pod)
19
 
20
 (eval-always
21
  (defvar *libpod-params* (make-hash-table :test #'equal))
22
  (defvar *libpod-paths* (make-hash-table :test #'equal))
23
  (defun register-libpod-param (name prototype)
24
    (setf (gethash name *libpod-params*) prototype))
25
  (defun register-libpod-path (name prototype)
26
    (setf (gethash name *libpod-paths*) prototype)))
27
 
28
 (defmacro register-libpod-params (&rest forms)
29
   (dolist (f forms)
30
     (register-libpod-param (car f) (cdr f))))
31
 
32
 (defmacro register-libpod-paths (&rest forms)
33
   (dolist (f forms)
34
     (register-libpod-path (car f) (cdr f))))
35
 
36
 ;; we should really group these better
37
 (register-libpod-params ("caCertFile" string)
38
                         ("file" string)
39
                         ("kubeConfig" string)
40
                         ("namespace" string)
41
                         ("service" string)
42
                         ("detachKeys" string)
43
                         ("logs" boolean)
44
                         ("stderr" boolean)
45
                         ("stdin" boolean)
46
                         ("stdout" boolean)
47
                         ("stream" boolean)
48
                         ("name" string)
49
                         ("export" boolean)
50
                         ("fileLocks" boolean)
51
                         ("ignoreRootFS" boolean)
52
                         ("ignoreVolumes" boolean)
53
                         ("keep" boolean)
54
                         ("leaveRunning" boolean)
55
                         ("preCheckpoint" boolean)
56
                         ("printStats" boolean)
57
                         ("tcpEstablished" boolean)
58
                         ("withPrevious" boolean)
59
                         ("author" string)
60
                         ("changes" (vector string))
61
                         ("comment" string)
62
                         ("container" string)
63
                         ("format" string)
64
                         ("pause" boolean)
65
                         ("repo" string)
66
                         ("squash" boolean)
67
                         ("stream" boolean)
68
                         ("tag" string)
69
                         ("path" string)
70
                         ("depend" boolean)
71
                         ("force" boolean)
72
                         ("ignore" boolean)
73
                         ("timeout" integer)
74
                         ("v" boolean)
75
                         ("until" time)
76
                         ("label" string)
77
                         ("label!" string)
78
                         ("names" (vector string))
79
                         ("noTrunc" boolean)
80
                         ("podmanOnly" boolean)
81
                         ("replicas" integer)
82
                         ("service" boolean)
83
                         ("type" string)
84
                         ("additionalEnvVariables" (vector string)))
85
 
86
 ;; (uri:merge-uris 
87
 ;;  (when-let ((params (url:url-encode-params '(("foo" . "bar738?")))))
88
 ;;    (concatenate 'string "?" params))
89
 ;;    (uri:parse-uri "https://test.foo"))
90
 
91
 (register-libpod-paths
92
  ;; system
93
  ("libpod/info" (:get))
94
  ("libpod/_ping" (:get))
95
  ("libpod/system/df" (:get))
96
  ;; container
97
  ("libpod/containers/json" (:get (all filters limit namespace pod size sync)))
98
  ;; image
99
  ("libpod/images/json" (:get (all filters)))
100
  ;; pod
101
  ("libpod/pods/json" (:get (filters)))
102
  ;; volume
103
  ("libpod/volumes/json" (:get (filters)))
104
  ;; secret
105
  ("libpod/secrets/json" (:get (filters)))
106
  ;; network
107
  ("libpod networks/json" (:get (filters))))
108
 
109
 (defstruct (libpod-request (:conc-name "REQUEST-"))
110
   (path "" :type string)
111
   (method :get :type keyword)
112
   (params (make-array 0 :fill-pointer 0 :adjustable t) :type vector)
113
   (body nil))
114
 
115
 (defstruct libpod-response 
116
   (status)
117
   (headers)
118
   (body nil :type (or null vector)))
119
 
120
 ;; (defmacro define-libpod-request (path))
121
 ;; (defmacro define-libpod-response (name))