summaryrefslogtreecommitdiff
path: root/pkg/bindings/pods
diff options
context:
space:
mode:
authorSujil02 <sushah@redhat.com>2020-04-02 22:56:59 -0400
committerSujil02 <sushah@redhat.com>2020-04-17 17:30:58 -0400
commit37f3b191d5318b7d25893eabf4e57b568c326773 (patch)
tree8c2792aa1e7b4846dffc5708cf13a0eb500f4a19 /pkg/bindings/pods
parentaa97cb5f42a35de02d520f6c3006600505a3d6d9 (diff)
downloadpodman-37f3b191d5318b7d25893eabf4e57b568c326773.tar.gz
podman-37f3b191d5318b7d25893eabf4e57b568c326773.tar.bz2
podman-37f3b191d5318b7d25893eabf4e57b568c326773.zip
Add pod prune for api v2.
Add the ability to prune pods for api v2, Includes the addition of force flag, for client side prompt. Update test suite to support this use case. Signed-off-by: Sujil02 <sushah@redhat.com>
Diffstat (limited to 'pkg/bindings/pods')
-rw-r--r--pkg/bindings/pods/pods.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkg/bindings/pods/pods.go b/pkg/bindings/pods/pods.go
index 83847614a..3c60fa2a0 100644
--- a/pkg/bindings/pods/pods.go
+++ b/pkg/bindings/pods/pods.go
@@ -98,17 +98,19 @@ func Pause(ctx context.Context, nameOrID string) (*entities.PodPauseReport, erro
return &report, response.Process(&report)
}
-// Prune removes all non-running pods in local storage.
-func Prune(ctx context.Context) error {
+// Prune by default removes all non-running pods in local storage.
+// And with force set true removes all pods.
+func Prune(ctx context.Context) ([]*entities.PodPruneReport, error) {
+ var reports []*entities.PodPruneReport
conn, err := bindings.GetClient(ctx)
if err != nil {
- return err
+ return nil, err
}
response, err := conn.DoRequest(nil, http.MethodPost, "/pods/prune", nil)
if err != nil {
- return err
+ return nil, err
}
- return response.Process(nil)
+ return reports, response.Process(&reports)
}
// List returns all pods in local storage. The optional filters parameter can