From 8ae28a55acc51a02597b23140916a690fbbdc3fc Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Mon, 6 Apr 2020 16:40:32 -0700 Subject: V2 podman diff(changes) support * Ported CLI command * Added API endpoint * Added bindings * Updated swagger (TODO: n endpoints, one handler) Signed-off-by: Jhon Honce --- pkg/api/handlers/compat/changes.go | 20 ++++++++++++++++++++ pkg/api/handlers/compat/swagger.go | 10 ++++++++++ 2 files changed, 30 insertions(+) create mode 100644 pkg/api/handlers/compat/changes.go (limited to 'pkg/api/handlers') diff --git a/pkg/api/handlers/compat/changes.go b/pkg/api/handlers/compat/changes.go new file mode 100644 index 000000000..6907c487e --- /dev/null +++ b/pkg/api/handlers/compat/changes.go @@ -0,0 +1,20 @@ +package compat + +import ( + "net/http" + + "github.com/containers/libpod/libpod" + "github.com/containers/libpod/pkg/api/handlers/utils" +) + +func Changes(w http.ResponseWriter, r *http.Request) { + runtime := r.Context().Value("runtime").(*libpod.Runtime) + + id := utils.GetName(r) + changes, err := runtime.GetDiff("", id) + if err != nil { + utils.InternalServerError(w, err) + return + } + utils.WriteJSON(w, 200, changes) +} diff --git a/pkg/api/handlers/compat/swagger.go b/pkg/api/handlers/compat/swagger.go index cbd8e61fb..f1aabf987 100644 --- a/pkg/api/handlers/compat/swagger.go +++ b/pkg/api/handlers/compat/swagger.go @@ -2,6 +2,7 @@ package compat import ( "github.com/containers/libpod/pkg/api/handlers/utils" + "github.com/containers/storage/pkg/archive" ) // Create container @@ -25,3 +26,12 @@ type swagCtrWaitResponse struct { } } } + +// Object Changes +// swagger:response Changes +type swagChangesResponse struct { + // in:body + Body struct { + Changes []archive.Change + } +} -- cgit v1.2.3-54-g00ecf