diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-02-14 21:21:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-14 21:21:35 +0100 |
commit | 9e9b157aa925d8d427999389aabf915dcad83355 (patch) | |
tree | b32958532681e5b050ed7363e8ee5a0865af8ed3 | |
parent | 97fdfd0a80b14b83abca3d8e0aa1b5c64ceac79b (diff) | |
parent | b1034eabe3c3eca0d7c017e59e83d5f4c921e161 (diff) | |
download | podman-9e9b157aa925d8d427999389aabf915dcad83355.tar.gz podman-9e9b157aa925d8d427999389aabf915dcad83355.tar.bz2 podman-9e9b157aa925d8d427999389aabf915dcad83355.zip |
Merge pull request #5214 from baude/apiv2loglibpod
apiv2 libpod container logs
-rw-r--r-- | pkg/api/handlers/libpod/containers.go | 7 | ||||
-rw-r--r-- | pkg/api/server/register_containers.go | 57 |
2 files changed, 54 insertions, 10 deletions
diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go index ce2836a72..752b004d8 100644 --- a/pkg/api/handlers/libpod/containers.go +++ b/pkg/api/handlers/libpod/containers.go @@ -184,13 +184,6 @@ func WaitContainer(w http.ResponseWriter, r *http.Request) { utils.WriteResponse(w, http.StatusOK, strconv.Itoa(int(exitCode))) } -func LogsFromContainer(w http.ResponseWriter, r *http.Request) { - // follow - // since - // timestamps - // tail string -} - func UnmountContainer(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value("runtime").(*libpod.Runtime) name := utils.GetName(r) diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go index ed30bc14a..b1facc27c 100644 --- a/pkg/api/server/register_containers.go +++ b/pkg/api/server/register_containers.go @@ -221,11 +221,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error { // - in: query // name: stdout // type: boolean - // description: not supported + // description: Return logs from stdout // - in: query // name: stderr // type: boolean - // description: not supported? + // description: Return logs from stderr // - in: query // name: since // type: string @@ -793,7 +793,58 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error { // 500: // $ref: "#/responses/InternalError" r.HandleFunc(VersionedPath("/libpod/containers/{name}/unmount"), APIHandler(s.Context, libpod.UnmountContainer)).Methods(http.MethodPost) - r.HandleFunc(VersionedPath("/libpod/containers/{name}/logs"), APIHandler(s.Context, libpod.LogsFromContainer)).Methods(http.MethodGet) + // swagger:operation GET /libpod/containers/{name}/logs libpod libpodLogsFromContainer + // --- + // tags: + // - containers + // summary: Get container logs + // description: Get stdout and stderr logs from a container. + // parameters: + // - in: path + // name: name + // type: string + // required: true + // description: the name or ID of the container + // - in: query + // name: follow + // type: boolean + // description: Keep connection after returning logs. + // - in: query + // name: stdout + // type: boolean + // description: Return logs from stdout + // - in: query + // name: stderr + // type: boolean + // description: Return logs from stderr + // - in: query + // name: since + // type: string + // description: Only return logs since this time, as a UNIX timestamp + // - in: query + // name: until + // type: string + // description: Only return logs before this time, as a UNIX timestamp + // - in: query + // name: timestamps + // type: boolean + // default: false + // description: Add timestamps to every log line + // - in: query + // name: tail + // type: string + // description: Only return this number of log lines from the end of the logs + // default: all + // produces: + // - application/json + // responses: + // 200: + // description: logs returned as a stream in response body. + // 404: + // $ref: "#/responses/NoSuchContainer" + // 500: + // $ref: "#/responses/InternalError" + r.HandleFunc(VersionedPath("/libpod/containers/{name}/logs"), APIHandler(s.Context, generic.LogsFromContainer)).Methods(http.MethodGet) // swagger:operation POST /libpod/containers/{name}/pause libpod libpodPauseContainer // --- // tags: |