aboutsummaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-02-14 10:18:17 -0600
committerBrent Baude <bbaude@redhat.com>2020-02-14 10:18:17 -0600
commitb1034eabe3c3eca0d7c017e59e83d5f4c921e161 (patch)
tree398ef3515bf0f29c5474cd6400b8deb4ff8bac8d /pkg/api
parent0c060dace19710716ff8f3a65865a295312d9d94 (diff)
downloadpodman-b1034eabe3c3eca0d7c017e59e83d5f4c921e161.tar.gz
podman-b1034eabe3c3eca0d7c017e59e83d5f4c921e161.tar.bz2
podman-b1034eabe3c3eca0d7c017e59e83d5f4c921e161.zip
apiv2 libpod container logs
wire up containers logs for libpod side of the house, same as compat. Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/libpod/containers.go7
-rw-r--r--pkg/api/server/register_containers.go57
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: