diff options
author | baude <bbaude@redhat.com> | 2021-02-04 12:58:55 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2021-02-06 07:37:29 -0600 |
commit | 91ea3fabd625a891487cd0d9b130ac71366ecb74 (patch) | |
tree | c281268da8fd605a19006725d9ecda97d9bab988 /pkg/bindings/network/network.go | |
parent | c421127dd7f700829a8e5265d8ddad102061bebc (diff) | |
download | podman-91ea3fabd625a891487cd0d9b130ac71366ecb74.tar.gz podman-91ea3fabd625a891487cd0d9b130ac71366ecb74.tar.bz2 podman-91ea3fabd625a891487cd0d9b130ac71366ecb74.zip |
add network prune
add the ability to prune unused cni networks. filters are not implemented
but included both compat and podman api endpoints.
Fixes :#8673
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/bindings/network/network.go')
-rw-r--r-- | pkg/bindings/network/network.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/bindings/network/network.go b/pkg/bindings/network/network.go index 8debeee84..428e60cf2 100644 --- a/pkg/bindings/network/network.go +++ b/pkg/bindings/network/network.go @@ -180,3 +180,21 @@ func Exists(ctx context.Context, nameOrID string, options *ExistsOptions) (bool, } return response.IsSuccess(), nil } + +// Prune removes unused CNI networks +func Prune(ctx context.Context, options *PruneOptions) ([]*entities.NetworkPruneReport, error) { + // TODO Filters is not implemented + var ( + prunedNetworks []*entities.NetworkPruneReport + ) + conn, err := bindings.GetClient(ctx) + if err != nil { + return nil, err + } + + response, err := conn.DoRequest(nil, http.MethodPost, "/networks/prune", nil, nil) + if err != nil { + return nil, err + } + return prunedNetworks, response.Process(&prunedNetworks) +} |