summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-10 10:15:01 -0400
committerGitHub <noreply@github.com>2020-09-10 10:15:01 -0400
commit3d33923374ee39977166d9fff3ee53c58d884bbe (patch)
tree327b33269b94c9d1faec38eaedf5b78a12a26214 /pkg/api/handlers/libpod
parente1b47296daaf4148d9970b59757a86e71bf8bb10 (diff)
parentce7d2bba1f6fdc96ef7439135b3c1388b7bac297 (diff)
downloadpodman-3d33923374ee39977166d9fff3ee53c58d884bbe.tar.gz
podman-3d33923374ee39977166d9fff3ee53c58d884bbe.tar.bz2
podman-3d33923374ee39977166d9fff3ee53c58d884bbe.zip
Merge pull request #7536 from Luap99/api-network-filter
APIv2 Add network list filtering
Diffstat (limited to 'pkg/api/handlers/libpod')
-rw-r--r--pkg/api/handlers/libpod/networks.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go
index 475522664..dfece2a4e 100644
--- a/pkg/api/handlers/libpod/networks.go
+++ b/pkg/api/handlers/libpod/networks.go
@@ -42,7 +42,21 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) {
}
func ListNetworks(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
- options := entities.NetworkListOptions{}
+ decoder := r.Context().Value("decoder").(*schema.Decoder)
+ query := struct {
+ Filter string `schema:"filter"`
+ }{
+ // override any golang type defaults
+ }
+ if err := decoder.Decode(&query, r.URL.Query()); err != nil {
+ utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
+ errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
+ return
+ }
+
+ options := entities.NetworkListOptions{
+ Filter: query.Filter,
+ }
ic := abi.ContainerEngine{Libpod: runtime}
reports, err := ic.NetworkList(r.Context(), options)
if err != nil {