summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-18 06:02:51 -0400
committerGitHub <noreply@github.com>2020-04-18 06:02:51 -0400
commite4e42b28dfef0ffd12f2087048dec61f9cb03976 (patch)
treeebce391a95795cb5861f55380047923fa7184271 /pkg/api
parent3b461ed6eb85f329ad163a4f18df3b872fe86f04 (diff)
parent37f3b191d5318b7d25893eabf4e57b568c326773 (diff)
downloadpodman-e4e42b28dfef0ffd12f2087048dec61f9cb03976.tar.gz
podman-e4e42b28dfef0ffd12f2087048dec61f9cb03976.tar.bz2
podman-e4e42b28dfef0ffd12f2087048dec61f9cb03976.zip
Merge pull request #5733 from sujil02/v2-pod-prune
Add pod prune for api v2
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/libpod/pods.go11
-rw-r--r--pkg/api/handlers/libpod/swagger.go7
-rw-r--r--pkg/api/server/register_pods.go6
3 files changed, 17 insertions, 7 deletions
diff --git a/pkg/api/handlers/libpod/pods.go b/pkg/api/handlers/libpod/pods.go
index 92556bb61..618d48ac0 100644
--- a/pkg/api/handlers/libpod/pods.go
+++ b/pkg/api/handlers/libpod/pods.go
@@ -232,13 +232,20 @@ func PodRestart(w http.ResponseWriter, r *http.Request) {
func PodPrune(w http.ResponseWriter, r *http.Request) {
var (
runtime = r.Context().Value("runtime").(*libpod.Runtime)
+ reports []*entities.PodPruneReport
)
- pruned, err := runtime.PrunePods()
+ responses, err := runtime.PrunePods(r.Context())
if err != nil {
utils.InternalServerError(w, err)
return
}
- utils.WriteResponse(w, http.StatusOK, pruned)
+ for k, v := range responses {
+ reports = append(reports, &entities.PodPruneReport{
+ Err: v,
+ Id: k,
+ })
+ }
+ utils.WriteResponse(w, http.StatusOK, reports)
}
func PodPause(w http.ResponseWriter, r *http.Request) {
diff --git a/pkg/api/handlers/libpod/swagger.go b/pkg/api/handlers/libpod/swagger.go
index ed19462c6..46426eb6b 100644
--- a/pkg/api/handlers/libpod/swagger.go
+++ b/pkg/api/handlers/libpod/swagger.go
@@ -70,6 +70,13 @@ type swagStartPodResponse struct {
Body entities.PodStartReport
}
+// Prune pod
+// swagger:response PodPruneReport
+type swagPrunePodResponse struct {
+ // in:body
+ Body entities.PodPruneReport
+}
+
// Rm pod
// swagger:response PodRmReport
type swagRmPodResponse struct {
diff --git a/pkg/api/server/register_pods.go b/pkg/api/server/register_pods.go
index a49bf1f63..63060af41 100644
--- a/pkg/api/server/register_pods.go
+++ b/pkg/api/server/register_pods.go
@@ -53,11 +53,7 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// - application/json
// responses:
// 200:
- // description: tbd
- // schema:
- // type: object
- // additionalProperties:
- // type: string
+ // $ref: '#/responses/PodPruneReport'
// 400:
// $ref: "#/responses/BadParamError"
// 409: