summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod
diff options
context:
space:
mode:
authorJakub Guzik <jakubmguzik@gmail.com>2021-03-18 00:01:50 +0100
committerJakub Guzik <jakubmguzik@gmail.com>2021-03-18 00:01:50 +0100
commit8ea02d0b6033b6ffdc68d38f3276410f4e2e8eb9 (patch)
tree5eb17180f9429c71e9435230da4d7e077ba7d044 /pkg/api/handlers/libpod
parente7dc59252bd722377938ac3e6b4fd7e077f05293 (diff)
downloadpodman-8ea02d0b6033b6ffdc68d38f3276410f4e2e8eb9.tar.gz
podman-8ea02d0b6033b6ffdc68d38f3276410f4e2e8eb9.tar.bz2
podman-8ea02d0b6033b6ffdc68d38f3276410f4e2e8eb9.zip
network prune filters for http compat and libpod api
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
Diffstat (limited to 'pkg/api/handlers/libpod')
-rw-r--r--pkg/api/handlers/libpod/networks.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go
index a6c4f6d64..5982f50a7 100644
--- a/pkg/api/handlers/libpod/networks.go
+++ b/pkg/api/handlers/libpod/networks.go
@@ -177,10 +177,23 @@ func ExistsNetwork(w http.ResponseWriter, r *http.Request) {
// Prune removes unused networks
func Prune(w http.ResponseWriter, r *http.Request) {
- // TODO Filters are not implemented
runtime := r.Context().Value("runtime").(*libpod.Runtime)
+ decoder := r.Context().Value("decoder").(*schema.Decoder)
+ query := struct {
+ Filters map[string][]string `schema:"filters"`
+ }{
+ // override any golang type defaults
+ }
+
+ if err := decoder.Decode(&query, r.URL.Query()); err != nil {
+ utils.Error(w, "Something went wrong.", http.StatusInternalServerError, err)
+ return
+ }
+
+ pruneOptions := entities.NetworkPruneOptions{
+ Filters: query.Filters,
+ }
ic := abi.ContainerEngine{Libpod: runtime}
- pruneOptions := entities.NetworkPruneOptions{}
pruneReports, err := ic.NetworkPrune(r.Context(), pruneOptions)
if err != nil {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, err)