summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/tunnel
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-03-27 11:46:33 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-03-28 17:32:22 +0100
commit9812804f754120fcf14256bf0ed9cd00c36bf9f7 (patch)
treef9412fd2ac6cdfba7c688aaf122c97e5f2e1701a /pkg/domain/infra/tunnel
parentcc129d13c5b8b80f542dbc6192ff3d5df29b47ee (diff)
downloadpodman-9812804f754120fcf14256bf0ed9cd00c36bf9f7.tar.gz
podman-9812804f754120fcf14256bf0ed9cd00c36bf9f7.tar.bz2
podman-9812804f754120fcf14256bf0ed9cd00c36bf9f7.zip
podmanv2: implement pod top
Implement `podman pod top` for podmanV2. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/domain/infra/tunnel')
-rw-r--r--pkg/domain/infra/tunnel/pods.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/domain/infra/tunnel/pods.go b/pkg/domain/infra/tunnel/pods.go
index 4894874e5..9561a9807 100644
--- a/pkg/domain/infra/tunnel/pods.go
+++ b/pkg/domain/infra/tunnel/pods.go
@@ -6,6 +6,7 @@ import (
"github.com/containers/libpod/pkg/bindings/pods"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/containers/libpod/pkg/specgen"
+ "github.com/pkg/errors"
)
func (ic *ContainerEngine) PodExists(ctx context.Context, nameOrId string) (*entities.BoolReport, error) {
@@ -177,3 +178,18 @@ func (ic *ContainerEngine) PodCreate(ctx context.Context, opts entities.PodCreat
opts.ToPodSpecGen(podSpec)
return pods.CreatePodFromSpec(ic.ClientCxt, podSpec)
}
+
+func (ic *ContainerEngine) PodTop(ctx context.Context, options entities.PodTopOptions) (*entities.StringSliceReport, error) {
+ switch {
+ case options.Latest:
+ return nil, errors.New("latest is not supported")
+ case options.NameOrID == "":
+ return nil, errors.New("NameOrID must be specified")
+ }
+
+ topOutput, err := pods.Top(ic.ClientCxt, options.NameOrID, options.Descriptors)
+ if err != nil {
+ return nil, err
+ }
+ return &entities.StringSliceReport{Value: topOutput}, nil
+}