summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-18 06:32:29 -0700
committerGitHub <noreply@github.com>2021-03-18 06:32:29 -0700
commit629183bd7f0073dfcbfa4d611abc62a9c5711dab (patch)
tree812ebb2c5a6685f1f333ec960365e97b4e91457f /pkg/api/handlers/libpod
parent77b3a2df645f2548f7bd2da85bbdb17e4de98310 (diff)
parent8ea02d0b6033b6ffdc68d38f3276410f4e2e8eb9 (diff)
downloadpodman-629183bd7f0073dfcbfa4d611abc62a9c5711dab.tar.gz
podman-629183bd7f0073dfcbfa4d611abc62a9c5711dab.tar.bz2
podman-629183bd7f0073dfcbfa4d611abc62a9c5711dab.zip
Merge pull request #9710 from jmguzik/network-prune-filters-http-api
Network prune filters for http api (compat and libpod)
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 48cd37994..19c9ed658 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)