github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/pkg/api/server/register_pods.go (about) 1 package server 2 3 import ( 4 "net/http" 5 6 "github.com/containers/libpod/pkg/api/handlers/libpod" 7 "github.com/gorilla/mux" 8 ) 9 10 func (s *APIServer) registerPodsHandlers(r *mux.Router) error { 11 // swagger:operation GET /libpod/pods/json pods ListPods 12 // --- 13 // summary: List pods 14 // produces: 15 // - application/json 16 // parameters: 17 // - in: query 18 // name: filters 19 // type: string 20 // description: needs description and plumbing for filters 21 // responses: 22 // 200: 23 // $ref: "#/responses/ListPodsResponse" 24 // 400: 25 // $ref: "#/responses/BadParamError" 26 // 500: 27 // $ref: "#/responses/InternalError" 28 r.Handle(VersionedPath("/libpod/pods/json"), s.APIHandler(libpod.Pods)).Methods(http.MethodGet) 29 // swagger:operation POST /libpod/pods/create pods CreatePod 30 // --- 31 // summary: Create a pod 32 // produces: 33 // - application/json 34 // parameters: 35 // - in: body 36 // name: create 37 // description: attributes for creating a pod 38 // schema: 39 // type: object 40 // $ref: "#/definitions/PodSpecGenerator" 41 // responses: 42 // 200: 43 // $ref: "#/definitions/IdResponse" 44 // 400: 45 // $ref: "#/responses/BadParamError" 46 // 500: 47 // $ref: "#/responses/InternalError" 48 r.Handle(VersionedPath("/libpod/pods/create"), s.APIHandler(libpod.PodCreate)).Methods(http.MethodPost) 49 // swagger:operation POST /libpod/pods/prune pods PrunePods 50 // --- 51 // summary: Prune unused pods 52 // produces: 53 // - application/json 54 // responses: 55 // 200: 56 // description: tbd 57 // schema: 58 // type: object 59 // additionalProperties: 60 // type: string 61 // 400: 62 // $ref: "#/responses/BadParamError" 63 // 409: 64 // description: pod already exists 65 // 500: 66 // $ref: "#/responses/InternalError" 67 r.Handle(VersionedPath("/libpod/pods/prune"), s.APIHandler(libpod.PodPrune)).Methods(http.MethodPost) 68 // swagger:operation DELETE /libpod/pods/{name} pods removePod 69 // --- 70 // summary: Remove pod 71 // produces: 72 // - application/json 73 // parameters: 74 // - in: path 75 // name: name 76 // type: string 77 // required: true 78 // description: the name or ID of the pod 79 // - in: query 80 // name: force 81 // type: boolean 82 // description : force removal of a running pod by first stopping all containers, then removing all containers in the pod 83 // responses: 84 // 200: 85 // $ref: '#/responses/PodRmReport' 86 // 400: 87 // $ref: "#/responses/BadParamError" 88 // 404: 89 // $ref: "#/responses/NoSuchPod" 90 // 500: 91 // $ref: "#/responses/InternalError" 92 r.Handle(VersionedPath("/libpod/pods/{name}"), s.APIHandler(libpod.PodDelete)).Methods(http.MethodDelete) 93 // swagger:operation GET /libpod/pods/{name}/json pods inspectPod 94 // --- 95 // summary: Inspect pod 96 // produces: 97 // - application/json 98 // parameters: 99 // - in: path 100 // name: name 101 // type: string 102 // required: true 103 // description: the name or ID of the pod 104 // responses: 105 // 200: 106 // $ref: "#/responses/InspectPodResponse" 107 // 404: 108 // $ref: "#/responses/NoSuchPod" 109 // 500: 110 // $ref: "#/responses/InternalError" 111 r.Handle(VersionedPath("/libpod/pods/{name}/json"), s.APIHandler(libpod.PodInspect)).Methods(http.MethodGet) 112 // swagger:operation GET /libpod/pods/{name}/exists pods podExists 113 // --- 114 // summary: Pod exists 115 // description: Check if a pod exists by name or ID 116 // produces: 117 // - application/json 118 // parameters: 119 // - in: path 120 // name: name 121 // type: string 122 // required: true 123 // description: the name or ID of the pod 124 // responses: 125 // 204: 126 // description: pod exists 127 // 404: 128 // $ref: "#/responses/NoSuchPod" 129 // 500: 130 // $ref: "#/responses/InternalError" 131 r.Handle(VersionedPath("/libpod/pods/{name}/exists"), s.APIHandler(libpod.PodExists)).Methods(http.MethodGet) 132 // swagger:operation POST /libpod/pods/{name}/kill pods killPod 133 // --- 134 // summary: Kill a pod 135 // produces: 136 // - application/json 137 // parameters: 138 // - in: path 139 // name: name 140 // type: string 141 // required: true 142 // description: the name or ID of the pod 143 // - in: query 144 // name: signal 145 // type: string 146 // description: signal to be sent to pod 147 // default: SIGKILL 148 // responses: 149 // 200: 150 // $ref: "#/responses/PodKillReport" 151 // 400: 152 // $ref: "#/responses/BadParamError" 153 // 404: 154 // $ref: "#/responses/NoSuchPod" 155 // 409: 156 // $ref: "#/responses/ConflictError" 157 // 500: 158 // $ref: "#/responses/InternalError" 159 r.Handle(VersionedPath("/libpod/pods/{name}/kill"), s.APIHandler(libpod.PodKill)).Methods(http.MethodPost) 160 // swagger:operation POST /libpod/pods/{name}/pause pods pausePod 161 // --- 162 // summary: Pause a pod 163 // description: Pause a pod 164 // produces: 165 // - application/json 166 // parameters: 167 // - in: path 168 // name: name 169 // type: string 170 // required: true 171 // description: the name or ID of the pod 172 // responses: 173 // 200: 174 // $ref: '#/responses/PodPauseReport' 175 // 404: 176 // $ref: "#/responses/NoSuchPod" 177 // 500: 178 // $ref: "#/responses/InternalError" 179 r.Handle(VersionedPath("/libpod/pods/{name}/pause"), s.APIHandler(libpod.PodPause)).Methods(http.MethodPost) 180 // swagger:operation POST /libpod/pods/{name}/restart pods restartPod 181 // --- 182 // summary: Restart a pod 183 // produces: 184 // - application/json 185 // parameters: 186 // - in: path 187 // name: name 188 // type: string 189 // required: true 190 // description: the name or ID of the pod 191 // responses: 192 // 200: 193 // $ref: '#/responses/PodRestartReport' 194 // 404: 195 // $ref: "#/responses/NoSuchPod" 196 // 500: 197 // $ref: "#/responses/InternalError" 198 r.Handle(VersionedPath("/libpod/pods/{name}/restart"), s.APIHandler(libpod.PodRestart)).Methods(http.MethodPost) 199 // swagger:operation POST /libpod/pods/{name}/start pods startPod 200 // --- 201 // summary: Start a pod 202 // produces: 203 // - application/json 204 // parameters: 205 // - in: path 206 // name: name 207 // type: string 208 // required: true 209 // description: the name or ID of the pod 210 // responses: 211 // 200: 212 // $ref: '#/responses/PodStartReport' 213 // 304: 214 // $ref: "#/responses/PodAlreadyStartedError" 215 // 404: 216 // $ref: "#/responses/NoSuchPod" 217 // 500: 218 // $ref: "#/responses/InternalError" 219 r.Handle(VersionedPath("/libpod/pods/{name}/start"), s.APIHandler(libpod.PodStart)).Methods(http.MethodPost) 220 // swagger:operation POST /libpod/pods/{name}/stop pods stopPod 221 // --- 222 // summary: Stop a pod 223 // produces: 224 // - application/json 225 // parameters: 226 // - in: path 227 // name: name 228 // type: string 229 // required: true 230 // description: the name or ID of the pod 231 // - in: query 232 // name: t 233 // type: integer 234 // description: timeout 235 // responses: 236 // 200: 237 // $ref: '#/responses/PodStopReport' 238 // 304: 239 // $ref: "#/responses/PodAlreadyStoppedError" 240 // 400: 241 // $ref: "#/responses/BadParamError" 242 // 404: 243 // $ref: "#/responses/NoSuchPod" 244 // 500: 245 // $ref: "#/responses/InternalError" 246 r.Handle(VersionedPath("/libpod/pods/{name}/stop"), s.APIHandler(libpod.PodStop)).Methods(http.MethodPost) 247 // swagger:operation POST /libpod/pods/{name}/unpause pods unpausePod 248 // --- 249 // summary: Unpause a pod 250 // produces: 251 // - application/json 252 // parameters: 253 // - in: path 254 // name: name 255 // type: string 256 // required: true 257 // description: the name or ID of the pod 258 // responses: 259 // 200: 260 // $ref: '#/responses/PodUnpauseReport' 261 // 404: 262 // $ref: "#/responses/NoSuchPod" 263 // 500: 264 // $ref: "#/responses/InternalError" 265 r.Handle(VersionedPath("/libpod/pods/{name}/unpause"), s.APIHandler(libpod.PodUnpause)).Methods(http.MethodPost) 266 // swagger:operation GET /libpod/pods/{name}/top pods topPod 267 // --- 268 // summary: List processes 269 // description: List processes running inside a pod 270 // produces: 271 // - application/json 272 // parameters: 273 // - in: path 274 // name: name 275 // type: string 276 // required: true 277 // description: | 278 // Name of pod to query for processes 279 // - in: query 280 // name: stream 281 // type: boolean 282 // default: true 283 // description: Stream the output 284 // - in: query 285 // name: ps_args 286 // type: string 287 // default: -ef 288 // description: arguments to pass to ps such as aux. Requires ps(1) to be installed in the container if no ps(1) compatible AIX descriptors are used. 289 // responses: 290 // 200: 291 // $ref: "#/responses/DocsPodTopResponse" 292 // 404: 293 // $ref: "#/responses/NoSuchContainer" 294 // 500: 295 // $ref: "#/responses/InternalError" 296 r.Handle(VersionedPath("/libpod/pods/{name}/top"), s.APIHandler(libpod.PodTop)).Methods(http.MethodGet) 297 return nil 298 }