summaryrefslogtreecommitdiff
path: root/libpod/adapter/pods_remote.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/adapter/pods_remote.go')
-rw-r--r--libpod/adapter/pods_remote.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/libpod/adapter/pods_remote.go b/libpod/adapter/pods_remote.go
new file mode 100644
index 000000000..3fb147f48
--- /dev/null
+++ b/libpod/adapter/pods_remote.go
@@ -0,0 +1,44 @@
+// +build remoteclient
+
+package adapter
+
+import (
+ "context"
+
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/cmd/podman/varlink"
+ "github.com/containers/libpod/libpod"
+)
+
+// Pod ...
+type Pod struct {
+ remotepod
+}
+
+type remotepod struct {
+ config *libpod.PodConfig
+ state *libpod.PodInspectState
+ Runtime *LocalRuntime
+}
+
+func (r *LocalRuntime) RemovePods(ctx context.Context, cli *cliconfig.PodRmValues) ([]string, []error) {
+ var (
+ rmErrs []error
+ rmPods []string
+ )
+ podIDs, err := iopodman.GetPodsByContext().Call(r.Conn, cli.All, cli.Latest, cli.InputArgs)
+ if err != nil {
+ rmErrs = append(rmErrs, err)
+ return nil, rmErrs
+ }
+
+ for _, p := range podIDs {
+ reply, err := iopodman.RemovePod().Call(r.Conn, p, cli.Force)
+ if err != nil {
+ rmErrs = append(rmErrs, err)
+ } else {
+ rmPods = append(rmPods, reply)
+ }
+ }
+ return rmPods, rmErrs
+}